Skip to content

bigcommerce-labs/stoplight-admin

 
 

Repository files navigation

Gem version Dependency status

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.

Configuration

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)

Reverse Proxying

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

Usage

$ bundle exec ruby app.rb

Rails

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

Credits

Stoplight is brought to you by @camdez and @tfausak from @OrgSync.

About

A simple administration interface for the stoplight gem.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 53.3%
  • HTML 44.7%
  • Dockerfile 2.0%