Why won't my service start, and why doesn't upstart output any errors?
- by Alex Waters
I am trying to 'start gunicorn' as a service via upstart as user ale. I'm using gunicorn/flask on ubuntu 12.04 w/ init (upstart 1.5)
Here is my /etc/init/gunicorn.conf
setuid btw
setgid flask
script
export HOME=/home/btw
export WORKON_HOME=$HOME/.virtualenvs
. $HOME/.virtualenvs/default/bin/activate
cd $HOME/flask
workon default
gunicorn -c gunicorn.py bw:app
end script
It doesn't output anything other than gunicorn start/running, process 12992.
If i then do 'status gunicorn' I get stop/waiting. any ideas on how to debug this? I tried following http://upstart.ubuntu.com/wiki/Debugging but it didn't help.
If I do the following as user ale in the app's directory:
1. workon default
2. gunicorn -c gunicorn.py bw:app
then Gunicorn runs fine.
Here is ~/flask/gunicorn.py:
bind = "0.0.0.0:8080"
workers = 3
backlog = 2048
worker_class = "gevent"
debug = True
daemon = False
pidfile ="/tmp/gunicorn.pid"
log_level = "debug"
accesslog = "/var/log/gunicorn/access.log"
errorlog = "/var/log/gunicorn/error.log"
user = "btw"
group = "flask"
Also, /var/log/error.log doesn't show anything new when I try to start the Gunicorn service. If I start it manually, it shows that the workers have been loaded, etc.
Thanks for any help / suggestions!