[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.7-58-ge21b26b
Ruslan Zakirov
ruz at bestpractical.com
Mon Dec 21 20:05:21 EST 2009
The branch, 3.8-trunk has been updated
via e21b26b773026bc1be46aa46263fd0b7064453d0 (commit)
via da174794317a126ebaba285289a36c0ed49264f0 (commit)
via 686016692b2fb8d7fb1886f55b25b57c71ced7a0 (commit)
via ad008536c90a87e3187147f72ed5017a8734edb4 (commit)
from 1f4fa271b9e9c78104257f729f3046f9c30694e0 (commit)
Summary of changes:
Makefile.in | 3 +
bin/fastcgi_server.in | 221 ++++++++++++++++++++++++++++++++++++++++++
configure.ac | 10 +-
sbin/rt-test-dependencies.in | 23 +++-
4 files changed, 247 insertions(+), 10 deletions(-)
create mode 100644 bin/fastcgi_server.in
- Log -----------------------------------------------------------------
commit ad008536c90a87e3187147f72ed5017a8734edb4
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Mon Nov 23 02:17:38 2009 +0300
first implementation of FCGI server
diff --git a/bin/fastcgi_server.in b/bin/fastcgi_server.in
new file mode 100644
index 0000000..e57de4e
--- /dev/null
+++ b/bin/fastcgi_server.in
@@ -0,0 +1,98 @@
+#!@PERL@
+# BEGIN BPS TAGGED BLOCK {{{
+#
+# COPYRIGHT:
+#
+# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+# <jesse at bestpractical.com>
+#
+# (Except where explicitly superseded by other copyright notices)
+#
+#
+# LICENSE:
+#
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+#
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 or visit their web page on the internet at
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+#
+#
+# CONTRIBUTION SUBMISSION POLICY:
+#
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+#
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+#
+# END BPS TAGGED BLOCK }}}
+use strict;
+use warnings;
+no warnings qw(once);
+
+package RT::Interface::Web::FCGI::Server;
+use base qw(FCGI::ProcManager);
+
+package main;
+
+use File::Basename;
+require (dirname(__FILE__) .'/webmux.pl');
+
+require CGI::Fast;
+
+my $proc_manager = RT::Interface::Web::FCGI::Server->new({
+ n_processes => 10,
+});
+$proc_manager->pm_manage();
+
+while ( my $cgi = CGI::Fast->new ) {
+ $proc_manager->pm_pre_dispatch;
+
+ $ENV{'PATH'} = '/bin:/usr/bin';
+ $ENV{'CDPATH'} = '' if defined $ENV{'CDPATH'};
+ $ENV{'SHELL'} = '/bin/sh' if defined $ENV{'SHELL'};
+ $ENV{'ENV'} = '' if defined $ENV{'ENV'};
+ $ENV{'IFS'} = '' if defined $ENV{'IFS'};
+
+ Module::Refresh->refresh if RT->Config->Get('DevelMode');
+ RT::ConnectToDatabase();
+
+ my $interp = $RT::Mason::Handler->interp;
+ if (
+ !$interp->comp_exists( $cgi->path_info )
+ && $interp->comp_exists( $cgi->path_info . "/index.html" )
+ ) {
+ $cgi->path_info( $cgi->path_info . "/index.html" );
+ }
+
+ local $@;
+ eval { $RT::Mason::Handler->handle_cgi_object($cgi); };
+ if ($@) {
+ $RT::Logger->crit($@);
+ }
+ RT::Interface::Web::Handler->CleanupRequest;
+
+ $proc_manager->pm_post_dispatch;
+}
+
+1;
commit 686016692b2fb8d7fb1886f55b25b57c71ced7a0
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 da174794317a126ebaba285289a36c0ed49264f0
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 e21b26b773026bc1be46aa46263fd0b7064453d0
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