Schedule Heroku to restart dynos every 10 or so minutes

The steps provided by @rdegges require additional authentication token in the request. Adding more details:

  1. Create Auth Token using Heroku CLI by running this command as mentioned on Heroku platform API

    heroku authorizations:create

  2. Install the Heroku Scheduler add-on into your Heroku application.

  3. Open scheduler and go to add job. Enter the following command in the job editor. This command performs restart the dyno.

`

curl -n -X DELETE https://api.heroku.com/apps/APP_NAME/dynos \n -H "Content-Type: application/json" \n -H "Accept: application/vnd.heroku+json; version=3" \n -H "Authorization: Bearer TokenCreatedInStep1"

Verify in the Heroku app logs, if the scheduler job is running on the set time.


You can do what you're asking by doing the following:

  • Create a script in your project that makes a Heroku Platform API request to restart your dynos. The API call documentation can be found here: https://devcenter.heroku.com/articles/platform-api-reference#dyno-restart-all

  • Provision the Heroku Scheduler addon.

  • Go into Heroku Scheduler's web UI, and tell it to run your restart script every hour (or whatever time period works for you).

This is the best 'pragmatic' way to accomplish this.