Created
May 23, 2015 15:28
-
-
Save andrew/3b6a79da24681cb6f034 to your computer and use it in GitHub Desktop.
Rake task to restart web dynos over a rolling 30 seconds window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :app do | |
desc 'restart web dynos over a rolling 30 seconds window' | |
task restart: :environment do | |
require 'platform-api' | |
heroku = PlatformAPI.connect_oauth(ENV['PLATFORM_API_TOKEN']) | |
dynos = heroku.dyno.list(ENV['APP_NAME']).select{|d| d['name'].match(/^web/) } | |
dynos.each { |d| heroku.dyno.restart(ENV['APP_NAME'], d['name']); sleep 30 } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment