天天看點

Supervisor 安裝&配置&管理&添加應用Supervisor

Supervisor

######################

Supervisor Python下的程序管理工具

@Supervisor 官網文檔

@各種平台開機啟動腳本

##########################

Supervisor庫從2019-04-05開始正式從Python2 遷移到python3啦!

安裝配置過程基本沒變,是以遷移到supervisor4版本隻需簡單地:

pip2.7 uninstall supervisor
pip3.6 install supervisor
supervisord -v
4.0.4
           

###################

安裝&配置

##################

pip3 install supervisor
supervisord -v

mkdir /etc/supervisor
echo_supervisord_conf > /etc/supervisor/supervisord.conf
vim /etc/supervisor/supervisord.conf
##############################################
file=/var/run/supervisord.sock 
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid

serverurl=unix:///var/run/supervisord.sock	

[include]
files = /etc/supervisor/*.ini
##############################################
           
vim /etc/supervisor/GotIT.ini

#########################################
[group:GotIT]
programs=uWSGI,daphne,celery
priority=1

[program:uWSGI]
command=uwsgi --ini uwsgi.ini
numprocs=1
directory=/home/taylorgogo/GotIT/
autostart=true
autorestart=true
startretries=3
stopsignal=QUIT
stopwaitsecs=10
user=root
redirect_stderr=true
stdout_logfile=/var/log/supervisor/uwsgi.log


[program:daphne]
directory=/home/taylorgogo/GotIT/
command=daphne -b 127.0.0.1 -p 1013 GotIT.asgi:application
numprocs=1
autostart=true
autorestart=true
startretries=3
stopsignal=QUIT
stopwaitsecs=10
user=root
redirect_stderr=true
stdout_logfile=/var/log/supervisor/daphne.log

[program:celery]
numprocs=1
directory=/home/taylorgogo/GotIT/
command=celery -A GotIT worker -l info
stdout_logfile=/var/log/celery/worker.log
stderr_logfile=/var/log/celery/worker.log
autostart=true
autorestart=true
startretries=3
stopwaitsecs = 10
stopasgroup=true
user=root
######################################################
           

繼續閱讀