Minimalist UI for the rollout gem that you can just mount as a Rack app and it will just work.
Add it to your application's Gemfile:
gem "rollout", "~> 3.1"
gem "rollout-redis-adapter", "~> 0.1"
gem "rollout-ui"rollout-ui 0.9+ requires Rollout 3.1 and does not support Rollout 2.x. The UI is backend-neutral: applications using Redis should add rollout-redis-adapter and pass a configured Rollout instance into the UI.
Mount it
Rails.application.routes.draw do
mount Rollout::UI::Web.new => '/admin/rollout'
# ...
endAnd to configure it with your Rollout instance, you can put your configuration
in routes.rb or in a standalone initializer.
Rollout::UI.configure do
instance { $rollout }
endIf you are using Rails, you can put constraints on your mount.
So in case of usafe with Devise, your constraints might look like:
module Constraint::Admin
def self.matches?(request)
id = request.session["warden.user.user.key"].try(:[], 0).try(:[], 0)
return false if id.blank?
user = User.find_by(id: id)
user&.admin?
end
end
Rails.application.routes.draw do
mount Rollout::UI::Web.new => '/admin/rollout', constraints: Constraints::Admin
# ...
endThis gem performs no Host header validation of its own. When mounted inside a Rails app (as shown above), requests already pass through Rails' own config.hosts checks before reaching this mount point.
If you run this as a standalone app (e.g. via rackup), you're responsible for host header validation in the same way you're responsible for authentication, for example with
Rack::Protection::HostAuthorization in front of it, or a reverse proxy that only forwards trusted hosts.
The index and show routes can also respond with JSON data instead of HTML when the request's Accept header is
application/json
The index route also accepts query parameters to filter by user or group:
/admin/rollout?user=someone
/admin/rollout?group=developers
To get the most out of rollout-ui, we recommend you to turn on logging on your rollout instance to see history of changes in the UI.
require "redis"
require "rollout"
require "rollout/adapters/redis"
$redis = Redis.new
$rollout = Rollout.new(
adapter: Rollout::Adapters::Redis.new($redis),
logging: { history_length: 100, global: true },
)To also see who updated states of your rollouts, you can configure actor and
actor_url. So if you are using Rails with Devise, your configuration might
look like:
Rollout::UI.configure do
instance { $rollout }
actor { current_user&.username }
actor_url { |actor| "/#{actor}" }
endWhen using a Rollout version and adapter that support event-aware deletion,
deletions appear in the overview history with the configured actor. This
requires global logging (global: true); adapters without event-aware deletion
retain the previous behavior and do not add a deletion event.
Bug reports and pull requests are welcome on GitHub at https://github.com/fetlife/rollout-ui.
This project uses mise for managing development tools.
Install mise if you haven't already:
curl https://mise.run | shThen install the required tools and dependencies:
mise install
bundle installTo run this project for development in isolation:
bundle exec rerun rackupAnd visit http://localhost:9292/.
Alternatively, you can also configure which Redis with:
REDIS_HOST=localhost REDIS_PORT=6379 REDIS_DB=10 bundle exec rerun rackup- Bump version:
rake version:patch(orminor/major) - Commit and tag:
git commit -am "Bump version" && git tag v0.7.3 - Push:
git push origin master --tags
The GitHub Actions workflow will automatically publish to RubyGems when tags are pushed.
The gem is available as open source under the terms of the MIT License.
