RedisUiRails
A mountable UI Rails engine for inspecting your Redis instances. The teams that will get the most value out of this engine are teams that cannot use the Rails console to inspect their production Redis instances.
Installation
- Add this line to your application's Gemfile:
gem 'redis_ui_rails'
- In
config/routes.rb
, mount the engine
Rails.application.routes.draw do
mount RedisUiRails::Engine => "/redis_ui"
end
- Precompile your assets
cd path/to/app/root
bundle exec rake assets:precompile
- Configure your Redis UI engine.
Example:
# config/initializers/redis_ui_rail.rb
# Each "instance" is a hash, with the following symbolized key structure:
# :id (required) The ID used in the URL for this instance.
# :name (required) The name that differentiates this Redis instance from others.
# :url (required) The URL of the redis instance.
# :resource_links (optional) Quick links to resources related to this instance.
# :enabled (optional) Allows enabling per environment. Defaults to true.
#
RedisUiRails.configure do |config|
config.redis_instances = [
{
id: :local,
name: "Local Queue and Cache", # many apps share a queue and cache Redis locally
url: ENV["REDIS_URL"],
enabled: Rails.env.development? || Rails.env.test?
},
{
id: :cache,
name: "Cache",
url: ENV.fetch("REDIS_CACHE_URL"), # many apps have separate queue and cache Redis instances in production
resource_links: [
{
label: "Custom Datadog Dashboard",
url: "https://myorg.datadoghq.com/path/to/your/dashhboard"
}
],
enabled: Rails.env.production?
}
]
end
Local Development
- Requirements:
- Ruby >= 3.0
- Direnv (don't forget your rc file hook)
- Initial setup
bundle install
cp .rspec.example .rspec
cp .env.example .env
direnv allow
- Run tests
bundle exec rspec spec