How to shutdown an app deployed on Heroku?
Asked Answered
O

11

268

I have an app on Heroku which is being used by few users. However, I notice there are some data issues which I'd like to fix and stop the app in the mean time so users don't enter anything new.

Is there a way to stop the app on Heroku rather than destroying it? I see that restart server command is there... Although I don't see anything like 'stop'.

Owe answered 11/5, 2010 at 14:18 Comment(0)
D
372

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
Durtschi answered 19/4, 2012 at 15:27 Comment(9)
good idea here but I think you meant '$ heroku ps:scale app=0'Vinitavinn
Excuse my noobness, it appears either commands may be appropriate. CheersVinitavinn
heroku ps:scale operates on dynos, so you have to explicitly specify the dyno type to affect.Durtschi
When you've fixed what you want to, don't forget to do: heroku ps:scale web=1 again, or else your app will never revive...Winn
This is the correct solution. Maintenance mode does not actually stop the app, It only prevents traffic to it. This should be the accepted answer.Delilahdelimit
In Rails, if your Procfile has a line started with web, then use heroku ps:scale web=0, else you may receive no such process type app defined in Procfile.Barometer
Agree, maintenance also doesnt stop the workers, scheduler etc.Moldy
Keep in mind that if you have listed other process types in your Procfile that you'll need to set those to zero as well.Animato
Typing just this prompts me a syntax error. I know this answer is like 9 years old but just saying. Today you gotta add -a <AppNameHere> adding your app's name to that command and it should be fine.Centring
K
194

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.
Kate answered 18/5, 2010 at 0:29 Comment(1)
I needed to shut down my Heroku app to test a monitoring service (Pingdom). There doesn't seem to be a way to completely stop an app without destroying it, the maintenance mode returns HTTP status 503, so it's suitable for triggering the monitoring service.Zinc
B
129

Simple steps from the Heroku Web

  1. go to Dashboard
  2. click in "Your App Name"
  3. click in Resources tab
  4. click in the Pencil icon (look the attached image)
  5. Flip the switch to left
  6. click in Confirm

enter image description here

Bary answered 7/6, 2019 at 18:1 Comment(1)
If you run heroku logs --tail and then do this, you'll see that it's the same as running heroku ps:scale web=0Durnan
T
49

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.

Tobytobye answered 7/2, 2014 at 23:47 Comment(2)
Ah, thank you. In the newer dashboard you first have to click the little pencil icon to put the app into edit mode, then you can work the slider.Provence
This setting now can be found under Resources section.Necolenecro
U
43

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.
Undermanned answered 14/1, 2015 at 5:21 Comment(0)
R
23

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

Raina answered 21/5, 2019 at 11:25 Comment(3)
Simple to use and elegant.Filiate
Maintenance mode doesn't stop the dyno, it just block all incoming HTTP requests. If you have some background process running, it will keep running. See Heroku doc: devcenter.heroku.com/articles/maintenance-modeUtopianism
That doesn't mean that app is stopped, corn jobs for example will keep executingEnnis
A
11

To add to the answers above: if you want to stop Dyno using admin panel, the current solution on free tier:

  1. Open App
  2. In Overview tab, in "Dyno formation" section click on "Configure Dynos"
  3. In the needed row of "Free Dynos" section, click on the pencil icon on the right
  4. Click on the blue on/off control, and then click on "Confirm"

Hope this helps.

Atelier answered 11/4, 2019 at 11:10 Comment(0)
P
4

CMD: install The Heroku CLI https://devcenter.heroku.com/articles/heroku-cli#download-and-install

press win+r, type "cmd" press enter

heroku login # login  
heroku ps:scale worker=0 -a your_app_name

GIU: https://dashboard.heroku.com/apps
Personal==> ==> Resources > click on Pencil Icon and drag to left side > confirm
then Dynos will go down.

Potpourri answered 4/6, 2021 at 14:21 Comment(0)
T
3

If you are using eclipse plugin, double click on the app-name in My Heroku Applications. In Processes tab, press Scale Button. A small window will pop-up. Increase/decrease the count and just say OK.

Trucking answered 1/4, 2013 at 11:24 Comment(0)
L
1

To DELETE your Heroku app

This is for those looking to DELETE an app on their Heroku account. Sometimes you end up here when trying to find out how to remove/delete an app.

WARNING: This is irreversible!

  • Go to your Heroku dashboard here
  • Select the app you want to delete.
  • Scroll down to the bottom of the settings page for that app.
  • Press the red Delete app... button.
Lorient answered 29/12, 2016 at 0:26 Comment(2)
OP explicitly stated that they want to "stop the app on heroku rather than destroying it". I only point this out because for whatever reason Bing shows this response as the answer.Outsoar
Thanks! Maybe this should be moved to a different area?Lorient
R
0

1> Yes... There is pencil icon when we go to Personal==> <app name> ==>Resources then click on Pencil Icon and drag to left side and Dynos will go down.

2> You can validate using Heroku cli

heroku logs --app {your-appname}

it worked for me.

Reginaldreginauld answered 21/2, 2021 at 7:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.