Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

heroku node app exits after idling

Tags:

node.js

heroku

i have a node app hosted on heroku. works fine, but once the app starts idling after 30 minutes, the app changes from up to down, and exits with status 0.

2016-08-16T00:02:28.554960+00:00 heroku[web.1]: State changed from starting to up
    2016-08-16T00:35:02.601620+00:00 heroku[web.1]: Idling
    2016-08-16T00:35:02.602105+00:00 heroku[web.1]: State changed from up to down
    2016-08-16T00:35:05.902125+00:00 heroku[web.1]: Stopping all processes with SIGTERM
    2016-08-16T00:35:06.827968+00:00 heroku[web.1]: Process exited with status 0

Could it be something in the code, or do i just need to keep it from idling?

Thanks! Paul

like image 509
user3527354 Avatar asked Aug 16 '16 00:08

user3527354


People also ask

How do you keep Heroku 24 7?

Yeah You can run your heroku app 24/7. Verify your account by adding credit card you will get 450 extra dyno hours . i.e 1000 dyno hours. If there is no traffic for 30 min the Worker Dynos will sleep.

How long does Heroku app stay deployed?

The dyno manager is responsible for managing dynos across all applications running on Heroku. Applications that use the free dyno type will sleep after 30 minutes of inactivity.

Why does Heroku app sleep?

As you may have known that Heroku does not allow your app to run for more than 1 hour. When an app on Heroku has only one web dyno and that dyno doesn't receive any traffic in 1 hour, the dyno goes to sleep. When someone accesses the app, the dyno manager automatically wakes up the web dyno to run the web process type.


1 Answers

If this is on the free tier then this is expected behavior, it's the price you pay for free. It should restart on the next web request to it, but the latest terms for the free tier don't let you keep it on 24/7 even if that many requests come in.

Free tier is best for while you're prototyping. Once you're serving customers you should either go paid or move to a different host.

like image 74
Paul Avatar answered Oct 03 '22 19:10

Paul