Here you will find ideas and code straight from the Software Development Team at SportsEngine. Our focus is on building great software products for the world of youth and amateur sports. We are fortunate to be able to combine our love of sports with our passion for writing code.
The SportsEngine application originated in 2006 as a single Ruby on Rails 1.2 application. Today the SportsEngine Platform is composed of more than 20 applications built on Rails and Node.js, forming a service oriented architecture that is poised to scale for the future.
We built OK Computer for configurable application health checks, useful for load balancers or external monitoring (like Pingdom or New Relic). We've been using it in production for a while now and think you'll find it useful.
In the past, we've used fitter_happier for this purpose. Then, we added MongoDB to one of our applications. To check the connection to that database, we had to monkey-patch fitter_happier, which didn't sit well with us. We also wanted to check that our Resque queues weren't backed up, which necessitated further monkey-patching.
Obviously, we needed something more customizable to the needs of any given app. The idea for OK Computer was born from these frustrations.
Our needs were fairly straightforward and, we believe, universal:
A complete overview is listed in the README, but I want to take a moment to explain how this can make your life a little easier.
The common case can't be any simpler. Include
gem 'okcomputer' in your Rails
app's Gemfile, and you automatically get a few useful endpoints:
If you need anything else, add
config/initializers/okcomputer.rb and register
one of our built-in checks or easily create one of your own. It will show up in
/okcomputer/all, or can be accessed directly by the name you register it with.
For example, let's say that you wanted to check that your Resque queue named "critical" doesn't get above 10 jobs, you'd add the following to get the /okcomputer/resque_critical endpoint.
OKComputer::Registry.register "resque_critical", OKComputer::ResqueBackedUpCheck.new("critical", 10)
whileloop) to make constant requests to the up-check and alert us immediately if something goes wrong.
We think OK Computer can be useful to you as well. Check it out.