supervisor 部署问题,单独用 gunicorn 启动是可以正常使用的,加上 supervisor,一跳转就会 500,求帮忙 - V2EX
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
toarya
V2EX    Python

supervisor 部署问题,单独用 gunicorn 启动是可以正常使用的,加上 supervisor,一跳转就会 500,求帮忙

  •  
  •   toarya 2017-06-05 11:11:00 +08:00 4613 次点击
    这是一个创建于 3059 天前的主题,其中的信息可能已经有所发展或是发生改变。
    部署完 gunicorn+ngnix+supervisor 后可以进入 /user/的登录界面,但是输入表单后,点登录跳转,就会直接
    Internal Server Error

    The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

    不用 supervisor,直接在项目目录用 gunicorn 启动就没问题。

    gunicrorn 日志如下,但不知道怎么能看到更详细点的日志...
    127.0.0.1 - - [05/Jun/2017:09:41:36 +0800] "GET / HTTP/1.0" 302 219 "-"
    127.0.0.1 - - [05/Jun/2017:09:41:36 +0800] "GET /user/ HTTP/1.0" 200 3902 "-"
    127.0.0.1 - - [05/Jun/2017:09:41:36 +0800] "GET /static/images/icons.png HTTP/1.0" 404 233 "http://XXX.XX.XXX.238/static/css/login_style.css"
    127.0.0.1 - - [05/Jun/2017:09:41:40 +0800] "POST /user/login HTTP/1.0" 500 291 "http://XXX.XX.XXX.238/user/"


    supervisor 配置如下
    [program:tweet-demo]
    command=/usr/local/bin/gunicorn wsgi --worker-class=gevent --bind 0.0.0.0:8001 --pid /tmp/tweet-demo.pid
    directory=/home/ubuntu/demo/tweet-demo

    求解救...
    第 1 条附言    2017-06-05 11:49:53 +08:00
    还有就是这个项目用了 flask-socketion 实现 websocket 来着,改了一下 supervisor 设置,好像也没效果...

    [inet_http_server] ; inet (TCP) server disabled by default
    port=0.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))
    9 条回复    2017-06-06 04:47:31 +08:00
    konia
        1
    konia  
       2017-06-05 12:24:58 +08:00 via iPhone
    不用 nginx 直接访问 8001,也会这样吗?
    toarya
        2
    toarya  
    OP
       2017-06-05 12:58:33 +08:00
    @konia 是的,奇怪的是注册功能倒是没问题....
    parametrix
        3
    parametrix  
       2017-06-05 13:12:46 +08:00
    楼主确定 gunicorn 是正常运行的么,我印象中旧版本的 supervisor 运行 python 程序有 Bug 来着。
    parametrix
        4
    parametrix  
       2017-06-05 13:19:29 +08:00   1
    你看下是不是这个问题:


    #!/usr/bin/env bash

    cd /var/www/monmar

    export $(cat .env) && exec .venv/bin/gunicorn config.wsgi -c deploy/gunicorn.conf.py


    Please pay attention that we're not calling .venv/bin/gunicorn directly, but wrapping it with exec. If you don't do that, your Gunicorn program won't be supervisored, and you won't be able to stop and restart it properly.


    Ref: https://samoylov.eu/2016/08/31/deploying-django-with-gunicorn-and-supervisor/
    robinlovemaggie
        5
    robinlovemaggie  
       2017-06-05 13:22:26 +08:00
    论日志的重要性
    toarya
        6
    toarya  
    OP
       2017-06-05 14:34:50 +08:00
    @parametrix 谢谢!好像确实是这个问题,之前输出的日志是空的,这样跑了一下终于看到具体的异常了。
    loveminds
        7
    loveminds  
       2017-06-05 15:41:26 +08:00 via Android
    @parametrix 为啥不直接用 systemd 启动
    parametrix
        8
    parametrix  
       2017-06-05 15:45:28 +08:00
    @loveminds 说得好,我一般也是直接用 systemd 的 :)
    loveminds
        9
    loveminds  
       2017-06-06 04:47:31 +08:00
    @parametrix 我是超讨厌超级猥琐这种画蛇添足的东西,在它可以作为正式的 init 之前,多出的层级意味着损失效率和徒增故障点,systemd 的日志已经相当完善了,至于有些人要的 web 控制台,也有相应组件
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     3863 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 35ms UTC 10:24 PVG 18:24 LAX 03:24 JFK 06:24
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86