Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Deploy Catalyst application.

by keszler (Priest)
on Nov 02, 2013 at 16:32 UTC ( [id://1060956]=note: print w/replies, xml ) Need Help??


in reply to Deploy Catalyst application.

This is a couple of years old, so it might need to be updated for a current Catalyst.
#!/bin/bash # APP_NAME is the Catalyst-normalized name of your app (lowercased, # +s/::/_/g) # i.e. the portion before "_create.pl" in scripts/*_create.pl APP_NAME=myapp APP_PATH=/var/www/MyApp APP_USER=apache FCGI_CONNECTION=/var/www/run/myapp.sock PID_PATH=/var/www/run/myapp.pid LOG_FILE=/var/log/httpd/myapp_error.log NPROC=4 case $1 in start) if [ -r "$PID_PATH" ] && kill -0 $(cat "$PID_PATH") >/dev/null 2>& +1 then echo "$APP_NAME is already running" exit 0 fi echo -n "Starting $APP_NAME (${APP_NAME}_fastcgi.pl)..." touch "$PID_PATH" chown "$APP_USER" "$PID_PATH" cd "$APP_PATH" su -c "\"script/${APP_NAME}_fastcgi.pl\"\\ --listen $FCGI_CONNECTION\\ --pidfile \"$PID_PATH\"\\ --nproc $NPROC\\ --daemon" "$APP_USER" 2>>"$LOG_FILE" # --keeperr\\ # Wait for the app to start TIMEOUT=10; while [ ! -r "$PID_PATH" ] && ! kill -0 $(cat "$PID_PA +TH") do echo -n '.'; sleep 1; TIMEOUT=$((TIMEOUT - 1)) if [ $TIMEOUT = 0 ]; then echo " ERROR: TIMED OUT"; exit 0 fi done echo " started." ;; stop) echo -n "Stopping PROD $APP_NAME: " if [ -r "$PID_PATH" ] && kill -0 $(cat "$PID_PATH") >/dev/null 2>& +1 then PID=`cat $PID_PATH` echo -n "killing $PID... "; kill $PID echo -n "OK. Waiting for the FastCGI server to release the soc +ket..." TIMEOUT=60 while netstat -xnl | grep -q $FCGI_CONNECTION; do echo -n "."; sleep 1; TIMEOUT=$((TIMEOUT - 1)) if [ $TIMEOUT = 0 ]; then echo " ERROR: TIMED OUT"; exit 0 fi done echo " OK." else echo "$APP_NAME not running." fi ;; restart|force-reload) $0 stop echo -n "Wait two... "; sleep 2; echo "done." $0 start ;; *) echo "Usage: $0 { stop | start | restart }" exit 1 ;; esac
FastCGIExternalServer /var/www/run/myapp.fcgi -socket /var/www/run/mya +pp.sock # start it with: /etc/init.d/MyApp start # better, configure under monit <VirtualHost *:80> ServerAdmin me@mydomain.com ServerName virthostname.org ServerAlias www.virthostname.org ErrorLog /var/log/httpd/myapp_error_log TransferLog /var/log/httpd/myapp_access_log DocumentRoot /var/www/MyApp Alias /static /var/www/MyApp/root/static Alias / /var/www/run/myapp.fcgi/ <Directory /var/www/MyApp> Options Indexes FollowSymLinks ExecCGI AllowOverride All </Directory> <Directory /var/www/MyApp/root/static> allow from all </Directory> <Location /static> SetHandler default-handler </Location> RewriteEngine On # Rewrite known static files to /static/ RewriteRule ^/favicon.ico /static/favicon.ico [L,R] RewriteRule ^/robots.txt /static/robots.txt [L,R] </VirtualHost>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1060956]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 21:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found