Socket File not created when starting supervisor
Closed this issue · 2 comments
I recently faced an issue where once supervisor is started, the programs defined inside all start working but the socket file that is defined in the [unix_http_server].file
is not created. When inspecting the directory where the socket file needs to be, the file was missing but the socket files for haproxy and nginx that I was testing supervisor with were present.
Edit: Supervisor Version being used is 4.2.1
[unix_http_server]
file = %(ENV_RUN_DIR)s/supervisor.sock
[supervisorctl]
serverurl = unix://%(ENV_RUN_DIR)s/supervisor.sock
root@ubuntu:/app/run# ls -l
total 32
-rw-r--r-- 1 root root 6 Dec 24 16:26 haproxy.pid
srw------- 1 root root 0 Dec 24 16:26 haproxy.sock
srwx------ 1 root root 0 Dec 24 16:26 nginx_supervisor.sock
-rw-r--r-- 1 root root 6 Dec 24 16:26 nginx_supervisord.pid
-rw------- 1 root root 540 Dec 25 11:29 positions.yaml
-rw------- 1 root root 370 Dec 24 16:29 supervisorctl.hist
I ran into a similar issue today,
check the solution proposed by @javabrett
here: #376 (comment)
Adding that to my .conf
resolved the issue for me.
It was so long without responses that I almost forgot about this. Apparently, it was due to an include directive that then overrode the configuration parameters.
File: etc/prod/supervisor.conf
1 │ [unix_http_server]
2 │ file = /var/run/supervisor.sock
3 │
4 │ # [inet_http_server]
5 │ # port = 127.0.0.1:9901
6 │
7 │ [supervisorctl]
8 │ serverurl = unix:///var/run/supervisor.sock
9 │ history_file = /var/run/supervisorctl.hist
10 │
11 │ # required for supervisorctl command
12 │ [rpcinterface:supervisor]
13 │ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
14 │ ##### OTHER CONFIGS ####
15 │ ##### OTHER CONFIGS ####
16 │ ##### OTHER CONFIGS ####
17 │ [include]
18 │ files = /app/etc/nginx_supervisor.conf
File: etc/nginx_supervisor.conf
1 │ [unix_http_server]
2 │ file = /var/run/nginx_supervisor.sock
3 │
4 │ [supervisorctl]
5 │ serverurl = unix:///var/run/nginx_supervisor.sock
6 │ history_file = /var/run/nginx_supervisorctl.hist
7 │
8 │ # required for supervisorctl command
9 │ [rpcinterface:supervisor]
10 │ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
11 │
12 │ [supervisord]
13 │ logfile = /var/log/nginx_supervisord.log
14 │ pidfile = /var/run/nginx_supervisord.pid
15 │ logfile_maxbytes = 5MB
16 │ minfds = 100000
17 │
18 │ [program:nginx]
19 │ autostart = true
20 │ autorestart = true
21 │ priority = 2
22 │ stdout_logfile = /var/log/nginx.out.log
23 │ stderr_logfile = /var/log/nginx.err.log
24 │ command = /bin/sh -c "envsubst < /app/etc/nginx.conf.template > /app/etc/nginx.conf && nginx -c /app/etc/nginx.conf"
This effectively caused the Unix Socket to be overridden and the socket from nginx_supervisor
file being created in place of the prod/supervisor
.
P.S.: The [inet_http_server]
was used to control supervisor when the socket file was not being created as we had expected.