Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Deploy Catalyst application.

by keszler (Priest)
on Nov 02, 2013 at 16:32 UTC ( #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 "" in scripts/* APP_NAME=myapp APP_PATH=/var/www/MyApp APP_USER=apache FCGI_CONNECTION=/var/www/run/myapp.sock PID_PATH=/var/www/run/ 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}" touch "$PID_PATH" chown "$APP_USER" "$PID_PATH" cd "$APP_PATH" su -c "\"script/${APP_NAME}\"\\ --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 ServerName ServerAlias 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1060956]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2018-05-28 02:36 GMT
Find Nodes?
    Voting Booth?