G
G
Grigory Dikiy2017-08-04 17:16:23
Django
Grigory Dikiy, 2017-08-04 17:16:23

Daemon for Celery systemd?

Good afternoon. setting up celery in production like this . I do everything according to the instructions, but the daemon does not start.
/etc/conf.d/celery

CELERYD_NODES="w1"

CELERY_BIN="/home/dikiigr/venv/posudahome/bin/celery"

CELERY_APP="shop"

CELERYD_MULTI="multi"

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

# - %n will be replaced with the first part of the nodename.
# - %I will be replaced with the current child process index
CELERYD_PID_FILE="/var/run/celery/%n.pid"
CELERYD_LOG_FILE="/var/log/celery/%n%I.log"
CELERYD_LOG_LEVEL="INFO"

/etc/systemd/system/celery.service
[Unit]
Description=Celery Service
After=network.target

[Service]
Type=forking
User=dikiigr
Group=dikiigr
EnvironmentFile=-/etc/conf.d/celery
WorkingDirectory=/home/dikiigr/posudahome/engine
ExecStart=/bin/sh -c '${CELERY_BIN} multi start ${CELERYD_NODES} \
  -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \
  --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
ExecStop=/bin/sh -c '${CELERY_BIN} multi stopwait ${CELERYD_NODES} \
  --pidfile=${CELERYD_PID_FILE}'
ExecReload=/bin/sh -c '${CELERY_BIN} multi restart ${CELERYD_NODES} \
  -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \
  --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'

[Install]
WantedBy=multi-user.target

Logs:
-- Unit celery.service has begun starting up.
Aug 04 13:58:08 posudahome.ru systemd[1]: celery.service: Control process exited, code=exited status
Aug 04 13:58:08 posudahome.ru systemd[1]: Failed to start Celery Service.
-- Subject: Unit celery.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit celery.service has failed.
--
-- The result is failed.


celery.service - Celery Service
   Loaded: loaded (/etc/systemd/system/celery.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2017-08-04 14:28:24 UTC; 1min 7s ago
  Process: 1593 ExecStop=/bin/sh -c ${CELERY_BIN} multi stopwait ${CELERYD_NODES}    --pidfile=${CEL
  Process: 1119 ExecStart=/bin/sh -c ${CELERY_BIN} multi start ${CELERYD_NODES}    -A ${CELERY_APP}
 Main PID: 1591 (code=exited, status=1/FAILURE)
~

These are all the logs that systemd
celery offers me. I didn’t create the logs, because it didn’t start
. The directories seemed to be correctly indicated, but the worker still doesn’t start. I use in conjunction with RabbitMQ.
PS in the shop directory there is a celery.py c app file, which is why I didn’t specify it as "shop.celery: app" (I also tried that)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Dikiy, 2017-08-04
@frilix

As expected, permissions error. My user could not create files

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

And celery cursed because of this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question