Created
August 7, 2015 22:55
-
-
Save marcanuy/5ae0e0ef5976aa4a10a7 to your computer and use it in GitHub Desktop.
Using Systemd to Make Sure Gunicorn Starts on Boot. As Ubuntu has switched to systemd as its service framework starting in 15.04 for all flavors, this is a migration of the Gunicorn upstart job that appears in "Test Driven Development with Django" (http://chimera.labs.oreilly.com/books/1234000000754/ch08.html#_using_upstart_to_make_sure_gunicorn…
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
# Gunicorn Site systemd service file | |
[Unit] | |
Description=Gunicorn server for SITENAME-staging.example.com | |
After=network.target | |
After=syslog.target | |
Environment=sitedir=/Development/sites/SITENAME-staging.example.com | |
ExecStart=$(sitedir)/virtualenv/bin/gunicorn --chdir $(sitedir)/source workouts.wsgi:application --bind unix:/tmp/SITENAME-staging.example.com.socket | |
Restart=on-failure | |
RuntimeDirectory=gunicorn-stagingd | |
RuntimeDirectoryMode=755 | |
#sudo systemctl start gunicorn-SITENAME-staging.example.com.service |
Thank you. that --chdir saved me
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
New version described at https://simpleit.rocks/set-up-ubuntu-to-serve-a-django-website-step-by-step/.