Last active
August 29, 2015 14:18
-
-
Save johnjohndoe/62fbdf58608143507c94 to your computer and use it in GitHub Desktop.
Upstart configuration for Django / Gunicorn project
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
# Upstart configuration for Django project called "myapplication" | |
# =============================================================== | |
# | |
# Location: /etc/init/myapplication.conf | |
# | |
# Status: sudo service myapplication status | |
# Start: sudo service myapplication start | |
# Stop: sudo service myapplication stop | |
description "My application" | |
author "John Doe" | |
# When to start the service | |
start on runlevel [2345] | |
# When to stop the service | |
stop on runlevel [016] | |
# Automatically restart process if crashed | |
respawn | |
# Run as myapplication user | |
setuid myuser | |
setgid mygroup | |
# Current working directory | |
chdir /path/to/myapplication | |
# Start command | |
script | |
# Load virtualenv environment | |
. ../bin/activate | |
# Start webserver | |
exec gunicorn myapplication.wsgi:application --user=myuser --group=mygroup --bind 127.0.0.1:8007 --log-file=- --log-level DEBUG | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment