Deployment

From WormBaseWiki

Jump to: navigation, search

Contents

Via Apache2 and mod_perl

Installing Apache2 and mod_perl

sudo yum install httpd.x86_64 sudo yum install mod_perl.x86_64

Configure apache for the application

PerlSwitches -I/var/www/MyApp/lib
PerlModule MyApp
    
<Location />
        SetHandler          modperl
        PerlResponseHandler MyApp
</Location>

Configure static files

DocumentRoot /var/www/MyApp/root
<Location /static>
        SetHandler default-handler
</Location>

Set the Listen Port

Via Apache and FastCGI

Install fastcgi

curl -O http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
tar xzf mod_fastcgi*
cd mod_fastcgi*
cp Makefile.AP2 Makefile
make top_dir=/etc/httpd
sudo make install

If you get an error on make saying it can't find special.mk (which is supposed to be distributed with httpd but isn't on CentOS and is not part of httpd-devel, either), try:

sudo apxs -n mod_fastcgi -i -a -c mod_fastcgi.c fcgi_buf.c fcgi_config.c fcgi_pm.c fcgi_protocol.c fcgi_util.c

Add an entry to httpd.conf like this:

 LoadModule fastcgi_module modules/mod_fastcgi.so

 // Note: if you use the apxs command above, it inserts an incorrect line into your httpd.conf file.
 // Edit it to read exactly as above.


Launch the fastcgi server:

   // as a socket server
  script/wormbase_fastcgi.pl -l /tmp/wormbase.socket -n 5 -p /tmp/wormbase.pid -d

    // as a deamon bound to a specific port
    script/wormbase_fastcgi.pl -l :3001 -n 5 -p /tmp/wormbase.pid -d

TODO: Need a script to handle starting and stopping of the server.

Configure Apache to connect to the fastcgi server

    # 502 is a Bad Gateway error, and will occur if the backend server is down
    # This allows us to display a friendly static page that says "down for
    # maintenance"
    Alias /_errors /home/todd/projects/wormbase/website/trunk/root/error-pages
    ErrorDocument 502 /_errors/502.html

    # Socket server
    #    FastCgiExternalServer /tmp/myapp.fcgi -socket /tmp/wormbase.socket

   # Server bound to a port
   # FastCGIExternalServer /tmp/wormbase.fcgi -host localhost:3001

    # Where the server is
    # Run at root
    Alias / /tmp/wormbase.fcgi/

    # Run somewhere else
    Alias /wormbase/ /tmp/wormbase.fcgi/
Personal tools