[Rt-commit] rt branch, psgi, updated. rt-3.9.4-214-geffdf39

Chia-liang Kao clkao at bestpractical.com
Mon Oct 25 09:19:42 EDT 2010


The branch, psgi has been updated
       via  effdf39fcb09f1efac5c701eb338ccc1ab1dd3e8 (commit)
      from  be4cd3561bfd431c2d1c49d1f0d78554d2da5951 (commit)

Summary of changes:
 app.psgi                                        |   76 -----------------------
 configure.ac                                    |    1 +
 lib/RT/Test.pm                                  |    1 +
 sbin/{standalone_httpd.in => rt-server.fcgi.in} |    0
 sbin/rt-server.in                               |   28 +++++++--
 t/data/configs/apache2.2+fastcgi.conf.in        |    4 +-
 t/data/configs/apache2.2+mod_perl.conf.in       |    4 +-
 7 files changed, 28 insertions(+), 86 deletions(-)
 delete mode 100644 app.psgi
 copy sbin/{standalone_httpd.in => rt-server.fcgi.in} (100%)

- Log -----------------------------------------------------------------
commit effdf39fcb09f1efac5c701eb338ccc1ab1dd3e8
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Mon Oct 25 21:19:18 2010 +0800

    rt-server is now both server and psgi-app

