最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【未解决】如何用supervisor管理多个app和多个配置

Server crifan 2657浏览 0评论

折腾:

【已解决】把项目文件移动位置后重启supervisor

之后,已经修改了,针对于stable和staging的多个配置了:

/Users/crifan/dev/dev_root/daryun/Projects/RunningFast/sourcecode/RunningFast-Server/supervisor_stable.conf

[program:runningfast_stable]
directory=/root/RunningFast/stable
command=/root/Envs/RunningFast/bin/gunicorn -w 4 -b 0.0.0.0:21084 run:app &
startsecs=0
stopwaitsecs=0
autostart=false
autorestart=false
stdout_logfile_maxbytes=1MB
stderr_logfile_maxbytes=1MB
stdout_logfile=/root/RunningFast/stable/logs/gunicorn.log
stderr_logfile=/root/RunningFast/stable/logs/gunicorn.err

/Users/crifan/dev/dev_root/daryun/Projects/RunningFast/sourcecode/RunningFast-Server/supervisor_staging.conf

[program:runningfast_staging]
directory=/root/RunningFast/staging
command=/root/Envs/RunningFast/bin/gunicorn -w 4 -b 0.0.0.0:21085 run:app &
startsecs=0
stopwaitsecs=0
autostart=false
autorestart=false
stdout_logfile_maxbytes=1MB
stderr_logfile_maxbytes=1MB
stdout_logfile=/root/RunningFast/staging/logs/gunicorn.log
stderr_logfile=/root/RunningFast/staging/logs/gunicorn.err

然后希望通过:

supervisord -c supervisor_stable.conf
supervisorctl -c supervisor_stable.conf reload
supervisorctl -c supervisor_stable.conf start runningfast_stable
supervisorctl -c supervisor_stable.conf stop runningfast_stable
supervisorctl -c supervisor_stable.conf restart runningfast_stable

supervisord -c supervisor_staging.conf
supervisorctl -c supervisor_staging.conf reload
supervisorctl -c supervisor_staging.conf start runningfast_staging
supervisorctl -c supervisor_staging.conf stop runningfast_staging
supervisorctl -c supervisor_staging.conf restart runningfast_staging

分别运行这两个不同端口的flask的app

但是结果却:

无法正常运行:

运行stable时OK

再去运行staging时,就出错了:

(RunningFast) ➜  staging supervisord -c supervisor_staging.conf
Error: Another program is already listening on a port that one of our HTTP servers is configured to use.  Shut this program down first before starting supervisord.
For help, use /root/Envs/RunningFast/bin/supervisord -h
(RunningFast) ➜  staging supervisorctl -c supervisor_staging.conf reload
supervisorctl -c supervisor_staging.conf start runRestarted supervisord
(RunningFast) ➜  staging supervisorctl -c supervisor_staging.conf start run
run: ERROR (no such process)
(RunningFast) ➜  staging supervisorctl -c supervisor_staging.conf reload
Restarted supervisord
(RunningFast) ➜  staging supervisord -c supervisor_staging.conf
Error: Another program is already listening on a port that one of our HTTP servers is configured to use.  Shut this program down first before starting supervisord.
For help, use /root/Envs/RunningFast/bin/supervisord -h
(RunningFast) ➜  staging supervisorctl -c supervisor_staging.conf reload
Restarted supervisord
(RunningFast) ➜  staging supervisorctl -c supervisor_staging.conf start runningfast_staging
runningfast_staging: ERROR (no such process)
(RunningFast) ➜  staging supervisord -c supervisor_staging.conf
Error: Another program is already listening on a port that one of our HTTP servers is configured to use.  Shut this program down first before starting supervisord.
For help, use /root/Envs/RunningFast/bin/supervisord -h
(RunningFast) ➜  staging supervisorctl -c supervisor_staging.conf reload
Restarted supervisord
(RunningFast) ➜  staging supervisorctl -c supervisor_staging.conf start runningfast_staging
runningfast_staging: ERROR (no such process)

flask supervisor multile app

flask supervisord multiple app

supervisord – Using supervisor to run a flask app – Stack Overflow

Kickstarting Flask on Ubuntu – setup and deployment – Real Python

Configuration File — Supervisor 3.3.1 documentation

想起来了:

好像只需要一个supervisord的配置,然后里面弄上两个program,即flask的app,即可。

Serving multiple Django applications with Nginx and Gunicorn – Michał Karzyński

转载请注明:在路上 » 【未解决】如何用supervisor管理多个app和多个配置

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
81 queries in 0.189 seconds, using 22.21MB memory