Utility to restart web
dynos on heroku that are exceed a certain metric threshold. Currently supported metrics are:
- Memory
- 1 Minute Load Average
It relies on heroku's log-runtime-metrics for the data and uses heroku's PlatformAPI gem to actually restart the dynos.
It is currently running on heroku, https://dashboard.heroku.com/apps/fleetio-dyno-killer
- Setup your env file with the following variables:
APP_NAME
HEROKU_TOKEN
LOAD_1MIN_THRESHOLD
MEMORY_THRESHOLD_IN_MB
DD_API_KEY
DD_APP_KEY
- Run one of the four rake tasks
[heroku run || dotenv] rake:dynos:list_over_memory_threshold
[heroku run || dotenv] rake:dynos:restart_over_memory_threshold
# or
[heroku run || dotenv] rake:dynos:list_over_load_threshold
[heroku run || dotenv] rake:dynos:restart_over_load_threshold
This utility exposes 4 primary rake tasks, all under the dynos
namespace:
Lists all web dynos currently over the memory threshold defined by MEMORY_THRESHOLD_IN_MB
Restarts all web dynos currently over the memory threshold defined by MEMORY_THRESHOLD_IN_MB
Lists all web dynos currently over the load threshold defined by LOAD_1MIN_THRESHOLD
Restarts all web dynos currently over the load threshold defined by LOAD_1MIN_THRESHOLD