Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jnewland/pulse

pls see https://github.com/railsmachine/pulse
https://github.com/jnewland/pulse

Last synced: about 16 hours ago
JSON representation

pls see https://github.com/railsmachine/pulse

Awesome Lists containing this project

README

        

h1. 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":http://haproxy.1wt.eu/ or a monitoring tool such as "god":http://god.rubyforge.org.

h3. Authors

* "Paul Gross":http://www.prgs.net
* "Jesse Newland":http://jnewland.com
* "Josh Nichols":http://technicalpickles.com

h2. Requirements

* Rails
* MySQL, Postgres, or sqlite

h2. Installation

h3. Rails 3.x

Just add the gem to your @Gemfile@ and then @bundle install@:



gem 'rails-pulse'

In your @config/routes.rb@:



pulse
# or customize the URL
pulse '/admin/pulse'

h3. Rails 2.x

In your @config/environment.rb@:



config.gem 'rails-pulse', :source => "http://gemcutter.org/", :lib => "pulse"

Install the gem:



cd RAILS_ROOT
rake gems:install

Finally, add a route to config/routes.rb:



map.pulse
# or customize the URL
map.pulse '/admin/pulse'

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



map.pulse 'some/other/url'

h2. haproxy configuration

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



option httpchk GET /pulse



listen rails :9000
server rails-1 localhost:8000 maxconn 1 check inter 20000 fall 1
server rails-2 localhost:8001 maxconn 1 check inter 20000 fall 1
...

h2. god configuration

You are using god to watch your mongrels, right?

In your mongrel watch, add the following restart condition:



w.restart_if do |restart|
...
restart.condition(:http_response_code) do |c|
c.code_is_not = 200
c.host = 'localhost'
c.path = '/pulse'
c.port = 8000
c.timeout = 5.seconds
c.interval = 20.seconds
end
end

Also make sure to give your mongrels a nice grace period.



...
w.start_grace = 90.seconds
w.restart_grace = 90.seconds
...

For a complete god configuration example, check out my "god_examples project":http://github.com/jnewland/god_examples and the included "sample rails god config":http://github.com/jnewland/god_examples/tree/master/rails/config/god/app.god.

h2. License

Released under "Ruby's license":http://www.ruby-lang.org/en/LICENSE.txt