How to automatically restart Heroku dynos when application is failing?

Viewed 393
1 Answers

You can read about heroku's auto-restart policy here: Does heroku restart NodeJS server if application crashes

If you want to restart by force as soon as it crashes, you can do so via the dashboard - app management (https://dashboard.heroku.com/apps/[APP_NAME]) then on the top right: More> Restart all dynos: enter image description here

You can also do this using heroku cli: https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-dyno-restart-dyno


In addition, I built a small Node.js app (can run on a separate free heroku account ... ) that monitors the app every 50 seconds, and as soon as status 200 does not return, restarts all dynos via heroku's api platform ... Maybe it will inspire you or suit you, maybe with small changes. https://github.com/ShlomoCode/Heroku-dynos-restarter

Related