Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在 Heroku 上部署后 APP 运行即崩溃 #7

Closed
ARwMq9b6 opened this issue Jul 22, 2015 · 4 comments
Closed

在 Heroku 上部署后 APP 运行即崩溃 #7

ARwMq9b6 opened this issue Jul 22, 2015 · 4 comments

Comments

@ARwMq9b6
Copy link

发现 Heroku 支持 WebSockets, 就在 Heroku 上部署了一个,可是 gost -ws 运行不起来, $ heroku logs 查看日志发现 gost 运行后崩溃,G 大是否有时间研究一下怎么在 Heroku 上运行 gost 呢?

Godeps.json 和 Procfile 都没问题,部署后 gost 一直尝试运行,但最终崩溃:

"/gost/Godeps/Godeps.json"

{
    "ImportPath": "github.com/ginuerzh/gost",
    "GoVersion": "go1.4.2",
    "Deps": [
        {
            "ImportPath": "code.google.com/p/go-uuid/uuid",
            "Comment": "null-15",
            "Rev": "35bc42037350f0078e3c974c6ea690f1926603ab"
        },
        {
            "ImportPath": "github.com/codahale/chacha20",
            "Rev": "7be6a955b0468becb6aaa609b484b52fbf355b76"
        },
        {
            "ImportPath": "github.com/ginuerzh/gosocks5",
            "Rev": "1c68fa0909fe9805bfa671af322b9ec59fe6acda"
        },
        {
            "ImportPath": "github.com/gorilla/websocket",
            "Rev": "6eb6ad425a89d9da7a5549bc6da8f79ba5c17844"
        },
        {
            "ImportPath": "github.com/shadowsocks/shadowsocks-go/shadowsocks",
            "Comment": "1.1.4",
            "Rev": "4a4293907b1641ac4b00ca70cae0d2a88611ecd9"
        },
        {
            "ImportPath": "golang.org/x/crypto/blowfish",
            "Rev": "7d5b0be716b9d6d4269afdaae10032bb296d3cdf"
        },
        {
            "ImportPath": "golang.org/x/crypto/cast5",
            "Rev": "7d5b0be716b9d6d4269afdaae10032bb296d3cdf"
        },
        {
            "ImportPath": "golang.org/x/crypto/salsa20/salsa",
            "Rev": "7d5b0be716b9d6d4269afdaae10032bb296d3cdf"
        }
    ]
}

"/gost/Procfile"

web: gost -ws

相关链接: https://devcenter.heroku.com/articles/go-websockets

@ginuerzh
Copy link
Owner

服务器端gost版本是多少,
崩溃后的日志信息可否发上来

@ARwMq9b6
Copy link
Author

@ginuerzh 多谢 G 大的回复,服务端版本 1.7, 这是我 git push heroku master 部署时用的文件:https://copy.com/ZMjYfwGWiYyIAOEN/gost_heroku.7z

查看日志如下:

2015-07-27T00:31:22.562133+00:00 heroku[web.1]: State changed from crashed to starting
2015-07-27T00:31:24.952408+00:00 heroku[web.1]: Starting process with command `gost -ws`
2015-07-27T00:32:25.513283+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2015-07-27T00:32:25.513283+00:00 heroku[web.1]: Stopping process with SIGKILL
2015-07-27T00:32:26.564816+00:00 heroku[web.1]: Process exited with status 137
2015-07-27T00:32:26.579611+00:00 heroku[web.1]: State changed from starting to crashed
2015-07-27T06:15:48.920298+00:00 heroku[web.1]: State changed from crashed to starting
2015-07-27T06:15:50.667713+00:00 heroku[web.1]: Starting process with command `gost -ws`
2015-07-27T06:16:50.726775+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2015-07-27T06:16:50.726775+00:00 heroku[web.1]: Stopping process with SIGKILL
2015-07-27T06:16:51.682204+00:00 heroku[web.1]: State changed from starting to crashed
2015-07-27T06:16:51.666225+00:00 heroku[web.1]: Process exited with status 137
2015-07-27T06:43:41.973099+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sleepy-basin-3008.herokuapp.com request_id=d7e167bd-8ca3-4b12-9943-f079001ed1c4 fwd="107.178.194.104" dyno= connect= service= status=503 bytes=
2015-07-27T06:43:44.486078+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sleepy-basin-3008.herokuapp.com request_id=6f2f52a8-e903-4bb6-a5ec-ac2cd032cceb fwd="107.178.194.88" dyno= connect= service= status=503 bytes=

发现出错在 Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch ,好像说的是 gost -ws 后建立监听端口时发生错误。

搜到这篇文章 http://jamesmcfadden.co.uk/heroku-web-process-failed-to-bind-to-port-within-60-seconds-of-launch/ ,上面说 Heroku 每次开机都是随机端口, gost -L=":port" 这个端口必须是 Heroku 的环境变量中的 $PORT 值才行。

G 大可否帮助试验下 gost -L=":$PORT" -ws 是否可行。

@ginuerzh
Copy link
Owner

从日志及你所描述的情况来看,应该是端口限制导致的,
gost的默认监听端口是8080,你可以查看或设置一下$PORT变量,再通过-L参数设置此端口试试。

@ARwMq9b6
Copy link
Author

多谢 G 大,直接使用 $PORT:

$ gost -L=":$PORT" -ws

成功了……

2015-07-27T07:52:13.532020+00:00 heroku[web.1]: Starting process with command `gost -L=":35772" -ws`
2015-07-27T07:52:17.423223+00:00 heroku[web.1]: State changed from starting to up

写了个简要的步骤: https://code.google.com/p/goagent/issues/detail?id=22121

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants