I am trying to daemonize celery on Linux. And after ironing out a lot of errors and reading through tons of configuration. I am unable to run Celery. I am running Ubuntu 20.04 and Celery 5.2+. Following is the error I get:
â celery.service - Celery Service
Loaded: loaded (/etc/systemd/system/celery.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2022-01-01 22:16:17 UTC; 22s ago
Process: 15402 ExecStart=/usr/local/bin/pipenv run celery multi start ${CELERYD_NODES} -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD>
Process: 15409 ExecStop=/usr/local/bin/pipenv run celery ${CELERY_BIN} multi stopwait ${CELERYD_NODES} --pidfile=${CELERYD_PID_FILE} (code=exited, status=2)
Jan 01 22:16:16 ip-172-31-37-240 pipenv[15409]: warnings.warn(
Jan 01 22:16:16 ip-172-31-37-240 pipenv[15409]: /usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.23ubuntu1 is an invalid version and will not be supported>
Jan 01 22:16:16 ip-172-31-37-240 pipenv[15409]: warnings.warn(
Jan 01 22:16:16 ip-172-31-37-240 pipenv[15409]: Loading .env environment variables...
Jan 01 22:16:17 ip-172-31-37-240 pipenv[15409]: Usage: celery [OPTIONS] COMMAND [ARGS]...
Jan 01 22:16:17 ip-172-31-37-240 pipenv[15409]: Try 'celery --help' for help.
Jan 01 22:16:17 ip-172-31-37-240 pipenv[15409]: Error: No such command '/usr/local/bin/celery'.
Jan 01 22:16:17 ip-172-31-37-240 systemd[1]: celery.service: Control process exited, code=exited, status=2/INVALIDARGUMENT
Jan 01 22:16:17 ip-172-31-37-240 systemd[1]: celery.service: Failed with result 'exit-code'.
Jan 01 22:16:17 ip-172-31-37-240 systemd[1]: Failed to start Celery Service.
I am a terminal noob but to my understanding when I cd /usr/local/bin/
and then ls -a
. I get the following file structure.
. .. autopep8 celery django-admin gunicorn markdown_py pipenv pipenv-resolver pycodestyle sqlformat virtualenv virtualenv-clone
[Unit]
Description=Celery Service
After=network.target
[Service]
Type=forking
User=celery
Group=celery
EnvironmentFile=/etc/default/celeryd
WorkingDirectory=/home/ubuntu/project/Instagram-Clone-Backend
ExecStart=/usr/local/bin/pipenv run celery multi start ${CELERYD_NODES} \
-A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \
--logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}
ExecStop=/usr/local/bin/pipenv run celery ${CELERY_BIN} multi stopwait ${CELERYD_NODES} \
--pidfile=${CELERYD_PID_FILE}
ExecReload=/usr/local/bin/pipenv run celery ${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
CELERYD_NODES="worker1"
CELERY_BIN="/usr/local/bin/celery"
CELERY_APP="instagram.celery"
CELERYD_CHDIR="/home/ubuntu/project/Instagram-Clone-Backend"
CELERYD_OPTS="--time-limit=300 --concurrency=8"
CELERYD_LOG_FILE="/var/log/celery/%n%I.log"
CELERYD_PID_FILE="/var/run/celery/%n.pid"
CELERYD_USER="celery"
CELERYD_GROUP="celery"
CELERY_CREATE_DIRS=1