A simple administration interface for stoplight. Monitor the status, failures, and invocations of your stoplights. Change stoplight colors, or lock them in either red or green state.
This project is packaged as a Ruby gem so that you can easily embed it in your own code containing the configuration details for your stoplight data store.
First you'll need a Gemfile
:
source 'https://rubygems.org'
gem 'stoplight-admin'
Run Bundler to install the dependencies:
$ bundle install
Lastly we need to make our (tiny) application. Here's a typical example using a local Redis data store:
# app.rb
require 'redis'
require 'sinatra'
require 'sinatra/stoplight_admin'
redis = Redis.new(url: 'redis://localhost:6379')
set :data_store, Stoplight::DataStore::Redis.new(redis)
If you run Stoplight Admin behind a reverse proxy (nginx, for
instance) at a URL other than root, you'll need to add the following
lines to your app.rb
file:
use Rack::Config do |env|
env['SCRIPT_NAME'] = '/your/prefix/here'
end
$ bundle exec ruby app.rb
It is possible to mount Stoplight Admin inside Rails.
Add something like this to your config/routes.rb
:
require 'redis'
require 'sinatra/stoplight_admin'
class StoplightAdmin < Sinatra::Base
register Sinatra::StoplightAdmin
redis = Redis.new # Uses REDIS_URL environment variable.
data_store = Stoplight::DataStore::Redis.new(redis)
set :data_store, data_store
end
Rails.application.routes.draw do
mount StoplightAdmin => '/stoplights'
end
Stoplight is brought to you by @camdez and @tfausak from @OrgSync.