0

I've followed the tutorial on how to implement celery on my django production server, using supervisor.

I've done this successfully, however when I try to start supervisor with sudo supervisorctl start app-celery - it returns:

app-celery: ERROR (no such file)

Here is my config in the folder /etc/supervisor/conf.d (app-celery.conf):

[program:app-celery]
command=/home/app/bin/celery worker -A draft1 --loglevel=INFO
directory=/home/app/draft1

numprocs=1
stdout_logfile=/var/log/supervisor/celery.log
stderr_logfile=/var/log/supervisor/celery.log
autostart=true
autorestart=true
startsecs=10

; Need to wait for currently executing tasks to finish at shutdown.
; Increase this if you have very long running tasks.
stopwaitsecs = 600

stopasgroup=true

; Set Celery priority higher than default (999)
; so, if rabbitmq is supervised, it will start first.
priority=1000

Any idea what the problem is?

Zorgan
  • 8,227
  • 23
  • 106
  • 207
  • That's all it returns? It doesn't tell you what file it's trying to open? – Daniel Roseman Apr 23 '18 at 12:10
  • Yes that's correct. I've followed the linked tutorial word for word so not sure why it is not working. – Zorgan Apr 23 '18 at 12:19
  • I have done an entire setup of Celery itself in as in this answer: https://stackoverflow.com/a/49487542/7707749 make sure you connect Celery to the correct paths, else it won't find your file as stated in the error. – King Reload Apr 25 '18 at 08:11
  • I've followed your instructions there minus the redis bit - as I'm using rabbitmq instead - but I'm still getting an error. I've asked a new question here if you'd like to look https://stackoverflow.com/questions/50015628/im-getting-an-error-spawn-error-when-i-try-to-start-my-celery-supervisor-in – Zorgan Apr 25 '18 at 11:22

1 Answers1

0

I had the same issue. Adding the following resolved the issue for me.

environment=DJANGO_SETTINGS_MODULE="my_proj.settings"

I'm not sure why this is necessary. It's not listed in the documentation I've seen, and running the raw command either inside or outside of the virtual environment seems to be fine. Nevertheless, celery now starts and restarts without issue for me.

mechnicov
  • 12,025
  • 4
  • 33
  • 56
pmains
  • 31
  • 4