tiagocoutinho / multivisor

Centralized supervisor WebUI and CLI
GNU General Public License v3.0
184 stars 37 forks source link

Add remote host to multivisor web server #85

Open pilchita opened 2 years ago

pilchita commented 2 years ago

Hi, My question is about basic configuration. I will use one instance as a central server to manage all the processes I have up in other instances.

In multivisor web server i add this [sql0] url=10.54.130.5:9001

[sql1] url=10.54.130.4:9001

In the remote instances I have added this configuration to the supervisor.

[rpcinterface:multivisor] supervisor.rpcinterface_factory = multivisor.rpc:make_rpc_interface bind=*:9001

From the web interface I am not being able to see the other supervisor, what am I doing wrong?

REgards,

tiagocoutinho commented 2 years ago

Can you paste the full supervisor configurations, please?

If you have inet_http_server and rpcinterface:multivisor sections make sure port in inet_http_server and bind in rpcinterface:multivisor are different. Example

[inet_http_server]
port=:9001

[rpcinterface:multivisor]
supervisor.rpcinterface_factory = multivisor.rpc:make_rpc_interface
bind=*:9002
pilchita commented 2 years ago

Hi, thanks for the reply. Here my supervisor configuration:

[unix_http_server]
file=/var/run/supervisor.sock   
chmod=0700                       

[supervisord]
logfile=/var/log/supervisor/supervisord.log 
pidfile=/var/run/supervisord.pid 
childlogdir=/var/log/supervisor           

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock

[include]
files = /etc/supervisor/conf.d/*.conf

/etc/supervisor/conf.d
sqlp01.conf
[program:sql01]
directory=/opt/sql01
command=python -u sql_service.py 
autostart=true
stdout_logfile=/var/log/sql01.log
stderr_logfile=/var/log/sql01log
stdout_logfile_maxbytes=0

From the firewall of the instance where the web server is installed I have all the traffic allowed incoming from the instance where I installed the multivisor RPC service.

My Python application is running on port 9001, should I bind to port 9002 in order to manage it from the web interface?

Maybe it’s a configuration error of mine for misinterpreting English, I’m not an advanced user in English language.

Regards,

tiagocoutinho commented 2 years ago

To avoid port conflicts please configure it like this:

In each supervisor config file put

[rpcinterface:multivisor]
supervisor.rpcinterface_factory = multivisor.rpc:make_rpc_interface
bind=*:9002

Also make sure that multivisor is installed and accessible to supervisor on each supervisor machine. You can find out if you start supervisor in foreground (with -n command line option). If there are error messages concerning multivisor it means it is not well installed.

In your multivisor configuration file, for each supervisor:

[<supervisor name>]
url=<host or IP>:9002

Restart all supervisors and multivisor

pilchita commented 2 years ago

@tiagocoutinho thanks for the reply.

From the instance where I installed the web servers I still do not see the supervisor of the client instances.

[unix_http_server]
file=/var/run/supervisor.sock  
chmod=0700                       

[supervisord]
logfile=/var/log/supervisor/supervisord.log 
pidfile=/var/run/supervisord.pid ; 
childlogdir=/var/log/supervisor           

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

[rpcinterface:multivisor]
supervisor.rpcinterface_factory = multivisor.rpc:make_rpc_interface
bind=*:9002

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket

[include]
files = /etc/supervisor/conf.d/*.conf

I don’t see any erros in the supervisor’s logs:

2022-01-18 17:55:36,853 INFO RPC interface 'multivisor' initialized

I try with eventlistener but not see process in the web server.

supervisorctl status
data-service                     RUNNING   pid 17655, uptime 0:06:38
multivisor-rpc                   RUNNING   pid 17654, uptime 0:06:38

Which ports should I open on the server and on the client?

Regards,

pilchita commented 2 years ago

The connection to port 9002 of the instance where the rpc interface is installed from the webserver can be done correctly nc -v 10.54.130.34 9002 Connection to 10.54.130.34 9002 port [tcp/*] succeeded!

pilchita commented 2 years ago

Hello, any helps?