Last active
August 29, 2015 14:16
-
-
Save k1000/438ce24c7c2b98ed77fa to your computer and use it in GitHub Desktop.
Server instrumentation with Upstart, Gunicorn, Django
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start on runlevel [2345] | |
stop on runlevel [06] | |
respawn | |
respawn limit 10 5 | |
script | |
NAME=app_name | |
PORT=8002 | |
NUM_WORKERS=3 | |
TIMEOUT=120 | |
USER=john | |
GROUP=john | |
LOGFILE=/var/log/gunicorn/$NAME.log | |
LOGDIR=$(dirname $LOGFILE) | |
test -d $LOGDIR || mkdir -p $LOGDIR | |
cd /home/john/app | |
exec /home/john/app/env/bin/gunicorn \ | |
--env DJANGO_SETTINGS_MODULE=$NAME.settings \ | |
$NAME.wsgi:application \ | |
-w $NUM_WORKERS -t $TIMEOUT \ | |
--user=$USER --group=$GROUP --log-level=debug \ | |
--name=$NAME -b 127.0.0.1:$PORT | |
--log-file=$LOGFILE 2>>$LOGFILE | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment