Akka应用程序到Heroku时出现错误:Web进程无法绑定到$ PORT

时间:2019-04-11 13:03:38

标签: scala heroku akka

尝试将Akka应用程序部署到Heroku

在代码中,我有:

val httpPort = Properties.envOrElse("PORT", "8080").toInt
val serverBinding: Future[Http.ServerBinding] = Http().bindAndHandle(routes,
"localhost", httpPort)

在Procfile中,我有:

web: target/universal/stage/bin/hello-world -Dhttp.port=${PORT}

但是我仍然会进入日志:

错误R10(引导超时)->   Web进程在启动后60秒内未能绑定到$ PORT

  2019-04-11T11:22:30.239015+00:00 heroku[web.1]: Starting process with 
  command `target/universal/stage/bin/hello-world -Dhttp.port=${PORT}`
  2019-04-11T11:22:32.322727+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS 
  defaults based on dyno size. Custom settings will override them.
  2019-04-11T11:22:32.447725+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: - 
  Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
  2019-04-11T11:22:35.729346+00:00 app[web.1]: Server online at 
  http://127.0.0.1:19702/
  2019-04-11T11:23:30.413620+00:00 heroku[web.1]: State changed from starting 
  to crashed
  2019-04-11T11:23:30.306939+00:00 heroku[web.1]: **Error R10 (Boot timeout) -> 
  Web process failed to bind to $PORT within 60 seconds of launch**
  2019-04-11T11:23:30.307058+00:00 heroku[web.1]: Stopping process with SIGKILL
  2019-04-11T11:23:30.395435+00:00 heroku[web.1]: Process exited with status 
  137
  2019-04-11T11:23:31.907600+00:00 heroku[router]: at=error code=H10 desc="App 
  crashed" method=GET path="/" host=word-list-app.herokuapp.com 
  request_id=b1d988e1-f53a-4409-9546-75404a9fcd5c fwd="94.199.129.189" dyno= 
  connect= service= status=503 bytes= protocol=https

1 个答案:

答案 0 :(得分:5)

您应将localhost替换为0.0.0.0