Problem with permissions when supervisor used in php docker image
0
votes
0
answers
1010
views
I am building my app using official php docker image.
**Case 1:** When I run supervisord with root user and subprocess php-fpm with www-data user. I always get this error log:
FPM initialization failed
failed to open error_log (/proc/self/fd/2): Permission denied (13)
My supervisor config:
[unix_http_server]
file=/run/supervisord.sock ; the path to the socket file
[supervisord]
logfile=/var/log/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; supervisord pidfile; default supervisord.pid
nodaemon=true ; start in foreground if true; default false
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///run/supervisord.sock ; use a unix:// URL for a unix socket
[include]
files = /etc/supervisor.d/*.conf
My subprocess php-fpm config:
[program:php-fpm]
process_name=%(program_name)s
command=php-fpm
user=www-data
autostart=true
autorestart=true
redirect_stderr=false
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
**Note that if I change user of subprocess php-fpm from www-data to root, it worked perfectly**
**Case 2:** When I run supervisord with www-data user (with a little change in config file in order to run it) and subprocess php-fpm also with www-data user, everything works fine.
My supervisor config:
[unix_http_server]
file=/app/supervisord.sock ; the path to the socket file
[supervisord]
logfile=/app/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/app/supervisord.pid ; supervisord pidfile; default supervisord.pid
nodaemon=true ; start in foreground if true; default false
user=www-data ; setuid to this UNIX account at startup; recommended if root
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///run/supervisord.sock ; use a unix:// URL for a unix socket
[include]
files = /etc/supervisor.d/*.conf
My subprocess php-fpm config:
[program:php-fpm]
process_name=%(program_name)s
command=php-fpm
user=www-data
autostart=true
autorestart=true
redirect_stderr=false
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
What is the difference between these 2 cases? Thank you!
Asked by Hải Phạm
(1 rep)
Mar 24, 2024, 05:30 PM
Last activity: Mar 25, 2024, 10:37 AM
Last activity: Mar 25, 2024, 10:37 AM