Score:0

Supervisord ignores user setting

kn flag

I want to use supervisord to make maintenance for Laravel application which used nginx run by www-data:www-data user:group. Both Laravel app and supervisord task need to share one log file. Sometimes app writes something to log, in other cases - supervisor daemon does the same.

Add user to supervisord.conf:

[supervisord]
user=www-data
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)

Then add user to supervisor task:

[program:neuroprofile-queue]
command=php artisan queue:work
directory=/home/vbulash/nginx.html/neuroprofile
user=www-data
autostart=true
autorestart=true
stderr_logfile=/home/vbulash/nginx.html/neuroprofile/storage/logs/queue.error.log
stdout_logfile=/home/vbulash/nginx.html/neuroprofile/storage/logs/queue.output.log

Then stop, start, reread and update supervisorctl.

Finally in /home/vbulash/nginx.html/neuroprofile/storage/logs/ :

  • Newly created log file (output of supervisor command) has rights root:root. Laravel app can't write to this log because of limited permissions.
  • queue.error.log has rights root:root
  • queue.output.log has rights root:root

So, user setting in supervisor completely ignored.

How to force supervisor run as www-data:www-data ?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.