Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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>

In reply to Re: Deploy Catalyst application. by keszler
in thread Deploy Catalyst application. by code-ninja

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (5)
    As of 2018-04-26 12:30 GMT
    Find Nodes?
      Voting Booth?