Tuesday, November 19, 2013

Supervisord - Using the built-in web interface to monitor processes

Supervisord, a process control system, has a simple built-in web interface to help you manage processes. It is just so great!!!

To enable it:

1. Add these line to /etc/supervisor/supervisord.conf to enable supervisord web interface in port 9001 (localhost, domain: my.domain.com):

...
[inet_http_server]
port=127.0.0.1:9001
username=guest
password=mysecret
...


+Restart supervisord:

$ sudo supervisorctl reload



2. Pass requests of my.domain.com to 127.0.0.1:9001:

+ Create a nginx configuration file for supervisord /etc/nginx/sites-available/supervisord:

upstream supervisord {
server localhost:9001 fail_timeout=0;
}


server {
        listen 80;
        server_name my.domain.com;
        access_log /var/log/access_supervisor.log;
        error_log /var/log/error_supervisor.log;

        location / {

                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_redirect off;

                proxy_pass http://supervisord;
        }

}


+ Create a symlink to that file in /etc/nginx/sites-enable/:

$ sudo ln -s /etc/nginx/sites-available/supervisord /etc/nginx/sites-enable/supervisord

+ Reload nginx's configurations:

$ sudo nginx -s reload


3. Access the web interface of Supervisord to manage processes at http://my.domain.com:






 Awesome!!!