No commit activity in last 3 years
No release in over 3 years
Rack middleware for checking the process commit hash on Heroku
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0

Runtime

>= 0
 Project Readme

Rack::HerokuMeta

Rack middleware for checking the process commit hash on Heroku

Note/Caveat

I need a stuck dyno to occur so I can fully test this ;)

Why

On Heroku deployments, a dyno ENV has PS and COMMIT_HASH values that are useful for viewing the state of the deploy. The commit hash contains the short sha1 from the most recent deploy, while ps contains the process name of the dyno.

Sometimes when deploying to Heroku, a dyno gets "stuck" and continues serving up the previous deploy. This can cause problems. The middleware provides one way of quickly checking.

How

In your gemfile:

gem "rack_heroku_meta", :require => "rack/heroku_meta"

In your rackup:

use Rack::HerokuMeta # defaults to /heroku_meta

or with a configured route

use Rack::HerokuMeta, :route => "/foo_bar"

You can then hit the route with an http client of your choice and parse the returned JSON data.

Security

The endpoint exposes information about your current Heroku deploy. While the information is probably benign, if you are concerned, either deploy authentication middleware to protect the route, or simply configure the route randomly like "/meta_6960VYT6vU0mK"

Alternatives

The Heroku PS API is a more detailed way to view process data about your entire application stack. However, if you want quick and dirty, especially if you have minimal dynos running, this gem can be of help.

Copyright

Copyright (c) (2012) Brendon Murphy. See LICENSE for details.