I'm using virtualenv, Celery 3.0.5, and supervisor 3.0. I'm assuming Celery is already installed and configured.
First, you need to install supervisor in your virtualenv and generate a configuration file.
I store a
supervisord.conf config file at the root of each project, and also, be careful to use the absolute path to the Python interpreter of the virtualenv.
$ pip install supervisor $ cd /path/to/your/project $ echo_supervisord_conf > supervisord.conf
Next, just add this section after the
[program:celeryd] command=/home/thomas/virtualenvs/yourvenv/bin/celery worker --app=myapp -l info stdout_logfile=/path/to/your/logs/celeryd.log stderr_logfile=/path/to/your/logs/celeryd.log autostart=true autorestart=true startsecs=10 stopwaitsecs=600
It's a simplified version of the Celery supervisor example configuration file, adapted to work with virtualenvs.
supervisord in your project directory.
Then, you can use the
supervisorctl command to enter the interactive shell. Type
help to get started. You can also execute supervisor command directly:
$ supervisorctl tail celeryd $ supervisorctl restart celeryd
And you ?
If you have any tips or suggestions, don't hesitate !
Tip with Bitcoin
Tip me with Bitcoin and vote for this post!
Leave a comment