简体   繁体   English

Ruby on rails网站,Heroku,自动重启

[英]Ruby on rails website, Heroku, restart automatically

I recently deployed my personal website built using RoR on heroku. 我最近在heroku上部署了使用RoR构建的个人网站。 today I tried to open my website and the site was down. 今天我试图打开我的网站,该网站已关闭。 If I wanna make sure the process restarts automatically is that a function of RoR or heroku? 如果我想确保进程自动重启是RoR还是heroku的功能? what are the best practices in this scenario? 这种情况下的最佳做法是什么?

Update : this is the heroku log to calrify the issue : 更新:这是用于解决问题的heroku日志:

2013-06-10T08:24:12.852597+00:00 heroku[web.1]: Idling
2013-06-10T08:24:15.762803+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2013-06-10T08:24:16.487918+00:00 app[web.1]: [2013-06-10 08:24:16] ERROR SignalException:   
SIGTERM 
2013-06-10T08:24:16.487918+00:00 app[web.1]:      
/usr/local/lib/ruby/1.9.1/webrick/server.rb:90:in `select'
2013-06-10T08:24:26.878674+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one   
process failed to exit within 10 seconds of SIGTERM
2013-06-10T08:24:26.878857+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2013-06-10T08:24:29.279913+00:00 heroku[web.1]: Process exited with status 137
2013-06-10T08:24:29.299601+00:00 heroku[web.1]: State changed from up to down

This is a function of Heroku. 这是Heroku的功能。 If you only have 1 dyno running, Heroku will set your site to idle after 1 hour of inactivity: https://devcenter.heroku.com/articles/dynos#dyno-idling 如果您只有1个dyno正在运行,Heroku会在1小时不活动后将您的站点设置为空闲: https//devcenter.heroku.com/articles/dynos#dyno-idling

To avoid this, you need an external service like pingdom or NewRelic to ping your site at least once an hour and that will keep it from idling out. 为了避免这种情况,您需要像pingdom或NewRelic这样的外部服务,至少每小时对您的网站进行一次ping操作,这样可以防止它闲置。

Also, it's a good idea to make sure your site starts up fast so if it is idled or restarted, it will come back online quickly. 此外,确保您的网站快速启动是个好主意,如果它被闲置或重新启动,它将很快恢复在线状态。 But that is a topic for another question :) 但这是另一个问题的话题:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM