Table of Contents
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.
When maintenance mode is turned on, your application will serve a static maintenance page to all visitors, while still allowing you to run one-off dynos. By default, the maintenance mode page is unstyled. To learn how to customize your maintenance page, see Custom Error Pages. Also, when maintenance mode is turned on, the error code H80 will be returned in your logs.
Scheduler jobs can still run while your application is in maintenance mode. Be mindful if you have any jobs set to run.
Enable maintenance mode:
$ heroku maintenance:on Enabling maintenance mode for myapp... done
Disable maintenance mode:
$ heroku maintenance:off Disabling maintenance mode for myapp... done
At any time, you can check the maintenance status of an app:
$ heroku maintenance off
Maintenance mode and dynos
Dynos will continue to accrue billing hours while in maintenance mode. Enabling or disabling maintenance mode doesn’t alter running dynos. Web dynos will continue to run as before, but won’t receive HTTP requests because the requests are blocked by the routers. Dynos of other types, such as worker dynos, will also continue to run.
In some cases, you may want to scale down dynos when maintenance mode is enabled, for example, if you are running a database migration that requires background jobs not be processed while the migration is running.
$ heroku maintenance:on Enabling maintenance mode for myapp... done $ heroku ps:scale worker=0 Scaling worker processes... done, now running 0
If you scale down dynos after enabling maintenance mode, be sure to scale them back up before returning traffic to the app.
You can run one-off dynos as usual while maintenance mode is enabled using