I followed this tutorial on setting up Flask with nginx + uwsgi.
I created an upstart script at /etc/init/flask-uwsgi.conf
:
start on [2345]
stop on [06]
pre-start script
mkdir -p /var/run/flask-uwsgi
chown www-data:www-data /var/run/flask-uwsgi
end script
script
cd /var/flask-uwsgi
exec uwsgi --ini /etc/flask-uwsgi/flask-uwsgi.ini
end script
In order to work, the directory /var/run/flask-uwsgi
must be created with its owner set to www-data
.
If I do a hard reboot, this script (and the service) doesn't start automatically.
If I run service flask-uwsgi start
manually , it works fine.
I tried adding setuid root
to this script, thinking that you need root privileges to create directories in /var/run
, but that didn't help.
My syntax appears fine:
init-checkconf /etc/init/flask-uwsgi.conf
File /etc/init/flask-uwsgi.conf: syntax ok
And, the log file /var/log/upstart/flask-uwsgi.log
is empty.
What am I missing?