Friday, October 20, 2017

Re: Start Gunicorn on boot

Hello,

Is this upstart? I thought that Ubuntu doesn't use upstart any more, but that it uses systemd instead (since version 15.04 IIRC). Maybe it contains upstart for backwards compatibility, but I think it's not a good idea to invest in learning upstart right now.

If you want to do it with systemd, which is what I recommend, you could try my recorded webinar, which also contains a cheat sheet with the systemd configuration. Otherwise you could use supervisor, which was the most recommended solution until recently (because upstart and/or init scripts were cumbersome), and which people still use more than systemd, first because systemd is newer, and second because systemd's documentation is suboptimal so it's harder to get started.

Regards,

Antonis

Antonis Christofides  http://djangodeployment.com
On 2017-10-20 11:13, Nonverbis M wrote:

Ubuntu 16.04.3 Desktop version.

gunicorn (version 19.7.1)

virtualenv 15.1.0


I'd like Gunicorn to start on boot. Gunicorn is integrated with Django.


/etc/init/photoarchive.conf

  
description "Gunicorn server for photoarchive"    start on runlevel [2345]  stop on runlevel [!2345]    respawn  setuid server  setgid server  chdir /home/server/photoarchive/photoarchive    exec /home/server/photoarchive/venv/photoarchive/bin/gunicorn photoarchive.wsgi  


What is done for self-check:

1. 

  1. cd /home/server/photoarchive/photoarchive ls

I can see manage.py.


  1. 2.

  2. cd /home/server/photoarchive/venv/photoarchive/bin/ I can see gunicorn file.

  3. cd /var/log/upstart

It is empty.


  1. 3. 

  2. $ ps aux | grep gunicorn

    server 2715 0.0 0.0 21292 948 pts/6 S+ 10:12 0:00 grep --color=auto gunicorn

Well, this is grep has grepped itself.



4. 
  1. Activate virtualenv.

    cd /home/server/photoarchive/photoarchive gunicorn photoarchive.wsgi

Now gunicorn is running. So, manually it starts.

Could you help me organize running gunicorn on start?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e021369b-9846-4daf-906d-246d52b2dbbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment