My celerybeat.conf
[program:celerybeat]
command=/path/app/env/bin/celery beat -A project.tasks --loglevel=INFO
environment=PYTHONPATH=/path/app/env/bin
user=nobody
numprocs=1
stdout_logfile=/var/log/celeryd.log
stderr_logfile=/var/log/celeryd.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 600
killasgroup=true
priority=998
When I starting supervisor I receive an error:
pidfile_fd = os.open(self.path, PIDFILE_FLAGS, PIDFILE_MODE)
celery.platforms.LockFailed: [Errno 13] Permission denied: '/celerybeat.pid'
Any idea how to solve this?
The problem is that you have not specified any directory in the config file and the default directory then is '/' (root) which your user does not have permissions to write.
Setting the user as root solved your problem because now you had permission to write to '/' however it might not be the best solution. There are multiple ways you can solve this by including:
Add a directory variable in the config and provide a path that your user has permissions to write to.
directory=<path>
Provide a pidfile argument to the celery command that you are using to start celery. Make sure you have write permissions to the path you specify for the pidfile.
command=/path/app/env/bin/celery beat -A project.tasks --loglevel=INFO --pidfile=/tmp/celerybeat-myapp.pid