0
votes

I have this upstart script I made using the tutorial at https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-14-04. Except I don't use virtualenv so I just have 'exec gunicorn'

description "Test Django project"

start on runlevel [2345]
stop on runlevel [!2345]

respawn
setuid userx
setgid www-data
chdir /home/mahsan/Documents/Test

exec gunicorn --workers 3 --bind unix:/home/userx/Documents/Test/Test.sock Test.wsgi:application

Using grep :init /var/log/syslog I find this:

Apr 2 15:31:24 backbox kernel: [ 5296.877715] init: gunicorn main process ended, respawning Apr 2 15:31:24 backbox kernel: [ 5296.991094] init: gunicorn main process (4247) terminated with status 1 Apr 2 15:31:24 backbox kernel: [ 5296.991133] init: gunicorn main process ended, respawning Apr 2 15:31:24 backbox kernel: [ 5297.102330] init: gunicorn main process (4249) terminated with status 1 Apr 2 15:31:24 backbox kernel: [ 5297.102359] init: gunicorn main process ended, respawning Apr 2 15:31:24 backbox kernel: [ 5297.217514] init: gunicorn main process (4251) terminated with status 1 Apr 2 15:31:24 backbox kernel: [ 5297.217528] init: gunicorn respawning too fast, stopped Apr 2 15:40:04 backbox kernel: [ 5817.334970] init: gunicorn main process (4533) terminated with status 1

However, when I do run exec gunicorn --workers 3 --bind unix:/home/userx/Documents/Test/Test.sock Test.wsgi:application from the directory that manage.py is in it starts without incident. Then when I do ps ax | grep gunicorn I see the workers show up.

Any idea what I am doing wrong here?

1
Please show the relevant upstart log from /var/log/init/.Daniel Roseman
And why aren't you using virtualenv?Daniel Roseman
which log from /var/log/init? If you are asking for the upstart/gunicorn log there wasn't one generated. Didn't think I needed virtualenv, serving is going to be hosting just that one app.MAhsan
There'll be one with the same name as your upstart script.Daniel Roseman
The upstart script is in /etc/init/gunicorn.conf. Running ls /var/log/ | grep 'gunicorn' and ls /var/log/upstart | grep 'gunicorn' both come up empty and there doesn't seem to be a /var/log/init dir.MAhsan

1 Answers

0
votes

Okay, so just had to have the .sock file in /tmp and it works. Also, if anyone else had a permission with serving static files, 403 error, its just a matter of granting nginx permissions the files.