0

I'm working with django celery,I have a deamon of celery with supervisor but I have a problem in the django admin I can't see the state of the task, I can only see the state of my tasks in the django admin, when I typed in console python manage.py celerycam, How I run a daemon of celerycam.

nuxq
  • 1
  • 2
  • It's the same way you setup celery with supervisor, but with the command `./manage.py celerycam`. – Shang Wang Nov 12 '15 at 19:34
  • I have this in command=/deploy/venvs/venvSite/bin/python deploy/sites/web/manage.py celerycam , but this is no fine I have a mistake when run supervisor – nuxq Nov 12 '15 at 20:27

1 Answers1

0

You can start your celerycam daemon with your app and celery all together with supervisorctl.

Example config file (/etc/supervisor/conf.d/app_name.conf):

# app config
[program:app_name]
user = www-data
directory = /var/www/app_name
command = /var/www/app_name/bin/python /var/www/app_name/bin/gunicorn agora.wsgi_server:application --bind 127.0.0.1:8022 -t 90 --workers 4 --settings='app_name.settings.production'
redirect_stderr = true
autorestart=true
stdout_logfile = /var/log/supervisor/app_name.log
stderr_logfile = /var/log/supervisor/app_name_err.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=50
stdout_capture_maxbytes=1MB
stdout_events_enabled=false
loglevel=warn
autostart = true
stopsignal=KILL
environment=LANG="en_US.UTF-8",LC_ALL="en_US.UTF-8",LC_LANG="en_US.UTF-8"
stopasgroup=true
killasgroup=true

# celerycam config
[program:app_name_celerycam]
user = www-data
directory = /var/www/app_name
command = /var/www/app_name/bin/python manage.py celerycam --settings='app_name.settings.production'
redirect_stderr = true
autorestart=true
stdout_logfile = /var/log/supervisor/app_name_celerycam.log
stderr_logfile = /var/log/supervisor/app_name_celerycam_err.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=50
stdout_capture_maxbytes=1MB
stdout_events_enabled=false
loglevel=warn
autostart = true
stopwaitsecs=5

# celery config
[program:app_name_celery]
user = www-data
directory = /var/www/app_name
command = /var/www/app_name/bin/python manage.py celeryd -l INFO -E -B  --settings='app_name.settings.production' --concurrency=1 --pidfile=/var/run/celery/app_name_celery.pid
redirect_stderr = true
autorestart=true
stdout_logfile = /var/log/supervisor/app_name_celery.log
stderr_logfile = /var/log/supervisor/app_name_celery_err.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=50
stdout_capture_maxbytes=1MB
stdout_events_enabled=false
loglevel=warn
autostart=true
stopwaitsecs=5
environment=C_FORCE_ROOT=1
stopasgroup=true
killasgroup=true

# group of our daemons
[group:app_name]
programs=app_name,app_name_celerycam,app_name_celery
priority=999

Reload our configuration:

supervisorctl reread

Now we can manage all daemons of our application with simple commands:

supervisorctl start app_name:*
supervisorctl stop app_name:*
supervisorctl restart app_name:*
supervisorctl status app_name:*
Vladimir Vovk
  • 688
  • 8
  • 9