24

I've slowly battled through to the point where I have a working Grails app on Heroku. I'm going to bed now so I want to shut it down so I don't continue to use up my 750 free hours of my Dyno. It is probably obvious but I can't find how to shutdown my Heroku web server and restart it again in the morning.

Pomum
  • 251
  • 1
  • 2
  • 4

7 Answers7

36

To shut down your Heroku app scale the web processes to 0:

heroku ps:scale web=0

See the Usage & Billing dev centre article: "A web dyno that is idled continues to accrue usage". I believe maintenance mode will continue to accrue time; it simply serves a static page to visitors instead of serving your app.

Keep in mind each app receives 750 free billing hours per month. Depending on your intended usage, this may mean you don't need to shut down (i.e. if you only plan to run a single dyno for the whole month).

culix
  • 10,188
  • 6
  • 36
  • 52
23

From web: Personal => Your App Name => Overview => Configure Dynos => Click on edit against web => Flip the switch => Confirm

Sunny
  • 543
  • 10
  • 17
  • Thank you @Sunny, I can't believe they made this so hard to find! It also took more Googling than I care to admit! – MiFiHiBye Dec 07 '22 at 18:22
13

To stop a DYNO you can use:

heroku ps:stop "appname"

To get list of running appnames you can use:

heroku apps
  • 3
    Looks like the syntax has changed to `heroku ps:stop --app "myapp"`. Also my web dynos kept magically restarting themselves for some reason, so I went with culix's answer (scaling web dynos down to 0). – Jesse Aldridge Apr 01 '16 at 02:02
  • 1
    Will this also stop the charges on my database? – aks Jan 08 '19 at 10:39
4

Just read the documentation:
https://devcenter.heroku.com/articles/one-off-dynos#one-off-dynos

Type

heroku ps

to see all running app associated to you account, with an id associated, then

heroku ps:stop run.1

if the app you want to stop has the 1 id.

Note that the maintenance mode will not stop your app. Mine was wrongly configured and continued to crash with the maintenance mode enabled.

Martin
  • 11,881
  • 6
  • 64
  • 110
4

There's a Maintenance Mode in Settings now in 2019.

enter image description here

Ferenc Dajka
  • 1,052
  • 3
  • 17
  • 45
3

Maybe turn on maintenance mode? heroku maintenance:on

Benjamin Tan Wei Hao
  • 9,621
  • 3
  • 30
  • 56
  • 6
    @Benjamin I'm not sure this is correct - according to the DevCenter, turning on maintenance mode does not alter your web dynos, it simply serves a static page. I believe hours will continue to accrue unless the web dynos are scaled to 0. I have submitted an answer with this below. – culix Feb 09 '13 at 04:58
0

You can use the add-on AutoIdle to automatically shutdown:

https://elements.heroku.com/addons/autoidle

Stefan
  • 71
  • 4