python - Celery beat using supervisor in production -
i trying run celery beat virtual env using supervisor. script doesn't seem work
all supervisor scripts in directory /etc/supervisord
has supervisord.conf
file , directory conf.d
contains file gorgon-celery.conf
my supervisord.conf
file looks this:
[unix_http_server] file=/tmp/supervisor.sock ; (the path socket file) [supervisord] logfile=/var/log/supervisord/main.log ; (main log file;default $cwd/supervisord.log) logfile_maxbytes=50mb ; (max main logfile bytes b4 rotation;default 50mb) logfile_backups=10 ; (num of main logfile rotation backups;default 10) loglevel=info ; (log level;default info; others: debug,warn,trace) pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid) nodaemon=false ; (start in foreground if true;default false) minfds=1024 ; (min. avail startup file descriptors;default 1024) minprocs=200 ; (min. avail process descriptors;default 200) childlogdir=/var/log/supervisord ; ('auto' child log dir, default $temp) [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface [supervisorctl] serverurl=unix:///tmp/supervisor.sock ; use unix:// url unix socket [include] files = /etc/supervisord/conf.d/*.conf
my gorgon-celery.conf
file looks this:
[program:gorgon-celery] command=cd /home/ubuntu/sites/source && source ../virtualenv/bin/activate && celery -a gorgon worker environment=pythonpath=/home/ubuntu/sites/virtualenv/bin directory=/home/ubuntu/sites/source numprocs=1 stdout_logfile=/var/log/celeryd/gorgon.log stderr_logfile=/var/log/celeryd/gorgon.log autostart=true autorestart=true startsecs=10 stopwaitsecs = 600 [program:gorgon-celerybeat] command=cd /home/ubuntu/sites/source && source ../virtualenv/bin/activate && celery -a gorgon beat --max-interval=10 environment=pythonpath=/home/ubuntu/sites/virtualenv/bin directory=/home/ubuntu/sites/source numprocs=1 stdout_logfile=/var/log/celeryd/gorgon-beat.log stderr_logfile=/var/log/celeryd/gorgon-beat.log autostart=true autorestart=true startsecs=10 stopwaitsecs = 600
finally supervisor, using command: sudo supervisord -c /etc/supervisord/supervisord.conf
try replacing
command=cd /home/sourabh_workaholic_gmail_com/sites/source && source ../virtualenv/bin/activate && celery -a gorgon beat --max-interval=10
with
command=bash /home/sourabh_workaholic_gmail_com/script.sh
and in script.sh
, put following:
#!/bin/bash cd /home/sourabh_workaholic_gmail_com/sites/source source ../virtualenv/bin/activate celery -a gorgon beat --max-interval=10
i suspect cannot use source
command supervisorctl since not execute command string in shell. source
command provided bash shell, instead put commands in bash
script work.
Comments
Post a Comment