Heroku Boot 超时(错误R10)

kxeu7u2r  于 2022-11-13  发布在  其他
关注(0)|答案(9)|浏览(151)

每次我启动应用程序时,如果没有以下条件,它将无法超过60秒:

2012-05-06T22:41:11+00:00 heroku[web.1]: Stopping process with SIGKILL
2012-05-06T22:41:11+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2012-05-06T22:41:11+00:00 heroku[web.1]: Process exited with status 137
2012-05-06T22:41:12+00:00 heroku[web.1]: State changed from starting to crashed

下面是我的Procfile

web: bundle exec thin start -p $PORT

如有任何回复,我们将不胜感激。

czfnxgou

czfnxgou1#

如果您的应用程序确实因为“好的”原因而花费了超过60秒的时间,您可以使用https://github.com/dblock/heroku-forward来解决60秒的 Boot 时间限制。

5vf7fwbs

5vf7fwbs2#

解决方法是我忘记在Procfile行中包含-p $PORT。
在过程文件更改中:

web: bundle exec thin start

web: bundle exec thin start -p $PORT

这就解决了我的问题。

cyvaqqii

cyvaqqii3#

Heroku的 Boot 超时问题也让我头疼不已。我读了几篇关于如何解决这个问题的博客文章,最后把一些解决方案自动化成了一个宝石。
为了减少部署时的启动时间,您可以在 Boot 时修剪加载的gem(这并不意味着您必须在应用程序中修剪它们,只需在启动时修剪)。
gem_bench评估在 Boot 时可能不 * 需要 * 哪些gem。
我有一个应用程序,大约有250个宝石,并能够添加:require =〉false到其中大约60个宝石,具有戏剧性的效果。
https://github.com/acquaintable/gem_bench
免责声明:我是这个开源ruby gem的作者。我写这个gem是为了帮助自己解决这个确切的问题:Heroku 60秒暂停

wkyowqbh

wkyowqbh4#

嗨,我也遇到了同样的问题。我已经解决了这个问题,增加了超时/config/unicorn.rb更改超时15到超时20/config/unicorn.rb

1cklez4t

1cklez4t5#

在我使用nodejs的例子中,我通过添加一个包含内容的Procfile文件解决了这个问题:worker:node index.js并将其推送到heroku。之后,确保禁用检查“web npm start”并打开检查“worker node index.js”,如下图所示
herokuResourcesConfig

idv4meu8

idv4meu86#

我在Heroku上部署我的节点应用程序时也遇到了同样的错误。
我通过添加一个过程文件解决了这个问题。

web: node app.js

它告诉Heroku如何启动应用程序。
该错误是因为Heroku无法配置在哪个端口上运行应用程序。
它可以通过为Heroku指定PORT来解决,即:在app.js中

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
    console.log(`App is running on port ${ PORT }`);
});
wlwcrazw

wlwcrazw7#

错误R10( Boot 超时)是heroku的这个隐藏部分允许您增加部署时间。
https://tools.heroku.support/limits/boot_timeout

lrpiutwd

lrpiutwd8#

我得到这个错误是因为Heroku没有访问Mongo Atlas数据库的权限。您需要在数据库设置中更改此设置

mutmk8jj

mutmk8jj9#

我也有同样的问题,通过使用代理服务器www.example.com创建文件来解决https://www.npmjs.com/package/http-proxy#setup-a-basic-stand-alone-proxy-server
proxy.js:

httpProxy.createProxyServer({
    target, // target that can't cant be exposed, e.g. localhost:4000
    changeOrigin: true,
}).listen(process.env.PORT); // port from heroku runtime

然后

node server/proxy.js

相关问题