Dokku + tornado app = 502 Bad Gateway

时间:2014-03-24 09:04:42

标签: python python-3.x tornado dokku

我试图与dokku交朋友。 我在DigitalOcean Droplet上运行dokku。

user@mypc:~$ cat Procfile 
web: python3 main.py

user@mypc:~$ git push dokku master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 295 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
-----> Building app ...
-----> Installing ENV in build environment ...
   Python app detected
-----> Preparing Python runtime (python-3.4.0)
-----> Installing Setuptools (2.1)
-----> Installing Pip (1.5.4)
-----> Installing dependencies using Pip (1.5.4)
    < LONG INSTALL REQS LOG >
   Cleaning up...
-----> Discovering process types
   Procfile declares types -> web
-----> Releasing app ...
-----> Deploying app ...
-----> Cleaning up ...
=====> Application deployed:
   http://app.myapp.ru

To dokku@myapp.ru:app
   d2cd6b3..7733adf  master -> master

尽管下载成功,但我仍然收到502错误

root@myserver:~# dokku run app ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.2  17888  1496 ?        Ss+  08:41   0:00 /bin/bash /exec ps aux
root        13  0.0  0.2  15536  1128 ?        R+   08:41   0:00 ps aux

root@myserver:~# dokku logs app
[I 140324 08:41:37 main:75] Starting http server on localhost:5000

如果直接运行应用程序,它会成功启动,但我仍会收到502错误。

root@myserver:~# dokku run app python3 main.py
[I 140324 08:59:19 main:75] Starting http server on localhost:5000

所有环境变量拼写正确,等等,因为应用程序正在运行。 有什么想法吗?

2 个答案:

答案 0 :(得分:2)

比我想象的容易得多。我绑定了0.0.0.0

抱歉愚蠢的问题。

答案 1 :(得分:2)

我遇到了同样的问题。绑定到0.0.0.0是问题的一部分。 Dokku也期待Tornado在5000端口上运行。所以,修复程序正在改变服务器监听呼叫:http_server.listen(5000,address =&#39; 0.0.0.0&#39;)