在Grails应用程序中避免Heroku引导超时

在Grails应用程序中避免Heroku引导超时

本文介绍了在Grails应用程序中避免Heroku引导超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在heroku雪松中部署了一个grails应用程序,我们的应用程序需要超过60秒才能启动,并根据:

我们减少了依赖关系,有些情况下启动需要超过60秒,所以我们的应用程序被heroku阻止。



你知道一些方法来避免这种情况吗?
$ PORT 提前,以便Grails可以随时启动它想要的启动;在Grails启动期间,请求只会失败并出现404错误,但至少应用程序可以可靠启动。




p>使用它:

  heroku config:set BUILDPACK_URL = https://github.com/funfork/heroku-buildpack- grails-earlybind 

如果您需要强制重新编译slug(确保您没有提交待处理):

  git commit --allow-empty -m空提交
git push heroku master

在这里,你去!


We have a grails app deployed in heroku cedar, our app takes more than 60 seconds to start, and according to heroku:

we reduced dependencies as posible but in some occasions the startup takes more than 60 seconds, so our app is stopped by heroku.

Do you know some way to avoid this?

解决方案

I have a nice solution for this problem: I forked the Grails buildpack and added a bit of code that forces Jetty to bind to the $PORT early, so that Grails can take all the time it wants to start up; during the Grails startup time, requests simply fail with a 404 error, but at least the app starts reliably.

https://github.com/funfork/heroku-buildpack-grails-earlybind

To use it:

heroku config:set BUILDPACK_URL=https://github.com/funfork/heroku-buildpack-grails-earlybind

And if you need to force a slug recompile (ensure that you have no commit pending first):

git commit --allow-empty -m "empty commit"
git push heroku master

And here you go!

这篇关于在Grails应用程序中避免Heroku引导超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 09:44