Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Rack middleware for checking if app is alive or not - optionally via custom condition(s).

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Guardfile
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.textile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 TODO
Octocat-spinner-32 rack-alive.gemspec
README.textile

RACK-ALIVE

Rack middleware for checking if app is alive or not – optionally via custom condition(s).

Installation

Add to your Gemfile:

  gem 'rack-alive'

…and bundle install.

Usage

Minimal:

  require 'rack/alive'

  use Rack::Alive

Advanced:

  require 'rack/alive'

  use Rack::Alive, proc {
    # Test DB-connection.
    db_alive =
      begin
        ActiveRecord::Base.connection.select_all('select 1')
        true
      rescue
        false
      end

    # Check that you got all horses/unicorns in the stable...or something.
    got_all_horses = ENV['HORSES_IN_THE_STABLE'].to_i == 5

    db_alive && got_all_horses
  }

Test

  GET /alive?

Notes

This gem was developed for our own requirements at Merchii, so feel free to send pull-requests with enhancements of any kind (features, bug-fixes, documentation, tests, etc.) to make it better or useful for you as well.

License

Released under the MIT license.
Copyright © Jonas Grimfelt, Merchii

Something went wrong with that request. Please try again.