Wednesday, November 30, 2011

Re: Process management with Supervisord

On Wed, Nov 30, 2011 at 9:35 AM, Andre Lopes <lopes80andre@gmail.com> wrote:
> Hi,
>
> I'm serving to production a Django website with Nginx + Gunicorn with
> virtualenv.
>
> My dumb question is: I must to install supervisord in my virtualenv or
> outside my virtualenv?

You should just install supervisord to your system python install
(easy_install). I run it as root manage it with upstart on Ubuntu so
it'll restart/start properly (run nginx workers and gunicorn as
non-root (servers) - this example is for uwsgi but it'll be very
similar for gunicorn):

# supervisord.conf
# put this directive at the bottom of your /etc/supervisord.conf

[program:uwsgi_example]
command=/usr/local/sbin/uwsgi
--pythonpath "/home/servers/www/example.com/app/example"
--virtualenv "/home/servers/virtualenvs/example"
--socket 127.0.0.1:9000
--module example.django_wsgi
user=servers
autostart=true
autorestart=true
stdout_logfile=/home/servers/www/example.com/logs/uwsgi.log
redirect_stderr=true

====================================

# Upstart init
# copy or symlink to /etc/init/supervisord.conf
# /etc/init/supervisord.conf

# supervisord script for upstart

description "Supervisor"

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

# --nodaemon: Run supervisord in the foreground
exec /usr/local/bin/supervisord --nodaemon

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment