Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding help

  • Loading branch information...
commit 4899a66f49d03acbcd7cf23712e65c58f0859753 1 parent 0d06857
@jondot authored
Showing with 57 additions and 7 deletions.
  1. +57 −7 README.md
View
64 README.md
@@ -3,11 +3,61 @@ A Rack middleware that should indicate the health of your service.
## Usage
+Here is a simple example (see `examples`)
+
+ map '/ping' do
+ use Rack::Ping do |ping|
+ ping.check_url "http://localhost:9292/"
+ ping.ok_regex /goodbye/
+ end
+ end
+
+ run lambda{|env| [200, {'Content-Type' => 'text/html'}, ["hello"]]}
+
+## Options
+
+When building/mounting your rack, use the `ping` configuration variable,
+specify:
+
+* `version` is an accessor for your application version. `App::VERSION`
+ would be a good idea.
+* `check_url` is a url that `ping` will fetch and run `ok_regex` on. If
+ the match is ok, we're good. You must specify `check_url` and
+`ok_regex` togather. `timeout_secs` is the amount of seconds we wait
+until spitting out an error.
+* `check` will accept a block to run. This is a good alternative to
+ `check_url`: run a couple of sanity checks to indicate you're good.
+* `ok_code`, `error_code`, `ok_text`, `error_text` are configuration for
+ you to use, to configure against LB quirks. The default config should
+work against ELBs (Amazon elastic LB).
+
+ :version => '0',
+ :check_url => nil,
+ :ok_regex => nil,
+ :ok_text => 'ok',
+ :ok_code => 200,
+ :timeout_secs => 5,
+ :error_text => 'error',
+ :error_code => 500
+
+## Headers
+
+`ping` will output intelligent headers. First `x-ping-error` will try to
+explain why ping failed.
+
+Next, `x-app-version` will expose the current deployed version of your
+app. This is good in order to validate nothing crawled up to production,
+as well as validation for post-production deployment.
+
+`ping` will bust any browser/client cache for you.
+
+
+## Contributing
+
+Fork, implement, add tests, pull request, get my everlasting thanks and a respectable place here :).
+
+
+## Copyright
+
+Copyright (c) 2011 [Dotan Nahum](http://gplus.to/dotan) [@jondot](http://twitter.com/jondot). See MIT-LICENSE for further details.
-use Rack::Ping do |ping|
- ping.version = "4.0"
- ping.check_url = "http://localhost:234/api"
- ping.ok_regex = /Welcome to Acme API/
- ping.ok_text = 'ok'
- ping.ok_code = 200
-end
Please sign in to comment.
Something went wrong with that request. Please try again.