diff --git a/app.psgi b/app.psgi
deleted file mode 100644
index 1e7cfdd..0000000
--- a/app.psgi
+++ /dev/null
@@ -1,76 +0,0 @@
-# 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 warnings;
-use strict;
-require RT;
-
-RT::LoadConfig();
-if ( RT->Config->Get('DevelMode') ) {
-    # XXX: hint to use plack -r
-}
-RT::Init();
-
-# check compatibility of the DB
-{
-    my $dbh = $RT::Handle->dbh;
-    if ( $dbh ) {
-        my ($status, $msg) = $RT::Handle->CheckCompatibility( $dbh, 'post' );
-        die $msg unless $status;
-    }
-}
-
-require RT::Interface::Web::Handler;
-RT::Interface::Web::Handler->InitSessionDir;
-
-RT::InitClasses( Heavy => 1 );
-
-$RT::Handle->dbh(undef);
-undef $RT::Handle;
-
-RT::Interface::Web::Handler->PSGIApp;
-
diff --git a/configure.ac b/configure.ac
index d382f47..8636deb 100755
--- a/configure.ac
+++ b/configure.ac
@@ -411,6 +411,7 @@ AC_CONFIG_FILES([
                  sbin/rt-validator
                  sbin/rt-email-group-admin
                  sbin/rt-server
+                 sbin/rt-server.fcgi
                  sbin/standalone_httpd
                  bin/fastcgi_server
                  bin/mason_handler.fcgi
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 26168a7..9b9bb2b 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1183,6 +1183,7 @@ sub start_apache_server {
         document_root  => $RT::MasonComponentRoot,
         tmp_dir        => "$tmp{'directory'}",
         rt_bin_path    => $RT::BinPath,
+        rt_sbin_path   => $RT::SbinPath,
         rt_site_config => $ENV{'RT_SITE_CONFIG'},
     );
     foreach (qw(log pid lock)) {
diff --git a/sbin/rt-server.fcgi.in b/sbin/rt-server.fcgi.in
new file mode 120000
index 0000000..0488cd9
--- /dev/null
+++ b/sbin/rt-server.fcgi.in
@@ -0,0 +1 @@
+rt-server.in
\ No newline at end of file
diff --git a/sbin/rt-server.in b/sbin/rt-server.in
index df687a4..e4f61da 100755
--- a/sbin/rt-server.in
+++ b/sbin/rt-server.in
@@ -86,10 +86,6 @@ if (grep { m/help/ } @ARGV) {
 require RT;
 RT->LoadConfig();
 
-my $explicit_port = $ARGV[0] && $ARGV[0] !~ m/-/ ? shift @ARGV : undef;
-warn "Deprecated: please run $0 --port $explicit_port instead".$/ if $explicit_port;
-my $port = $explicit_port || RT->Config->Get('WebPort') || '8080';
-
 require RT::Handle;
 my ($integrity, $state, $msg) = RT::Handle->CheckIntegrity;
 
@@ -133,14 +129,34 @@ EOF
 }
 
 require RT::Interface::Web::Handler;
-use Plack::Runner;
-my $r = Plack::Runner->new( server => $0 =~ 'rt-server$' ? 'Starlet' : 'Standalone', env => 'deployment' );
 
+# when used as a psgi file
+unless ($0 eq __FILE__) {
+    return RT::Interface::Web::Handler->PSGIApp;
+}
+
+
+# load appropriate server
+
+my $explicit_port = $ARGV[0] && $ARGV[0] !~ m/-/ ? shift @ARGV : undef;
+warn "Deprecated: please run $0 --port $explicit_port instead".$/ if $explicit_port;
+my $port = $explicit_port || RT->Config->Get('WebPort') || '8080';
+
+require Plack::Runner;
+
+my $is_fastcgi = $0 =~ m/fcgi$/;
+my $r = Plack::Runner->new( $0 =~ 'standalone' ? ( server => 'Standalone' ) :
+                            $is_fastcgi        ? ( server => 'FCGI' )
+                                               : (),
+                            env => 'deployment' );
 my @args = @ARGV;
 push @args, '--port', $port unless grep { m/port/ } @args;
+push @args, '--server', 'Starlet' unless $r->{server} || grep { m/server/ } @args;
 
 $r->parse_options(@args);
 
+delete $r->{options} if $is_fastcgi; ### mangle_host_port_socket ruins everything
+
 unless ($r->{env} eq 'development') {
     push @{$r->{options}}, server_ready => sub {
         my($args) = @_;
diff --git a/t/data/configs/apache2.2+fastcgi.conf.in b/t/data/configs/apache2.2+fastcgi.conf.in
index 75cbadb..1ee521e 100644
--- a/t/data/configs/apache2.2+fastcgi.conf.in
+++ b/t/data/configs/apache2.2+fastcgi.conf.in
@@ -28,10 +28,10 @@ LogLevel debug
 
 AddDefaultCharset UTF-8
 
-FastCgiServer %%RT_BIN_PATH%%/mason_handler.fcgi -processes 1 -idle-timeout 180 -initial-env RT_SITE_CONFIG=%%RT_SITE_CONFIG%%
+FastCgiServer %%RT_SBIN_PATH%%/rt-server.fcgi -processes 1 -idle-timeout 180 -initial-env RT_SITE_CONFIG=%%RT_SITE_CONFIG%%
 
 Alias /NoAuth/images/ %%DOCUMENT_ROOT%%/NoAuth/images/
-ScriptAlias / %%RT_BIN_PATH%%/mason_handler.fcgi/
+ScriptAlias / %%RT_SBIN_PATH%%/rt-server.fcgi/
 
 DocumentRoot "%%DOCUMENT_ROOT%%"
 <Location />
diff --git a/t/data/configs/apache2.2+mod_perl.conf.in b/t/data/configs/apache2.2+mod_perl.conf.in
index 3d28c2c..472c79b 100644
--- a/t/data/configs/apache2.2+mod_perl.conf.in
+++ b/t/data/configs/apache2.2+mod_perl.conf.in
@@ -26,7 +26,6 @@ LogLevel debug
 
 AddDefaultCharset UTF-8
 PerlSetEnv RT_SITE_CONFIG %%RT_SITE_CONFIG%%
-PerlRequire %%RT_BIN_PATH%%/webmux.pl
 
 RedirectMatch permanent (.*)/$ $1/index.html
 
@@ -36,6 +35,7 @@ DocumentRoot "%%DOCUMENT_ROOT%%"
     Allow from all
 
     SetHandler perl-script
-    PerlResponseHandler RT::Mason
+    PerlResponseHandler Plack::Handler::Apache2
+    PerlSetVar psgi_app %%RT_SBIN_PATH%%/rt-server
 </Directory>
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list