Home > rack-alive

rack-alive

Rack-alive is a project mainly written in Ruby, based on the MIT license.

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

h1. RACK-ALIVE "!https://secure.travis-ci.org/merchii/rack-alive.png!":http://travis-ci.org/merchii/rack-alive

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

h2. Installation

Add to your @Gemfile@:

  gem 'rack-alive'

...and @bundle install@.

h2. 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

}

h2. Test

  GET /alive?

h2. Notes

This gem was developed for our own requirements at "Merchii":http://github.com/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.

h2. License

Released under the MIT license. Copyright (c) "Jonas Grimfelt":http://github.com/grimen, "Merchii":http://github.com/merchii

Previous:Test