阅读更多
Supervisor 2019(2)Ubuntu and Multiple Services
Install on ubuntu system
> sudo apt-get install supervisor
Check the version
> supervisord --version
3.3.1
Check the configuration after installation
> sudo vi /etc/supervisor/supervisord.conf
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
[include]
files = /etc/supervisor/conf.d/*.conf
My configuration sub directory is empty though
/etc/supervisor/conf.d
Manage the service
> sudo service supervisor start
> sudo service supervisor status
Set the Web UI
> sudo vi /etc/supervisor/supervisord.conf
[inet_http_server]
port=*:9001
username=sillycat
password=123456
Restart the service
> sudo service supervisor restart
Configure the program - Zeppelin
> cd /etc/supervisor/conf.d/
> sudo vi zeppelin.conf
[program:zeppelin]
user=root
command=/opt/zeppelin/bin/zeppelin.sh
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/zeppelin.out.log
stderr_logfile=/var/log/supervisor/zeppelin.err.log
Configure the program - Nginx
> sudo vi nginx.conf
[program:nginx]
user=root
command=/opt/nginx/sbin/nginx
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/nginx.out.log
stderr_logfile=/var/log/supervisor/nginx.err.log
The program need to be running on the front end.
References:
https://blog.programster.org/install-supervisor
https://www.vultr.com/docs/installing-and-configuring-supervisor-on-ubuntu-16-04
https://windmt.com/2016/02/02/manage-multiple-supervisors/