No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
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
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Project Readme

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