Reputation: 10811
I'm trying to write a supervisord.conf for starting a django fastcgi process. The only problem is that when I execute my fastcgi command, it spawns a fastcgi process and shows up in supervisor immediately as "EXITED". (This kinda defeats the point of supervisor)
Is there some way that the supervisor process can be aware of the fact that the django fastcgi process is, indeed, running but that it's in the background? I was digging through all of the supervisord config params it seems like this should be possible (maybe it can somehow determine this based on a pid file or something), but I got a bit lost in the documentation.
$ ./manage.py supervisor status
celerybeat RUNNING pid 12575, uptime 0:01:17
celerycam RUNNING pid 12573, uptime 0:01:17
celeryd RUNNING pid 12572, uptime 0:01:17
django EXITED Mar 13 07:57 PM
runserver RUNNING pid 12574, uptime 0:01:17
NOTE: I'm actually using django-supervisor to create my configuration file using variables in the Django context. For the purposes of this example, variables like {{ PYTHON }} and {{ settings.VIRTUALENV_ROOT }} are simply populated by the obvious paths. It should function just like a normal supervisor.conf file.
Below is my supervisord.conf file.
$ more supervisord.conf
[supervisord]
logfile={{ settings.VIRTUALENV_ROOT }}/log/supervisord-jj.log
logfile_maxbytes=50MB
logfile_backups=15
pidfile={{ settings.VIRTUALENV_ROOT }}/var/run/supervisord-jj.pid
[program:celeryd]
command={{ PYTHON }} {{ PROJECT_DIR }}/manage.py celeryd
[program:celerycam]
command={{ PYTHON }} {{ PROJECT_DIR }}/manage.py celerycam
[program:runserver]
{% if settings.DEBUG %}
exclude=false
{% else %}
exclude=true
{% endif %}
[program:django]
command={{ PYTHON }} {{ PROJECT_DIR }}/manage.py runfcgi
method=threaded daemonize=true
outlog={{ settings.VIRTUALENV_ROOT }}/log/django-fcgi.log
socket={{ settings.VIRTUALENV_ROOT }}/var/run/django-run.socket
pidfile={{ settings.VIRTUALENV_ROOT }}/var/run/django.pid
[program:autoreload]
exclude=true
Thanks for reading. Any advice is much appreciated.
Upvotes: 3
Views: 1333
Reputation: 456
Try it without forcing django to run as a daemon. Per the Supervisor docs:
Programs meant to be run under supervisor should not daemonize themselves. Instead, they should run in the foreground. They should not detach from the terminal from which they are started.
Upvotes: 4