Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop a heroku server?

I have a staging server hosted on heroku, I just want to bring it down, but not destroy the app. How can I do it? Do I have any command like 'heroku stop' like 'heroku restart' for restarting?

OR

Is there a way to automate the server to turn off itself when it exceeds the 750 hr free usage?

Actually I don't want the server so I am trying to stop it, or leave it for the free hours.

like image 887
n00b Avatar asked Feb 06 '12 06:02

n00b


People also ask

How do I stop Heroku idling?

You can also try http://kaffeine.herokuapp.com (made by me), it's made for preventing Heroku apps to go to sleep. It will ping your app every 10 minutes so your app won't go to sleep. It's completely free.

Does Heroku go to sleep?

When Do Apps Sleep? 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 will automatically wake up the web dyno to run the web process type.


2 Answers

You can scale individual non-web processes down to zero quite happily:

$ heroku ps:scale worker=0
$ heroku ps:scale resque=0
etc...

and web to 1:

$ heroku ps:scale web=1

As Mischa says, you get one free dyno running, so leave your 1 web dyno running (I'm not sure you can stop the last web process)

like image 164
Neil Middleton Avatar answered Sep 27 '22 23:09

Neil Middleton


You can put it under maintenance, which stops it but doesn't delete it:

heroku maintenance:on

More info: https://devcenter.heroku.com/articles/maintenance-mode

like image 25
bruno077 Avatar answered Sep 27 '22 22:09

bruno077