Skip to content

Instantly share code, notes, and snippets.

@jeremyjbowers
Last active December 20, 2015 15:09
Show Gist options
  • Save jeremyjbowers/6151893 to your computer and use it in GitHub Desktop.
Save jeremyjbowers/6151893 to your computer and use it in GitHub Desktop.
Basic uWSGI configuration for inspections project.
# Ubuntu Linux uses a program called Upstart
# for handling jobs that run at startup.
# We call these "daemons" because of reasons.
# Hit the google for details.
# Give our app a description because it's
# nice to do that sort of thing.
description "uWSGI server for Inspections"
# Start up if we're running the server.
start on runlevel [2345]
# Stop if we're NOT running the server.
stop on runlevel [!2345]
# Respawn this if it dies for any reason.
respawn
# Let's export an environment variable.
# Since this is for our production server,
# let's set a DEPLOYMENT_TARGET variable
# to "production."
env DEPLOYMENT_TARGET=production
# Now, the meat-and-bones.
# Run this script that calls uWSGI
# and attaches our settings file,
# our virtualenv, the WSGI file
# and runs 5 processes that will
# die after serving 25 requests.
# Listen on port 8002.
script
/usr/local/bin/uwsgi \
--env DJANGO_SETTINGS_MODULE=inspections.settings \
--module=app:application \
--virtualenv /home/ubuntu/apps/virtualenv \
--chdir /home/ubuntu/apps/inspections/inspections/ \
--touch-reload /home/ubuntu/apps/inspections/inspections/app.py \
--logto /var/log/uwsgi.log \
--die-on-term \
--vacuum \
-p 5 \
--max-requests=25 \
-s 127.0.0.1:8002
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment