Skip to content
A Rails engine for checking system status
Ruby HTML JavaScript CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
bin
config
lib
script
spec
vendor/cache
.gitignore
.rspec
.rubocop.yml
.travis.yml
Gemfile
MIT-LICENSE
README.md
Rakefile
status_cat.gemspec

README.md

Build Status Coverage Status Code Climate Dependency Status Gem Version

schrodingersbox/status_cat README

This engine makes monitoring the status of your Rails environment easier.

It provides a Rails action with a green light / red light list of configured services, such as:

  • ActionMailer
  • ActiveRecord
  • AWS S3
  • Delayed Job
  • Stripe
  • Fitbit
  • Profiles.io
  • SendHub
  • Twilio

Getting Started

  1. Add this to your Gemfile and bundle install

     gem 'status_cat'
    
  2. Add this to your config/routes.rb

     mount StatusCat::Engine => '/status_cat'
    
  3. Restart your Rails server

  4. Run rake status_cat:check for a text status report

  5. Visit http://yourapp/status_cat in a browser for an HTML status report

Configuration

General configuration should go in config/initializers/status_cat.rb.

  StatusCat.configure do |config|

    config.authenticate_with do
      authenticate!
    end

    config.authorize_with do
      authorize!
    end

    config.layout = 'admin'

    config.noreply = 'noreply@schrodingersbox.com'
    config.to = 'ops@schrodingersbox.com'
    config.from = 'ops@schrodingersbox.com'
    config.subject = "#{Rails.env.upcase} StatusCat Failure"

    config.enabled = [ :action_mailer, :active_record ]
  end

Checker specific configuration should in the initializer it relates to, so it will be kept in sync. i.e. config/initializers/twilio.rb

  Twilio.configure do |config|
    config.account_sid = StatusCat::Checkers::Twilio.sid = ENV['TWILIO_SID']
    config.auth_token = StatusCat::Checkers::Twilio.auth_token = ENV['TWILIO_AUTH_TOKEN']
  end      

How To

Configure Enabled Checkers

By default, all subclasses of StatusCat::Checkers::Base will be run. Do the following if you would like to limit or reorder the set of checkers

Create or add to config/initializers/status_cat.rb

StatusCat.configure do |config|
  config.enabled = [ :action_mailer, :active_record ]
end

Configure Email Settings

Create or add to config/initializers/status_cat.rb

StatusCat.configure do |config|
  config.noreply = 'noreply@schrodingersbox.com'
  config.to = 'ops@schrodingersbox.com'
  config.from = 'ops@schrodingersbox.com'
  config.subject = "#{Rails.env.upcase} StatusCat Failure"
end

Run Status Checks From A Cron

  1. Run rake status_cat:cron from a cron job or other scheduling system.

Add New Checkers

You can place new checkers anywhere you like, but app/checkers is the recommended location.

  1. Add the following to config/application.rb

    Dir[Rails.root + 'app/checkers/**/*.rb'].each { |path| require path }
    
  2. Create a new subclass of StatusCat::Checkers::Base that sets @value and @status instance variables.

    module StatusCat
      module Checkers
        class Dummy < Base
          def initialize
            @value = 'dummy'
            @status = 'fail'
          end
        end
      end
    end
    

Require authentication

Create or add to config/initializers/status_cat.rb

StatusCat.configure do |config|
  config.authenticate_with do
    warden.authenticate! scope: :user
  end
end

Require authorization

Create or add to config/initializers/status_cat.rb

StatusCat.configure do |config|
  config.authorize_with do
    redirect_to main_app.root_path unless current_user.try(:admin?)
  end
end

Apply a custom layout

Create or add to config/initializers/status_cat.rb

StatusCat.configure do |config|
  config.layout = 'admin'
end

Get Started Developing

  1. cp spec/dummy/config/passwords.yml.sample spec/dummy/config/passwords.yml
  2. rake app:db:create app:db:migrate app:db:test:prepare

Reference

History

  • Version 0.0.2 = Rails 3 compatible
  • Version 0.0.3 = Rails 4 compatible
  • Version 5.0.0 = Rails 5 compatible
  • Version 5.2.0 = Rails 5.2/Ruby 2.5 compatible
You can’t perform that action at this time.