当它在本地工作时获取Heroku h10错误
目前我得到一个h10应用程序崩溃的错误,即使它在本地工作,并且日志似乎不是很有帮助。该日志第一有错误当它在本地工作时获取Heroku h10错误
错误R10(启动超时) - >网络过程在=错误代码= H10 递减收到错误之前无法绑定到$ PORT推出 60秒内=“应用程序崩溃“method = GET path =”/ favicon.ico“ host = maitri-compassionate-care-app.herokuapp.com request_id = 602ed7f2-118f-43b2-b57f-077b89c7b2c4 fwd =”98.248.251.49“ dyno = connect =服务=状态= 503个字节=
这里是日志:
2016-04-29T01:44:39.917289+00:00 heroku[slug-compiler]: Slug compilation started
2016-04-29T01:44:39.917299+00:00 heroku[slug-compiler]: Slug compilation finished
2016-04-29T01:44:41.023311+00:00 heroku[web.1]: State changed from crashed to starting
2016-04-29T01:44:43.205739+00:00 heroku[web.1]: Starting process with command `bundle exec rails s`
2016-04-29T01:44:46.498256+00:00 app[web.1]: DEPRECATION WARNING: The configuration option `config.serve_static_assets` has been renamed to `config.serve_static_files` to clarify its role (it merely enables serving everything in the `public` folder and is unrelated to the asset pipeline). The `serve_static_assets` alias will be removed in Rails 5.0. Please migrate your configuration files accordingly. (called from block in <top (required)> at /app/config/environments/production.rb:2)
2016-04-29T01:44:46.880147+00:00 app[web.1]: [2016-04-29 01:44:46] INFO WEBrick 1.3.1
2016-04-29T01:44:46.880438+00:00 app[web.1]: [2016-04-29 01:44:46] INFO WEBrick::HTTPServer#start: pid=3 port=3000
2016-04-29T01:44:46.880180+00:00 app[web.1]: [2016-04-29 01:44:46] INFO ruby 2.2.2 (2015-04-13) [x86_64-linux]
2016-04-29T01:45:43.548293+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-04-29T01:45:43.548293+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-04-29T01:45:44.291920+00:00 heroku[web.1]: Process exited with status 137
2016-04-29T01:45:44.312346+00:00 heroku[web.1]: State changed from starting to crashed
2016-04-29T01:45:48.319822+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=maitri-compassionate-care-app.herokuapp.com request_id=242958be-0403-4b41-aec9-c2d1603630a2 fwd="98.248.251.49" dyno= connect= service= status=503 bytes=
2016-04-29T01:45:48.178954+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=maitri-compassionate-care-app.herokuapp.com request_id=ae7f2a3a-d65e-4829-84b6-74c178e2973d fwd="98.248.251.49" dyno= connect= service= status=503 bytes=
2016-04-29T01:45:49.055039+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=maitri-compassionate-care-app.herokuapp.com request_id=602ed7f2-118f-43b2-b57f-077b89c7b2c4 fwd="98.248.251.49" dyno= connect= service= status=503 bytes=
我已经尝试过heroku重启,heroku ps重启,以及rake rails更新bin,但没有一个似乎有帮助。除了超时和崩溃之外,我不确定如何获得更具体的错误。
谢谢
它看起来像你的应用程序使用WEBrick作为Web服务器。这适用于本地开发环境,但不适用于部署到Heroku的生产环境。
Heroku建议使用puma
作为生产服务器。详细的说明可以在他们的开发中心文档中找到。
https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server
从Heroku的文档:
在常规运行时,网络必须赛道绑定到分配给它的
$PORT
在60秒内启动。如果没有,则由测功机管理器终止,并记录R10引导超时错误。在绑定到$PORT
之前和之后,进程可以绑定到其他端口。
根据你的日志,WEBrick是使用3000端口,而不是$PORT
运行,留下$PORT
绑定跳闸60秒的超时。 WEBrick必须配置为在Heroku分配的端口$PORT
上启动。你可以用Procfile来做到这一点。
创建Procfile
,正是命名,使用以下行:
web: bundle exec rails server -p $PORT
然后(从文档):
对于Heroku上使用您的Procfile的
Procfile
添加到root然后推送到Heroku:$ git add . $ git commit -m "Procfile" $ git push heroku
仍然有使用WEBrick的方法吗?它在最后一次推送到heroku之前正在运行,即使它正在使用WEBrick(我已经部署到heroku 7-8次了,在新添加的代码之前没有这个问题) –