SimpleDao
supervisor配置
2019-05-06, 访问数: 1006

安装

  1. pip install supervisor

生成配置文件

  1. echo_supervisord_conf > /home/stat/venv/web/etc/supervisord.conf

配置gunicorn的运行程序

  1. [program:myapp]
  2. command=/home/stat/venv/web/bin/gunicorn -w4 -b0.0.0.0:2170 myapp:app
  3. directory=/path/myproject
  4. autorestart=true

常用命令

指定配置文件则加上 -c supervisord.conf

  1. # 通过配置文件启动supervisor
  2. supervisord
  3. # 察看supervisor的状态
  4. supervisorctl status
  5. # 重新载入配置文件
  6. supervisorctl reload
  7. # 启动指定/所有supervisor管理的程序进程
  8. supervisorctl start [all]|[appname]
  9. # 关闭指定/所有 supervisor管理的程序进程
  10. supervisorctl stop [all]|[appname]

web管理界面(需要激活)

  1. [inet_http_server] ; inet (TCP) server disabled by default
  2. port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface)
  3. username=user ; (default is no username (open server))
  4. password=123 ; (default is no password (open server))
  5. [supervisorctl]
  6. serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
  7. serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
  8. username=user ; should be same as http_username if set
  9. password=123 ; should be same as http_password if set
  10. ;prompt=mysupervisor ; cmd line prompt (default "supervisor")
  11. ;history_file=~/.sc_history ; use readline history if available