【发布时间】:2019-05-09 18:18:54
【问题描述】:
我想在 Heroku 上托管一个 Ruby on Rails 应用程序作为 Docker 容器。但是部署时似乎存在端口绑定问题。
我通过 Docker 在本地和 Heroku 上成功托管了一个简单的 Ruby 应用程序,然后我转移到了实际应用程序。该应用程序在 localhost 上运行良好,但出现端口绑定问题:
错误 R10(启动超时)-> Web 进程在启动后 60 秒内未能绑定到 $PORT
2019-05-06T18:23:13.608790+00:00 app[web.1]: Digest::Digest is deprecated; use Digest
2019-05-06T18:23:15.826137+00:00 app[web.1]: Puma 2.7.1 starting...
2019-05-06T18:23:15.826185+00:00 app[web.1]: * Min threads: 0, max threads: 16
2019-05-06T18:23:15.826188+00:00 app[web.1]: * Environment: production
2019-05-06T18:23:15.826189+00:00 app[web.1]: * Listening on tcp://0.0.0.0:3000
2019-05-06T18:24:03.338792+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-05-06T18:24:03.338920+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-05-06T18:24:03.468261+00:00 heroku[web.1]: State changed from starting to crashed
2019-05-06T18:24:03.451392+00:00 heroku[web.1]: Process exited with status 137
2019-05-06T18:24:05.407120+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=floating-spire-20546.herokuapp.com request_id=9362ea3c-bcb6-476a-a5d4-76c82cd443a3 fwd="5.151.93.202" dyno= connect= service= status=503 bytes= protocol=https
我尝试将 Heroku 上的 $PORT 变量配置为 3000。我还尝试使用 rails server -b 0.0.0.0 运行应用程序。我也试过没有任何端口。
我认为这可能是由于应用程序的大小和要加载的多个 gem 可能超过 60 秒。
我希望应用绑定到要访问的端口。但是,它崩溃了。
【问题讨论】:
-
有道理。我想这一定是问题所在。非常感谢!
标签: ruby-on-rails ruby docker heroku