Supervisorctl - Refused connection (even after specifying path -c)

2

1

I can't figure out how to run supervisorctl correctly. There is a supervisord running on my Ubuntu 16.04 server.

The supervisord.conf path:

/home/django/Bedueno/supervisord.conf

When I run

supervisorctl 

or

supervisorctl -c /home/django/Bedueno/supervisord.conf

console returns

django@Bedueno-beta-ubuntu-512mb-fra1-01:~$ supervisorctl -c /home/django/Bedueno/supervisord.conf 
http://localhost:9001 refused connection
supervisor> reread
error: <class 'socket.error'>, [Errno 111] Connection refused: file: /usr/lib/python2.7/socket.py line: 575
supervisor>

Tried already with sudo which didn't help.

Do you know where is the problem?

supervisord.conf

[program:daphne]
command=/home/django/Bedueno/beduenovenv/bin/daphne Bedueno.asgi:channel_layer --bind 0.0.0.0 -p 8001 ;
directory=/home/django/Bedueno/ ;
autostart=true ;
autorestart=true ;

[program:daphne_worker]
command=/home/django/Bedueno/beduenovenv/bin/python manage.py runworker ;
directory=/home/django/Bedueno/ ;
autostart=true ;
autorestart=true ;
[supervisord]
[supervisorctl]

EDIT

I realised I have two supervisord.pid and supervisord.log files. Both of them are inside /tmp/ directory and in /home/django/Bedueno/ too. supervisor.sock is only inside /tmp/ directory.

Milano

Posted 2018-02-19T18:19:33.160

Reputation: 235

So the conf points to port 8001 and the connection error is based on port 9001.... seems like an issue to me, right? Be sure you are connecting to the correct port which is listening for the traffic. So --bind 0.0.0.0 -p 8001 in config but error states :9001 refused connection. – Pimp Juice IT – 2018-02-19T20:22:17.587

@PimpJuiceIT 8001 is a port fo daphne asgi. 9001 is supervisors port so it can't be the same in my opinion. – Milano – 2018-02-27T18:19:13.257

Okay, so from a web browser on the machine is applicable, see if you can access http://localhost:8001 and also try http://localhost:9001. See if you can telnet into that port and confirm it's listening and use netstat as well to confirm the expected ports are listening on the server. I'm not an Linux expert yet so I was just pointing out the obvious from what I see in the detail you provided. I would test to confirm that the "expected" port is listening to start with next I suppose. – Pimp Juice IT – 2018-02-27T18:36:50.147

telnet 127.0.0.1 9001 returns this: Trying 127.0.0.1... telnet: Unable to connect to remote host: Connection refused and telnet 127.0.0.1 8001 Trying 127.0.0.1... Connected to 127.0.0.1. – Milano – 2018-02-27T18:42:33.227

Look over netstat -ano and see if you see any processes listening on those ports from the Local Address column from the ** Active Internet connections (servers and established)** section. You should see <IP Address>:<port> in there somewhere so if it's not listening the something is not correct I would think like the server service is not running perhaps. – Pimp Juice IT – 2018-02-27T19:08:01.630

There is nothing with port 9001. Tried also sudo netstat | grep 9001 which returned nothing. – Milano – 2018-02-27T19:16:57.667

Isn't the [supervisorctl] section and perhaps the [supervisord] sections of the supervisord.conf file missing some parameters? Look over those sections per this here: http://supervisord.org/configuration.html and also read over http://supervisord.org/running.html if needed to just to ensure you don't see anything there that looks obvious. I think the configuration parameters are missing and maybe that's why it is not starting. Consider putting the logging level to trace or debug mode per that first link and looking over the logs when you try to start it.

– Pimp Juice IT – 2018-02-27T19:41:04.570

Answers

2

If you're using the http method then be sure to check the following:

  1. Make sure supervisord is running
  2. Have these enabled (uncommented) in supervisord.conf file:
    a)

    [inet_http_server]         
    port=127.0.0.1:9001
    

    b)

    [supervisorctl]
    serverurl=http://127.0.0.1:9001
    

    c)

    [rpcinterface:supervisor]
    supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    

Note: The host and port of the inet server and the one which supervisorctl is trying to connect to should be the same.

Ram Patra

Posted 2018-02-19T18:19:33.160

Reputation: 123