2016-10-03 108 views
1

我正在關注WebSocket Spark教程(https://sparktutorials.github.io/2015/11/08/spark-websocket-chat),並且我設法成功構建了&,在本教程(https://sparktutorials.github.io/2015/08/24/spark-heroku)中使用免費帳戶(免費dyno)在heroku中進行部署。Heroku code = H10 status = 503

它在localhost中正常工作,但在heroku中我得到這個應用程序錯誤或代碼= 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 [email protected]{/,null,AVAILABLE} 2016-10-03T01:56:27.804573+00:00 app[web.1]: [Thread-0] INFO org.eclipse.jetty.server.ServerConnector - Started [email protected]{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=

+0

你配置了你的數據庫嗎?你有硬編碼你的端口?如果是這樣,它應該是'process.env.PORT'。嘗試從控制檯運行可能詳細說明故障原因的應用程序。 – Thamilan

回答

3

它看起來像一個R10 Error Boot Timeout。由於應用程序無法訪問外部資源(如數據庫),因此發生此錯誤。

我會仔細檢查您的數據庫連接,因爲此錯誤可能是由於配置不正確的數據庫連接。

您是否使用Heroku的附加組件提供數據庫連接?如果沒有,你將不得不提供一個數據庫來修復錯誤。 mLab是一個免費的選項,但還有很多其他的選項。我會盡力引導你通過一個如何做到這一點的例子。

導航到您的Heroku應用程序的儀表板。點擊資源。在附件搜索框中,輸入您要設置的數據庫服務。如果您選擇mLab,它會將您帶到mLab GUI。您的URI連接字符串位於屏幕的頂部。 (您想選擇標有「Driver」的那個)。點擊屏幕中下部的'添加用戶'標籤。添加用戶名和密碼。保存。之後,複製上面的URI連接字符串,然後返回到儀表板。點擊設置,顯示config vars。現在將URI連接字符串粘貼到文本框中,然後添加新創建的用戶憑證以替換<username> and <password>字段。複製配置變量MONGODB_URI。接下來,在您的命令行中,setexportMONGODB_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錯誤解決方案的堆棧溢出答案。

相關問題