【问题标题】:Heroku code=H10 status=503Heroku 代码=H10 状态=503
【发布时间】:2017-02-11 02:15:59
【问题描述】:

我正在关注 WebSockets Spark 教程 (https://sparktutorials.github.io/2015/11/08/spark-websocket-chat),并通过本教程 (https://sparktutorials.github.io/2015/08/24/spark-heroku) 使用免费帐户 (免费 dyno) 在 heroku 中成功构建和部署它。

它在 localhost 中运行良好,但在 heroku 中我得到这个 Application Error 或 Code=H10。

这些是日志。

2016-10-03T01:56:27.735673+00:00 app[web.1]: [Thread-0] INFO >spark.embeddedserver.jetty.EmbeddedJettyServer - >> Listening on 0.0.0.0:4567 2016-10-03T01:56:27.737870+00:00 app[web.1]: [Thread-0] INFO org.eclipse.jetty.server.Server - jetty-9.3.z-SNAPSHOT 2016-10-03T01:56:27.787960+00:00 app[web.1]: [Thread-0] INFO org.eclipse.jetty.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@39939950{/,null,AVAILABLE} 2016-10-03T01:56:27.804573+00:00 app[web.1]: [Thread-0] INFO org.eclipse.jetty.server.ServerConnector - Started ServerConnector@3d87d5f9{HTTP/1.1,[http/1.1]}{0.0.0.0:4567} 2016-10-03T01:56:27.804799+00:00 app[web.1]: [Thread-0] INFO org.eclipse.jetty.server.Server - Started @441ms 2016-10-03T01:57:55.846764+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch 2016-10-03T01:57:55.846764+00:00 heroku[web.1]: Stopping process with SIGKILL 2016-10-03T01:57:55.955110+00:00 heroku[web.1]: Process exited with status 137 2016-10-03T01:57:55.964711+00:00 heroku[web.1]: State changed from starting to crashed 2016-10-03T06:29:08.525497+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=chatroom-herroku-example.herokuapp.com request_id=d5c85d5e-8e8e-4f14-b2b1-f4522ac671dc fwd="125.60.156.205" dyno= connect= service= status=503 bytes= 2016-10-03T06:29:11.463550+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=chatroom-herroku-example.herokuapp.com request_id=b697c22b-1b0c-47cb-9b08-d809b7627802 fwd="125.60.156.205" dyno= connect= service= status=503 bytes= 2016-10-03T07:03:55.810509+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=chatroom-herroku-example.herokuapp.com request_id=e2bcd981-974d-442a-949f-a4d97d7c60c3 fwd="125.60.156.205" dyno= connect= service= status=503 bytes= 2016-10-03T07:03:57.067606+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=chatroom-herroku-example.herokuapp.com request_id=a9ff3396-225e-4901-a1ae-cf6357c2f89a fwd="125.60.156.205" dyno= connect= service= status=503 bytes=

【问题讨论】:

  • 你配置好你的数据库了吗?你有硬编码你的端口吗?如果是这样,它应该是process.env.PORT。尝试从可能详细说明失败原因的控制台运行应用程序。

标签: java eclipse heroku


【解决方案1】:

它看起来像R10 Error Boot Timeout。由于应用程序无法访问外部资源(如数据库)而发生错误。

我会仔细检查您的数据库连接,因为此错误可能是由于数据库连接配置不正确造成的。

您是否使用 Heroku 的插件配置了数据库连接?如果没有,您将不得不提供一个数据库来修复错误。 mLab 是一个免费选项,但还有许多其他选项。我将尝试向您介绍如何执行此操作的示例。

导航到您的 Heroku 应用的仪表板。单击资源。在附加搜索框中,输入您要配置的数据库服务。如果您选择 mLab,它将带您进入 mLab GUI。您的 URI 连接字符串位于屏幕顶部。 (您要选择标有“驱动程序”的选项。)单击屏幕中心底部的“添加用户”选项卡。添加用户名和密码。保存。之后,复制上面的 URI 连接字符串,然后导航回您的仪表板。点击设置,显示config vars。现在将 URI 连接字符串粘贴到文本框中,然后添加新创建的用户凭据以替换 <username> and <password> 字段。复制配置变量MONGODB_URI。接下来,在您的命令行中,setexport MONGODB_URI 环境变量。最后,在您的应用程序中,导航到您启动服务器的位置,然后将与本地主机数据库的连接替换为 MONGODB_URI,例如process.env.MONGODB_URI。接下来,Add, commit, push to master then to HerokuR10 error 应该消失了。如果不是,请参阅下面的链接。

尝试添加此Heroku Forward

您的 procfile 中有什么? 在此处输入:web: bundle exec thin start -p $PORT

另外,请参阅THIS 关于 R10 错误解决方案的堆栈溢出答案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-08
    • 2013-12-06
    相关资源
    最近更新 更多