Skip to content

Instantly share code, notes, and snippets.

@chrisking
Created January 29, 2014 20:32
Show Gist options
  • Select an option

  • Save chrisking/8696398 to your computer and use it in GitHub Desktop.

Select an option

Save chrisking/8696398 to your computer and use it in GitHub Desktop.
Gunicorn Configuration
description "Gunicorn Web Server"
start on runlevel [2345]
stop on runlevel [!2345]
#Send KILL after 5 seconds
kill timeout 5
respawn
#Serve Gunicorn locally
script
exec /home/ubuntu/projects/dexter/conf/gunicorn.sh
end script
#!/bin/bash
set -e
#Define User & Group
USER=`whoami`
GROUP=root
LOGFILE="/home/ubuntu/logs/gunicorn.log"
NUM_WORKERS=12
TIMEOUT=180
cd /home/ubuntu/projects/dexter
source /home/ubuntu/.virtualenvs/dexter/bin/activate
#Set the env vars
export PYTHONPATH=.:/home/ubuntu/projects/dexter
export DJANGO_SETTINGS_MODULE=dexter.settings.production
exec /home/ubuntu/.virtualenvs/dexter/bin/gunicorn_django -w $NUM_WORKERS \
--user=ubuntu --group=$GROUP --log-level=debug \
--log-file=$LOGFILE 2>>$LOGFILE \
--timeout=$TIMEOUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment