V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
hansonhex
V2EX  ›  Python

部署程序,就差最后一步 supervisor 出现问题

  •  
  •   hansonhex · 2018-06-07 17:10:13 +08:00 · 8351 次点击
    这是一个创建于 2352 天前的主题,其中的信息可能已经有所发展或是发生改变。
    忙活了半天, 就到最后部署了, 结果卡了, 大家帮忙看看, 谢谢了:
    配置文件
    [unix_http_server]
    file=/var/run/supervisor.sock ; (the path to the socket file)
    ;chmod=0700 ; socket file mode (default 0700)
    ;chown=nobody:nogroup ; socket file uid:gid owner
    ;username=user ; (default is no username (open server))
    ;password=123 ; (default is no password (open server))

    ;[inet_http_server] ; inet (TCP) server disabled by default
    ;port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface)
    ;username=user ; (default is no username (open server))
    ;password=123 ; (default is no password (open server))

    [supervisord]
    logfile=/var/run/supervisord.log ; (main log file;default $CWD/supervisord.log)
    logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
    logfile_backups=10 ; (num of main logfile rotation backups;default 10)
    loglevel=info ; (log level;default info; others: debug,warn,trace)
    pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
    nodaemon=false ; (start in foreground if true;default false)
    minfds=1024 ; (min. avail startup file descriptors;default 1024)
    minprocs=200 ; (min. avail process descriptors;default 200)
    ;umask=022 ; (process file creation umask;default 022)
    ;user=chrism ; (default is current user, required if root)
    ;identifier=supervisor ; (supervisord identifier, default is 'supervisor')
    ;directory=/tmp ; (default is not to cd during start)
    ;nocleanup=true ; (don't clean up tempfiles at start;default false)
    ;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP)
    ;environment=KEY="value" ; (key value pairs to add to environment)
    ;strip_ansi=false ; (strip ansi escape codes in logs; def. false)
    [supervisorctl]
    serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
    ;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
    ;username=chris ; should be same as http_username if set
    ;password=123 ; should be same as http_password if set
    ;prompt=mysupervisor ; cmd line prompt (default "supervisor"
    ;history_file=~/.sc_history ; use readline history if available

    ; The below sample program section shows all possible program subsection values,
    ; create one or more 'real' program: sections to be able to control them under
    ; supervisor.

    ;[include]
    files = /etc/supervisor/conf.d/*.conf

    应用的配置文件
    [root@iz8vb6wnpf70v6mckovd7tz etc]# cat supervisor/conf.d/game.conf
    [program:game]
    command=/usr/local/bin/gunicorn wsgi -c gunicorn.config.py
    directory=/var/www/game
    autostart=true


    再执行
    supervisord -c /etc/supervisord.conf
    supervisorctl -c /etc/supervisord.conf


    重启 supervisor 报错
    [root@iz8vb6wnpf70v6mckovd7tz etc]# service supervisor restart
    Redirecting to /bin/systemctl restart supervisor.service
    Failed to restart supervisor.service: Unit not found.

    没有这个进程
    supervisorctl restart game
    game: ERROR (no such process)

    大家看一下应该怎么办呢
    11 条回复    2018-06-08 10:29:09 +08:00
    zuston
        1
    zuston  
       2018-06-07 17:18:29 +08:00 via iPhone
    查看一下 game 的运行输出日志啊
    FiveDDD
        2
    FiveDDD  
       2018-06-07 17:21:35 +08:00
    supervisorctl -c /etc/supervisord.conf restart game 试一试
    zdt3476
        3
    zdt3476  
       2018-06-07 20:53:46 +08:00
    supervisorctl update
    bin456789
        4
    bin456789  
       2018-06-07 20:57:41 +08:00
    supervisorctl reread
    MartinWu
        5
    MartinWu  
       2018-06-07 21:00:03 +08:00
    重启 supervisor 报错
    [root@iz8vb6wnpf70v6mckovd7tz etc]# service supervisor restart
    Redirecting to /bin/systemctl restart supervisor.service
    Failed to restart supervisor.service: Unit not found.

    你这里就有问题了。你要是用 supervisord -c /etc/supervisord.conf 来启动进程,就不要用 services 来重启。 建议你 kill 掉 supervisord,再直接用 services 来启动 supervisord。
    mcfog
        6
    mcfog  
       2018-06-07 21:05:13 +08:00 via Android
    syatemctl 是 systemd 的控制命令,去找 systemd 的手册看看吧,简单说就是要写个 aupervusor 的描述文件扔 /etc
    当然你也可以选择野路子手动开进程然后祈祷不需要重启 servers/不 crash
    defunct9
        7
    defunct9  
       2018-06-07 21:22:42 +08:00 via iPhone
    开 ssh,让我上去试试
    zjp
        8
    zjp  
       2018-06-07 21:47:43 +08:00 via Android
    歪个楼 为什么 python 程序喜欢用 supervisor,除了它本身就是 python 写的原因

    正题 似乎楼主没有配置 systemd 去管理 supervisor,先查看下进程先
    lzxin1
        9
    lzxin1  
       2018-06-08 00:50:13 +08:00 via iPhone
    服务名是 supervisird 而不是 supervisor, 少了个 d

    service supervisord restart 试一下
    wenzhoou
        10
    wenzhoou  
       2018-06-08 07:46:55 +08:00 via Android
    不是说二本青年都用 tmux 干这事嘛
    hello8080
        11
    hello8080  
       2018-06-08 10:29:09 +08:00
    ;[include]
    你这里都注释了,还怎么加载。当然找不到了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2446 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 16:11 · PVG 00:11 · LAX 08:11 · JFK 11:11
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.