Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to shutdown an app deployed on Heroku?

People also ask

How do I stop heroku from running?

If you wish to stop a running one-off dyno, use heroku ps:stop with its name. A one-off dyno will not stop if you issue heroku ps:restart on your application.

How long does heroku app stay deployed?

Your app will sleep for 6 hours starting at the time you pick. It can still be accessed during that time, but the server will take a few seconds to boot up. The time you specify is in Greenwich Mean Time (GMT), so you should adjust your desired time accordingly.

What happens if your app sleeps on heroku?

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.


To completely 'stop' your app you can scale the web dynos down to zero which effectively takes all your app http-processes offline.

$ heroku ps:scale web=0
Scaling web processes... done, now running 0

http://devcenter.heroku.com/articles/maintenance-mode

If you’re deploying a large migration or need to disable access to your application for some length of time, you can use Heroku’s built in maintenance mode. It will serve a static page to all visitors, while still allowing you to run rake tasks or console commands.

$ heroku maintenance:on
Maintenance mode enabled.

and later

$ heroku maintenance:off
Maintenance mode disabled.

From the Heroku Web

Dashboard => Your App Name => Resources => Pencil icon=> Flip the switch => Confirm

Go to your dashboard on heroku. Select the app. There is a dynos section. Just pull the sliders for the dynos down, (a decrease in dynos is to the left), to the number of dynos you want to be running. The slider goes to 0. Then save your changes. Boom.

According to the comment below: there is a pencil icon that needs to be clicked to accomplish this. I have not checked - but am putting it here in case it helps.


You might have to be more specific and specify the app name as well (this is the name of the app as you have it in heroku). For example:

heroku ps:scale web=0 --app myAppName 

Otherwise you might get the following message:

 % heroku ps:scale web=0
Scaling dynos... failed
 !    No app specified.
 !    Run this command from an app folder or specify which app to use with --app APP.

You can disable the app using enable maintenance mode from the admin panel.

  • Go to settings tabs.
  • In bottom just before deleting the app. enable maintenance mode. see in the screenshot below.

enter image description here