Thursday, July 21, 2016

Re: Unable to set up celery in supervisord

If you are getting variables from the environment, supervisor that special environment directive. The variables need to specified in the supervisor conf file, such as:

command=/home/ankush/jremind/env/bin/celery --app=remind.celery:app worker --loglevel=INFO
environment=PYTHONPATH=/home/ankush/jremind/jremind,SECRET_KEY="foo",VARIABLE_A="a"
directory=/home/ankush/jremind/jremind
stdout_logfile=/home/ankush/jremind/logs/celeryd.log
stderr_logfile=/home/ankush/jremind/logs/celeryd.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs=600

Supervisor won't be able to read them otherwise. There are other alternatives, for example, if you are using a crafted command, using bash:

command=/home/foo/command.sh
environment=PYTHONPATH=/home/ankush/jremind/jremind
directory=/home/ankush/jremind/jremind
stdout_logfile=/home/ankush/jremind/logs/celeryd.log
stderr_logfile=/home/ankush/jremind/logs/celeryd.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs=600


command.sh

!#/bin/bash

export SECRET_KEY="foo"
export VARIABLE_A="a"

echo $SECRET_KEY
echo $VARIABLE_A


--
George R. C. Silva
Sigma Geosistemas LTDA
----------------------------

--
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/CAGyPVTvieR6ibVw9tPB5-m3kuNr%3Dqz4NwoDOpwK2yr%3DkcbVoFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment