HireFire - The Heroku Dyno Manager
Note: This gem currently only applies to users that are using the new HireFire beta program. Once out of beta, this will become the default gem for new users.
HireFire is a hosted service that manages / autoscales your Heroku dynos.
It supports the following stacks:
- Celadon Cedar
- Badious Bamboo
- Argent Aspen
It supports practically any worker library. We provide out-of-the-box support for:
- Delayed Job
Note that you can write your own worker queue logic for almost any other worker library as well. HireFire can scale multiple individual worker libraries at the same time, as well as multiple individual queues for any worker library.
It supports practically any Rack-based application or framework, such as:
- Ruby on Rails
- Bare Rack Apps
We provide convenient macros for the above mentioned worker libraries to calculate the queue size for each of them. If you wish to conribute more macros for other existing worker libraries feel free to send us a pull request.
Here is an example with Ruby on Rails 3. First, add the gem to your
Then, all you have to do is create an initializer in
config/initializers/hirefire.rb and add the following:
HireFire::Resource.configure do |config| config.dyno(:resque_worker) do HireFire::Macro::Resque.queue end config.dyno(:dj_worker) do HireFire::Macro::Delayed::Job.queue end end
This will allow HireFire to read out the queues for both Resque and Delayed Job. By default these macros will count all the queues combined if you are using multiple different queues for each worker library. You can also pass in specific queues to count, like so:
HireFire::Resource.configure do |config| config.dyno(:resque_worker) do HireFire::Macro::Resque.queue(:mail, :backup) end config.dyno(:dj_worker) do HireFire::Macro::Delayed::Job.queue(:encode, :compress) end end
This will tell HireFire to count the total amount of jobs from the
backup queue for the
resque_worker dyno, and the
compress queues for the
resque_worker refers to the
resque_worker in your
Procfile, and the
dj_worker refers to the
dj_worker in the
Procfile. In this case the
Procfile would look something like this:
resque_worker: QUEUE=mail,backup bundle exec rake resque:work dj_worker: QUEUES=encode,compress bundle exec rake jobs:work
Now that HireFire will scale both of the these dyno types based on their individual queue sizes. To customize how they scale, log in to the HireFire web interface.
Visit the official website for more information!