I have some periodic tasks that I run with celery (daemonized by supervisord), but after trying to create a directory in the home dir for the user i setup for the supervisor'd process I got a "permission denied" error. After looking at the os.environ
dict in a running celery task I noticed that the USER
var is set to 'root' and not the user that I set up in my supervisord config for celery.
This is what my /usr/local/etc/supervisord.conf
looks like:
[unix_http_server]
file=/tmp/supervisor.sock
chmod=0777
[supervisord]
logfile=/var/log/supervisord.log
pidfile=/var/run/supervisord.pid
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock
[program:celery]
command=/home/<USER>/.virtualenvs/sync/bin/celeryd --beat --loglevel=INFO
environment=PYTHONPATH=/home/<USER>/apps/sync
directory=/home/<USER>/apps/sync
user=<USER>
numprocs=1
stdout_logfile=/var/log/celeryd.log
stderr_logfile=/var/log/celeryd.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 30
What could be causing this? Any help would be super appreciated!