2

I am trying to run celery and celerybeat in production. In my current django app I am able to test and run using the commands "celery -A Gorgon worker" and "celery -A Gorgon beat -l debug --max-interval=10". Also, I am running it through a virtualenv. Also, I am using redis as the task broker.

The whole app is running on a gunicorn server. But, when I try to daemonize the process it fails with a 111 connection error.

I have added the required scripts from https://github.com/celery/celery/tree/3.0/extra/generic-init.d into the directory /etc/init.d

As for the scripts in the /etc/defaults, they look like this:

My celeryd script is as follows

# Names of nodes to start
#   most will only start one node:

CELERYD_NODES="worker1"

#   but you can also start multiple and configure settings
#   for each in CELERYD_OPTS (see `celery multi --help` for examples).
#CELERYD_NODES="worker1 worker2 worker3"
# Absolute or relative path to the 'celery' command:
#CELERY_BIN="/usr/local/bin/celery"

CELERY_BIN="/home/ubuntu/sites/virtualenv/bin/celery"

# App instance to use
# comment out this line if you don't use an app

CELERY_APP="Gorgon"

# or fully qualified:
#CELERY_APP="proj.tasks:app"
# Where to chdir at start.

CELERYD_CHDIR="/home/ubuntu/sites/source"

# Extra command-line arguments to the worker

CELERYD_OPTS="--time-limit=300 --concurrency=8"

# %N will be replaced with the first part of the nodename.

CELERYD_LOG_FILE="/var/log/celery/%N.log"
CELERYD_PID_FILE="/var/run/celery/%N.pid"

# Workers should run as an unprivileged user.
#   You need to create this user manually (or you can choose
#   a user/group combination that already exists, e.g. nobody).
#CELERYD_USER="celery"
#CELERYD_GROUP="celery"
# If enabled pid and log directories will be created if missing,
# and owned by the userid/group configured.

CELERY_CREATE_DIRS=1

My celerybeat script is

# Absolute or relative path to the 'celery' command:

CELERY_BIN="/home/ubuntu/sites/virtualenv/bin/celery"

#CELERY_BIN="/virtualenvs/def/bin/celery"
# App instance to use
# comment out this line if you don't use an app

CELERY_APP="Gorgon"

# or fully qualified:
#CELERY_APP="proj.tasks:app"
# Where to chdir at start.

CELERYBEAT_CHDIR="/home/ubuntu/sites/source"

# Extra arguments to celerybeat
#CELERYBEAT_OPTS="--schedule=/var/run/celery/celerybeat-schedule"

How do it get my celery setup running as a daemon using my current virtual env in /home/ubuntu/sites/virtualenv

Sourabh Dev
  • 743
  • 11
  • 22

1 Answers1

-1

To run celery in daemon,you can use supervisor. This link might help you to get an idea how to run celery in daemon mode a little bit. http://www.hiddentao.com/archives/2012/01/27/processing-long-running-django-tasks-using-celery-rabbitmq-supervisord-monit/

chandu
  • 1,053
  • 9
  • 18