0

I am deploying a Flask application with Gunicorn, Nginx and Supervisord. Here is my config file for the application:

[program:apwd-flask]
command = /home/aaron/dev/apwd-flask/venv/bin/gunicorn --workers=3 wsgi:app -b localhost:8000
directory = /home/aaron/dev/apwd-flask
environment = PATH="/home/aaron/dev/apwd-flask/venv/bin"
user = nginx
autostart = true
autorestart = true
redirect_stderr = true

This works fine when I start it directly from the command line by specifying the app name apwd-flask.

However, upon boot or just entering the generic sudo supervisorctl command with no arguments it fails and logs the following:

2016-01-23 11:06:43,550 INFO spawnerr: can't find command '/home/aaron/dev/apwd-flask/venv/bin/gunicorn'
2016-01-23 11:06:44,551 INFO spawnerr: can't find command '/home/aaron/dev/apwd-flask/venv/bin/gunicorn'
2016-01-23 11:06:46,556 INFO spawnerr: can't find command '/home/aaron/dev/apwd-flask/venv/bin/gunicorn'
2016-01-23 11:06:49,742 INFO spawnerr: can't find command '/home/aaron/dev/apwd-flask/venv/bin/gunicorn'
2016-01-23 11:06:49,742 INFO gave up: apwd-flask entered FATAL state, too many start retries too quickly

I originally didn't have the environment = PATH... directive in the config file but after some research thought this might be the solution to the problem (Even though the command is already a full path). This didn't change the outcome though.

EDIT: I am starting to put this down to something unusual with my home folder on boot. My nginx (which is used as the reverse proxy for this gunicorn server) fails to start on boot and the nginx log complains that it's unable to locate my log file - which is also in the home directory. I then simply start nginx from the cli and it starts with no issue. Thinking this might be somehow related, I then ran supervisor from the cli with the reload directive (only) and this also worked - the server started without complaint. It's almost like my home folder or the sub folder within it isn't accessible at the time the system boots and these two servers try to start up.

Thanks in advance. Aaron

  • Did you try to remove the space characters? So, instead of command = /home/aaron/dev/apwd-flask/venv/bin/gunicorn --workers=3 wsgi:app -b localhost:8000, command=/home/aaron/dev/apwd-flask/venv/bin/gunicorn --workers=3 wsgi:app -b localhost:8000.. – gf_ Jan 23 '16 at 23:31
  • Thanks for the suggestion gf_. I gave it a try but it didn't change anything. – Alpaus Jan 24 '16 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.