rollout_control
rollout_control is a JSON/REST API for rollout.
This enables control of rollout from Hubot with a Hubot script. Maybe you can think of some other uses!
Installation
Add the gem to your Rails project Gemfile
:
gem 'rollout_control'
Then mount the engine in config/routes.rb
:
MyApp::Application.routes.draw do
# ... all your other routes here ...
mount RolloutControl::Engine, at: '/rollout'
# You can mount the engine wherever you want, it does not have to be `'/rollout'`.
end
Add an initializer for additional configuration. If you already have a rollout.rb
initializer
you can just add to that.
# config/initializers/rollout.rb
$rollout = Rollout.new($redis)
RolloutControl.configure do |rc|
rc.rollout = $rollout
rc.basic_auth_username = ENV['ROLLOUT_CONTROL_USERNAME']
rc.basic_auth_password = ENV['ROLLOUT_CONTROL_PASSWORD']
end
Actually, if you have everything configured as above you don't have to add this configuration at
all! rollout_control will automatically assume your rollout instance is in the $rollout
global
and that the environment variables ROLLOUT_CONTROL_USERNAME
and ROLLOUT_CONTROL_PASSWORD
configure basic auth.
Note that basic auth is on by default. If you do not configure basic auth nothing will work.
If you want to use your own authentication scheme then you can disable basic auth.
RolloutControl.configure do |rc|
rc.rollout = $rollout
# No basic auth - endpoints will be unprotected.
# You generally should not do this unless you have your own auth set up.
rc.unprotected = true
end
Hubot script installation
Add hubot-rollout-control to your Hubot (run the following in your Hubot directory):
$ npm install --save hubot-rollout-control
Add hubot-rollout-control to Hubot's external-scripts.json
:
["hubot-rollout-control"]
- Set
HUBOT_ROLLOUT_CONTROL_URL
to point to where you mounted rollout_control. For example:http://my-super-app.com/rollout
. - Set
HUBOT_ROLLOUT_CONTROL_USERNAME
to your configured rollout basic auth username (same asROLLOUT_CONTROL_USERNAME
above). - Set
HUBOT_ROLLOUT_CONTROL_PASSWORD
to your configured rollout basic auth password (same asROLLOUT_CONTROL_PASSWORD
above).
If everything is set up correctly, you can now control rollout with Hubot.
=====
aaron
hubot rollout features
hubot
experimental_feature (0%)
kittens (50%), groups: [ cat_lovers ], users: [ 14 ]
aaron
hubot rollout activate experimental_feature
hubot
experimental_feature has been activated
aaron
hubot rollout activate_user kittens 75
hubot
kittens has been activated for user with id 75
aaron
hubot rollout features
hubot
experimental_feature (100%)
kittens (50%), groups: [ cat_lovers ], users: [ 14, 75 ]
=====
Open Source by Hired
We are Ruby developers ourselves, and we use all of our open source projects in production. We always encourge forks, pull requests, and issues. Get in touch with the Hired Engineering team at opensource@hired.com.
License
rollout_control project is MIT licensed. See MIT-LICENSE file for more details.