README

Path: README
Last Update: Mon Jun 09 21:56:43 -0500 2008

Pulse

Pulse adds an action to your rails project that can be used for external health checking. The most common use is by a http proxy such as haproxy. A proxy can be configured to hit your servers at a specified URL to see if the servers are healthy. By default, they use the "/" URL, but in many sites, this can have side effects like creating a session. Pulse adds a controller and action (usually at the "/pulse" URL) which has no session and no logging.

by Paul Gross

Installation

Pulse should be installed as a plugin:

  cd /path/to/rails/project
  ruby script/plugin install http://pulse.rubyforge.org/svn/tags/pulse-0.3.0

  # Run the following command if you are using Rails 2.0 or higher
  mv vendor/plugins/pulse-0.3.0 vendor/plugins/pulse

And then add a route to config/routes.rb:

  map.pulse 'pulse'

This configures pulse to work at the ‘pulse’ URL. If you would rather use a different URL:

  map.pulse 'heart/beat'

Now, the pulse URL will look like example.com/heart/beat

Configuration of haproxy

Haproxy can be configured to use the /pulse url for its health checking. Just add:

  option httpchk /pulse

So the server monitoring section will look something like:

  listen rails :3001
    option httpchk /pulse
    server rails-1 localhost:3002 maxconn 1 check
    server rails-2 localhost:3003 maxconn 1 check
    server rails-3 localhost:3004 maxconn 1 check
    server rails-4 localhost:3005 maxconn 1 check

Now, all of the servers will be tested for health by hitting /pulse (eg localhost:3004/pulse)

License

Released under Ruby‘s license. www.ruby-lang.org/en/LICENSE.txt

[Validate]