[rt-users] Nginx + R-T 3.8.10 + static FastCGI on CentOS 6.2: Can't start FastCGI service

Ruslan Zakirov ruz at bestpractical.com
Tue May 1 12:40:38 EDT 2012


On Tue, May 1, 2012 at 19:32, Chris Doherty
<Chris.Doherty at ca.flextronics.com> wrote:
> Hello, all.  Having some difficulty with a FastCGI setup.
>
> Summary: When I attempt to start the R-T FastCGI service, it does not
> start.  If I manually execute 'perl /usr/sbin/mason_handler.fcgi', it
> *does* run correctly and emits the html for the R-T login page.


It's one handler, not complete fcgi server. Apache and other web
servers have solutions to spawn pool of FCGI processes and serve them
requests. RT 3.8 has bin/fastcgi_server that is actually an external
fcgi server you can use with nginx without additional spawner.

For 4.0 you can use RT-Extension-Nginx. You can use this as a
reference to setup 3.8.

> Detail:
>
> It is a site standard that web apps must be fronted by nginx and run as
> a FastCGI process on a socket.  Our site standard Linux is CentOS 6.2
> x64.  RT-3.8.10 is packaged for CentOS by the EPEL group, but starts
> with the assumption that you'll be running under apache and using
> PostgreSQL for the back end DB (neither of which are true here).
>
> I have been trying to set up an nginx+FastCGI stack for R-T, but
> although there's documentation around the 'net, it's either extremely
> out of date or is Ubuntu-specific.  I have tried modifying things to
> match CentOS without success.
>
> What I have done so far:
>
> Disabled SELinux (off by standard on internal servers).
>
> Installed the following packages (mix of EPEL and CentOS) and their
> prereqs: mysql-server perl-FCGI perl-CPAN make rt3 rt3-mailgate
>
> Disabled the httpd service.
>
> Created MySQL database for R-T, assigned privileges, and preloaded with
> data from a testing R-T instance (running successfully on Ubuntu).
>
> Installed the CommandByMail extension (this requires make and
> perl-CPAN).
>
> Setup the /etc/rt3/RT_SiteConfig.pm:
> ------------8<---------8<-----------------
> # dynamically find out the current timezone
> my $zone = "UTC";
> $zone=`/bin/cat /etc/timezone`
>    if -f "/etc/timezone";
> chomp $zone;
> Set($Timezone, $zone);
>
> # THE BASICS:
> Set($rtname, 'tt.our.site');
> Set($Organization, 'our.site');
>
> Set($CorrespondAddress , 'helpdesk at our.site');
> Set($CommentAddress , 'helpdesk-comment at our.site');
>
> # THE WEBSERVER:
>
> Set($WebPath , "/");
> Set($WebBaseURL , "http://tt.our.site");
>
> # THE DATABASE:
>
> # map from dbconfig-common database types to their names as known by RT
> my %typemap = (
>    mysql   => 'mysql',
>    pgsql   => 'Pg',
>    sqlite3 => 'SQLite',
> );
>
> Set($DatabaseType, $typemap{mysql} || "UNKNOWN");
>
> Set($DatabaseHost, 'localhost');
> Set($DatabasePort, '');
>
> Set($DatabaseUser , 'rt');
> Set($DatabasePassword , 'Password');
>
> # SQLite needs a special case, since $DatabaseName must be a full
> pathname
> my $dbc_dbname = 'rtdb'; if ( "mysql" eq "sqlite3" ) { Set
> ($DatabaseName, '' . '/' . $dbc_dbname); } else { Set ($DatabaseName,
> $dbc_dbname); }
>
> # EXTENSIONS
> # CommandByEmail
> Set(@MailPlugins, qw(Auth::MailFrom Filter::TakeAction));
> Set(@Plugins,(qw(RT::Extension::CommandByMail)));
> Set($CommandByMailGroup, 9804);
>
> 1;
> --------------8<------------------------8<-------------------
>
> Set up the /etc/nginx/conf.d/tt.our.site.conf file:
>
> --------------8<------------------------8<-------------------
> server {
>        listen          80;
>        server_name     tt.our.site;
>        root            /usr/share/rt3/html;
>
>        location / {
>                index           index.html;
>                fastcgi_pass    unix:/var/run/rt/rt.sock;
>                include         /etc/nginx/fastcgi.conf;
>                fastcgi_param   PATH_INFO       $fastcgi_script_name;
>        }
>
>        location ~* .+\.(html|js|css)$  {
>                index           index.html;
>                fastcgi_pass    unix:/var/run/rt/rt.sock;
>                include         /etc/nginx/fastcgi.conf;
>                fastcgi_param   PATH_INFO       $fastcgi_script_name;
>        }
>
>        location /NoAuth/images/ {
>                alias /usr/share/rt3/html/NoAuth/images/;
>        }
> }
> ---------------8<-----------------8<-----------------
>
> Created an initrc file for the rt3 service, /etc/init.d/rt3:
>
> ---------------8<-----------------8<-----------------
> #!/bin/sh
>
> # rt3 - this script starts and stops the perl-FCGI RT3 daemon
> #
> # chkconfig:   - 85 15
> # description:  RT3 is a request/issue handling system written in perl
> served as a FastCGI module.
>
>
>   RTPATH=/usr/share/rt3/
>   RTUSER=nginx
>   FCGI_SOCKET_PATH=/var/run/rt3/rt3.sock
>
>   case $1 in
>       start)
>           echo -n "Starting RT: mason_handler.fcgi"
>           cd $RTPATH
>           export FCGI_SOCKET_PATH
>           su $RTUSER -c perl /usr/sbin/mason_handler.fcgi &
>           echo
>           ;;
>
>       stop)
>           echo -n "Stopping RT: "
>           PIDS=`ps axww | awk '/[m]ason_handler.fcgi/ { print $1}'`
>           if [ -n "$PIDS" ]
>           then
>               echo -n kill -TERM $PIDS
>               kill $PIDS
>               echo
>           else
>               echo RT not running
>           fi
>           ;;
>
>       restart|force-reload)
>           $0 stop
>           $0 start
>           ;;
>
>       *)
>           echo "Usage: /etc/init.d/rt3 { stop | start | restart }"
>           exit 1
>           ;;
>   esac
> ------------------------8<-----------------------8<------------------
>
> Permissions on /usr/share/rt3 are 755 nginx:nginx all the way down
> Permissions on /var/run/rt3 are 755 nginx:nginx
>
>
> As I mentioned, if I run 'chkconfig rt3 on; service rt3 start' then the
> process doesn't actually start (possibly it's starting and then
> immediately exiting, but I'm having trouble trapping that).
>
> If I run perl /usr/sbin/mason_handler.fcgi, then I get a non-fatal
> warning followed by the Login page HTML:
> -----------------------8<------------------------8<-----------------
> [Tue May  1 15:25:12 2012] [warning]: Use of uninitialized value $method
> in string ne at /usr/share/perl5/HTML/Mason/Utils.pm line 40.
> (/usr/share/perl5/HTML/Mason/Utils.pm:40)
> Set-Cookie: RT_SID_tt.our.site=08ca69d885bfb72426c13aa4b80fc95f; path=/
> Date: Tue, 01 May 2012 15:25:12 GMT
> Pragma: no-cache
> Cache-control: no-cache
> Content-Type: text/html; charset=utf-8
>
> <!DOCTYPE html
>     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> [...]
> ----------------------8<---------------------------8<------------------
>
> One thing I notice is that the socket file is not getting created; most
> of the other FastCGI programs I work with (php-fpm, thin) will create
> the socket file if it doesn't exist and they have the correct
> permissions to do so.
>
> Any ideas?
>
>
> --
> Chris Doherty
> Software Engineer
> Advanced Systems Engineering
> FLEXComputing
>
> chris.doherty at ca.flextronics.com
> www.flextronics.com
> Ph +1 289 288 1509
> Fax +1 289 288 1549
>
>
>
> Legal Disclaimer:
> The information contained in this message may be privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message
>



-- 
Best regards, Ruslan.



More information about the rt-users mailing list