Supervisord + Gunicorn
If you are using supervisord for supervising process there is some catches.
For example :
[program:gunicorn]
command=/usr/local/bin/gunicorn_django -b 127.0.0.1:9001 -u www-data project/settings.py -D --error-logfile ../logs/error_gunicorn -w 4
directory=/var/www/project/sources/
user=www-data
autostart=true
autorestart=true
redirect_stderr=True
And this will give you an error:
supervisor> restart gunicorn
gunicorn: ERROR (not running)
gunicorn: ERROR (abnormal termination)
Why this is happening? Beacuse process start us daemon. Simple fix for that is removing flag -D:
command=/usr/local/bin/gunicorn_django -b 127.0.0.1:9001 -u www-data project/settings.py --error-logfile ../logs/error_gunicorn -w 4
And everything is working fine:
supervisor> status
gunicorn RUNNING pid 26463, uptime 0:01:56
Written by Kamil Gałuszka
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#