Akka应用程序到Heroku获取错误:Web进程无法绑定到$ PORT

问题描述 投票:0回答:1

试图将我的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
scala heroku akka
1个回答
5
投票

你应该用localhost替换0.0.0.0

© www.soinside.com 2019 - 2024. All rights reserved.