Created
January 29, 2014 20:32
-
-
Save chrisking/8696398 to your computer and use it in GitHub Desktop.
Gunicorn Configuration
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| #!/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