[Rt-commit] rt branch, external_fastcgi, updated. rt-3.8.6-110-g2baad5e
Ruslan Zakirov
ruz at bestpractical.com
Tue Dec 15 19:40:36 EST 2009
The branch, external_fastcgi has been updated
via 2baad5ee8fa9546a74eaa2269be827961f097c50 (commit)
via 6ac39a930328d91c04c20c874983bd6a4530a992 (commit)
via 2e92bab399fbaed097f1460bfa8698f1b7302bfd (commit)
from 0e4f84dc8c42918523299444a886b80214880f40 (commit)
Summary of changes:
Makefile.in | 3 +
bin/fastcgi_server.in | 125 +++++++++++++++++++++++++++++++++++++++++-
configure.ac | 10 ++-
sbin/rt-test-dependencies.in | 23 ++++++--
4 files changed, 150 insertions(+), 11 deletions(-)
- Log -----------------------------------------------------------------
commit 2e92bab399fbaed097f1460bfa8698f1b7302bfd
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Tue Dec 15 11:42:09 2009 +0300
* implemention of first working version of FastCGI server
diff --git a/bin/fastcgi_server.in b/bin/fastcgi_server.in
index e57de4e..19b17c1 100644
--- a/bin/fastcgi_server.in
+++ b/bin/fastcgi_server.in
@@ -46,6 +46,55 @@
# those contributions and any derivatives thereof.
#
# END BPS TAGGED BLOCK }}}
+
+=head1 NAME
+
+fastcgi_server - external FastCGI server for RT
+
+=head1 USAGE
+
+ # get help
+ fastcgi_server -h
+
+ # start a server using defaults
+ fastcgi_server
+
+ # start server with custom option
+ fastcgi_server --socket /path/to/socket -n 5
+ fastcgi_server --port 12345 -n 5
+
+=head1 DESCRIPTION
+
+This is a forking external FastCGI server for RT, it can be used
+with apache and other servers supporting FastCGI technology.
+
+An advantage is lower memory usage because of sharing memory
+between process. It's easier to use this with nginx and other
+servers that can not maintain pool of fastcgi servers, apache
+can do this.
+
+Disadvantage is that you have to start this server yourself and
+monitor it, web servers wouldn't be able to restart it on crash.
+
+=head1 OPTIONS
+
+=over 4
+
+=item -h, --help - get help
+
+=item -n, --nprocesses - number of processes to start, by default 10
+
+=item -s, --socket - socket path, by default F<RT/var/path/fastcgi.sock>
+usually F</opt/rt3/var/fastcgi.sock>.
+
+=item -p, --port - port to use instead of socket, by default socket is
+used.
+
+=back
+
+=cut
+
+
use strict;
use warnings;
no warnings qw(once);
@@ -55,14 +104,51 @@ use base qw(FCGI::ProcManager);
package main;
+use Getopt::Long;
+
+my %opt = (
+ help => 0,
+ socket => '',
+ port => 0,
+ nprocesses => 10,
+);
+
+GetOptions(
+ 'h|help!' => \$opt{'help'},
+ 's|socket=s' => \$opt{'socket'},
+ 'p|port=s' => \$opt{'port'},
+ 'n|nprocesses=s' => \$opt{'nprocesses'},
+);
+
+if ( $opt{'help'} ) {
+ require Pod::Usage;
+ Pod::Usage::pod2usage(
+ -message => "",
+ -exitval => $opt{'help'}? 0 : 1,
+ -verbose => 99,
+ -sections => $opt{'help'}? 'NAME|USAGE|DESCRIPTION|OPTIONS' : 'NAME|USAGE',
+ );
+}
+
use File::Basename;
require (dirname(__FILE__) .'/webmux.pl');
+unless ( $opt{'socket'} && $opt{'port'} ) {
+ require File::Spec;
+ $opt{'socket'} = File::Spec->catfile($RT::VarPath, 'fastcgi.sock');
+}
+
+if ( $opt{'port'} ) {
+ $opt{'socket'} = ':'. $opt{'port'};
+}
+$ENV{'FCGI_SOCKET_PATH'} = $opt{'socket'};
+
require CGI::Fast;
my $proc_manager = RT::Interface::Web::FCGI::Server->new({
- n_processes => 10,
+ n_processes => $opt{'nprocesses'} || 10,
});
+
$proc_manager->pm_manage();
while ( my $cgi = CGI::Fast->new ) {
commit 6ac39a930328d91c04c20c874983bd6a4530a992
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Tue Dec 15 11:43:09 2009 +0300
changes in suplimentary files for FastCGI server
diff --git a/Makefile.in b/Makefile.in
index 19a5f68..b96d8f3 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -134,6 +134,8 @@ RT_STANDALONE_SERVER = standalone_httpd
RT_SPEEDYCGI_HANDLER = mason_handler.scgi
# RT_FASTCGI_HANDLER is the mason handler script for FastCGI
RT_FASTCGI_HANDLER = mason_handler.fcgi
+# RT_FASTCGI_SERVER is the FastCGI server
+RT_FASTCGI_SERVER = fastcgi_server
# RT_WIN32_FASTCGI_HANDLER is the mason handler script for FastCGI
RT_WIN32_FASTCGI_HANDLER = mason_handler.svc
# RT's CLI
@@ -153,6 +155,7 @@ BINARIES = $(RT_MODPERL_HANDLER) \
$(RT_STANDALONE_SERVER) \
$(RT_SPEEDYCGI_HANDLER) \
$(RT_FASTCGI_HANDLER) \
+ $(RT_FASTCGI_SERVER) \
$(RT_WIN32_FASTCGI_HANDLER)
diff --git a/configure.ac b/configure.ac
index ae3c0d4..d11448f 100755
--- a/configure.ac
+++ b/configure.ac
@@ -35,14 +35,15 @@ dnl WEB_HANDLER
AC_ARG_WITH(web-handler,
AC_HELP_STRING([--with-web-handler=LIST],
[comma separated list of web-handlers RT will be able to use.
- Default is fastcgi when modperl1, modperl2, fastcgi, standalone
- and speedycgi are valid. To succefuly run RT you need only one.
+ Default is fastcgi when modperl1, modperl2, fastcgi, fastcgi-server,
+ standalone and speedycgi are valid. To succefuly run RT you need
+ only one.
]),
WEB_HANDLER=$withval,
WEB_HANDLER=fastcgi)
-my_web_handler_test=$($PERL -e 'print "ok" unless grep $_ !~ /^(modperl[12]|fastcgi|speedycgi|standalone)$/i, grep defined && length, split /\s*,\s*/, "$WEB_HANDLER"')
+my_web_handler_test=$($PERL -e "print 'ok' unless grep \$_ !~ /^(modperl[12]|fastcgi(?:-server)?|speedycgi|standalone)\$/i, grep defined && length, split /\s*,\s*/, '$WEB_HANDLER'")
if test "$my_web_handler_test" != "ok"; then
- AC_MSG_ERROR([Only modperl1, modperl2, fastcgi, speedycgi and standalone are valid web-handlers])
+ AC_MSG_ERROR([Only modperl1, modperl2, fastcgi, fastcgi-server, speedycgi and standalone are valid web-handlers])
fi
AC_SUBST(WEB_HANDLER)
@@ -404,6 +405,7 @@ AC_CONFIG_FILES([
sbin/rt-validator
sbin/rt-email-group-admin
sbin/rt-server
+ bin/fastcgi_server
bin/mason_handler.fcgi
bin/mason_handler.scgi
bin/standalone_httpd
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 9819108..a0c99a4 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -60,7 +60,7 @@ GetOptions(
\%args, 'v|verbose',
'install', 'with-MYSQL',
'with-POSTGRESQL|with-pg|with-pgsql', 'with-SQLITE',
- 'with-ORACLE', 'with-FASTCGI',
+ 'with-ORACLE', 'with-FASTCGI', 'with-FASTCGI-SERVER',
'with-SPEEDYCGI', 'with-MODPERL1',
'with-MODPERL2', 'with-DEV',
'with-STANDALONE',
@@ -172,11 +172,12 @@ The following switches will tell the tool to check for specific dependencies
--with-oracle Database interface for Oracle
--with-sqlite Database interface and driver for SQLite (unsupported)
- --with-standalone Libraries needed to support the standalone simple pure perl server
- --with-fastcgi Libraries needed to support the fastcgi handler
- --with-speedycgi Libraries needed to support the speedycgi handler
- --with-modperl1 Libraries needed to support the modperl 1 handler
- --with-modperl2 Libraries needed to support the modperl 2 handler
+ --with-standalone Libraries needed to support the standalone simple pure perl server
+ --with-fastcgi-server Libraries needed to support the external fastcgi server
+ --with-fastcgi Libraries needed to support the fastcgi handler
+ --with-speedycgi Libraries needed to support the speedycgi handler
+ --with-modperl1 Libraries needed to support the modperl 1 handler
+ --with-modperl2 Libraries needed to support the modperl 2 handler
--with-dev Tools needed for RT development
@@ -303,6 +304,16 @@ FCGI
CGI::Fast
.
+$deps{'FASTCGI-SERVER'} = [ text_to_hash( << '.') ];
+CGI 3.38
+CGI::Fast
+FCGI::ProcManager
+File::Basename
+File::Spec
+Getopt::Long
+Pod::Usage
+.
+
$deps{'SPEEDYCGI'} = [ text_to_hash( << '.') ];
CGI 3.38
CGI::SpeedyCGI
commit 2baad5ee8fa9546a74eaa2269be827961f097c50
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Wed Dec 16 03:39:31 2009 +0300
document RT on nginx with fastcgi_server
diff --git a/bin/fastcgi_server.in b/bin/fastcgi_server.in
index 19b17c1..38f4e96 100644
--- a/bin/fastcgi_server.in
+++ b/bin/fastcgi_server.in
@@ -92,6 +92,43 @@ used.
=back
+=head1 SERVER CONFIGURATION
+
+=head2 nginx
+
+Below you can find example of minimal config for nginx to run RT
+with this FastCGI server. It's not ideal, but a good enough start.
+
+ worker_processes 1;
+ events { worker_connections 1024; }
+
+ pid /opt/rt3/var/nginx/server.pid;
+ error_log /opt/rt3/var/nginx/error.log debug;
+
+ http {
+ access_log /opt/rt3/var/nginx/access.log;
+
+ server {
+ listen 8080;
+ server_name localhost;
+
+ location / {
+ root /opt/rt3/share/html;
+ fastcgi_pass unix:/opt/rt3/var/fastcgi.sock;
+
+ fastcgi_param QUERY_STRING $query_string;
+ fastcgi_param REQUEST_METHOD $request_method;
+ fastcgi_param CONTENT_TYPE $content_type;
+ fastcgi_param CONTENT_LENGTH $content_length;
+ fastcgi_param PATH_INFO $fastcgi_script_name;
+ }
+
+ location /NoAuth/images/ {
+ alias /opt/rt3/share/html/NoAuth/images/;
+ }
+ }
+ }
+
=cut
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list