Manage Heroku App Formations and Apps with YML config files. Allows you to version control important application attributes, and manage configuration for different environments and scenarios.
Add this line to your application's Gemfile:
gem 'manageheroku'
And then execute:
$ bundle
Or install it yourself as:
$ gem install manageheroku
Typical usage is to automate scaling any number of services through config files. For example:
oauth-token: <%= ENV["HEROKU_OAUTH_TOKEN"] %>
apps:
- name: "commerce-app-staging"
maintenance: false
- name: "pricing-service-staging"
maintenance: false
- name: "messaging-service-staging"
maintenance: false
formations:
- name: "commerce-app-staging"
procs:
- process: "web"
quantity: 4
size: "standard-2X"
- process: "resque"
quantity: 1
- name: "pricing-service-staging"
procs:
- process: "web"
quantity: 2
- process: "resque"
quantity: 1
- name: "messaging-service-staging"
procs:
- process: "web"
quantity: 2
- process: "resque"
quantity: 1
This config file is for an imaginary ecommerce application that is composed of a website, a pricing service and a messaging service. Using manageheroku allows you to apply this configuration to the dyno formation of each application listed in the config file. For example:
config_file = File.join(Rails.root, 'script', 'config', "black_friday_conf.yml")
heroku = Manageheroku::Heroku.new(config_file)
heroku.update!
Your application can programmatically run code like that to scale your applications based on a schedule or whatever your needs are. Currently your dyno formation sizes and quantities are the only things updatable. You can find a list of dyno types in heroku docs https://devcenter.heroku.com/articles/dyno-types
The apps section of the config file allows you to configure attributes of a list of apps. Configurable attributes are maintenance mode and build stack. See https://devcenter.heroku.com/articles/platform-api-reference#app-update
The formations section of the config file allows you to configure dyno formations for a list of apps. See https://devcenter.heroku.com/articles/platform-api-reference#formation-batch-update for details.
We have manageheroku config files for shutting down and starting up all of our internal environments: development, staging and performance. Then with cron (or resque scheduler) all these environments shut down at 8pm and start back up at 8am, so we're not paying for loads of resources that aren't being used. We also use manageheroku config files for storing various interesting configurations of the application for our performance testing environments.
- Fork it ( https://github.com/[my-github-username]/manageheroku/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Bundler created the gem boilerplate and can release it for us.
Test with
gem build manageheroku.gemspec
For Realz
bundle exec rake release