Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting supervisord as root or not?

Supervisor is running on 3.0:

pip freeze | grep supervisor supervisor==3.0 

When starting supervisord from the command line:

sudo $VIRTENV/supervisord --nodaemon --configuration $PATH_TO_CONFIG/supervisord.conf 

I get this error:

2013-11-11 23:30:50,205 CRIT Supervisor running as root (no user in config file) 

But I can't start supervisord without sudo, it complains:

Error: Cannot open an HTTP server: socket.error reported errno.EACCES (13) 

What is the right way to deal with it?

(I get the same error if starting it as root but setting user = foobar under the [supervisord] section in supervisord.conf)

Update: Here is my supervisord.conf

[unix_http_server] file = /opt/run/supervisord.sock  [inet_http_server] port = 9001 username = foobar password = foobar  [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface  [supervisord] logfile = /opt/logs/supervisord.log loglevel = debug pidfile = /opt/run/supervisord.pid  [supervisorctl]  [program:foo1] user = foobar autostart = True autorestart = True command = foo1 stdout_logfile = /opt/logs/foo1.stdout.log stderr_logfile = /opt/logs/foo1.stderr.log stdout_logfile_maxbytes = 10MB stderr_logfile_maxbytes = 10MB  [program:foo2] user = foobar autostart = true autorestart = true command = foo2 priority = 100 stdout_logfile_backups = 0 stderr_logfile_backups = 0 stdout_logfile_maxbytes = 10MB stderr_logfile_maxbytes = 10MB stdout_logfile = /opt/logs/foo2.stdout.log stderr_logfile = /opt/logs/foo2.stderr.log 
like image 647
kev Avatar asked Nov 11 '13 23:11

kev


People also ask

Does supervisord need to run as root?

Should I run supervisor as root? supervisor is definitely designed to run as root, but there's no real problem in running it as a non-root user. To do so, you have to make sure that the control socket and all of the log files can be created and written to by the executing user.

How do I start a supervisord process?

To start supervisord, run $BINDIR/supervisord. The resulting process will daemonize itself and detach from the terminal. It keeps an operations log at $CWD/supervisor. log by default.

What is the use of supervisord?

Supervisord or Supervisor daemon is an open source process management system. In a nutshell: if a process crashes for any reason, Supervisor restarts it. From the Supervisord website: Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.

How does Supervisorctl work?

Supervisorctl allows a very limited form of access to the machine, essentially allowing users to see process status and control supervisord-controlled subprocesses by emitting “stop”, “start”, and “restart” commands from a simple shell or web UI.


1 Answers

Supervisord switches to UNIX user account before any processing.

You need to specify what kind of user account it should use, run the daemon as root but specify user in the config file

Example:

[program:myprogram] command=gunicorn --worker-class socketio.sgunicorn.GeventSocketIOWorker app.wsgi:application -b 127.0.0.1:8000 directory=/opt/myprogram user=user1 autostart=true autorestart=true redirect_stderr=True 

Visit http://supervisord.org/configuration.html#program-x-section-values for more information

like image 127
Jan Vorcak Avatar answered Oct 04 '22 13:10

Jan Vorcak