Supervisor / supervisor

Supervisor process control system for Unix (supervisord)
http://supervisord.org
Other
8.46k stars 1.24k forks source link

Running it on a read-only file system #1585

Closed skhaz closed 1 year ago

skhaz commented 1 year ago

Is it possible to run the supervisor on a read-only filesystem?

Context: I'm using it to run a NodeJS application and Nginx together, and one of the requirements is to run as non-root on a read-only filesystem.

My config

[supervisord]
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0
user=user

[program:nginx]
command=/bin/sh -c "envsubst '\$PORT \$APP_PORT' < /etc/nginx/conf.d/configfile.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
autostart=true
autorestart=true
priority=100
stdout_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_events_enabled=true
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stopsignal=QUIT

However, when I run it, I got the error

PermissionError: [Errno 13] Permission denied: '/var/log/supervisor/supervisord.log'

When I set the log to stdout, I got the error

[PermissionError: [Errno 13] Permission denied: '/var/log/supervisor/migrate-stdout...'

I was reading the documentation and couldn't find any setting that I could use to completely redirect or disable the supervisord logs.

Is it possible?

skhaz commented 1 year ago

The error was my fault; I forgot to redirect the logs to stdout and stderr. By doing this, I could run as non-root on a read-only filesystem.

antfig commented 1 year ago

Hi @skhaz can you explain how you solved the issue in the end? I'm having a similar issue running the read-only filesystems.

skhaz commented 1 year ago

@antfig, I ended up running it inside the container as root, unfortunately. The supervisor tried to write in several places, and I had no time to track which files were.

antfig commented 1 year ago

Thanks for the Reply @skhaz ;)