0.03
No commit activity in last 3 years
No release in over 3 years
Rack middleware and application to show deployed application's revision (commit)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.7.8
~> 5.5.1
~> 0.6.3
~> 10.0

Runtime

>= 0
 Project Readme

RevisionPlate

Rack application and middleware that serves endpoint returns application's REVISION.

Detail

The endpoint returns content of REVISION

Content of the endpoint wouldn't be changed even if REVISION file has changed. But it'll return 404 when it has removed.

This can be used for health check + remove from service by hand.

This gem is used in Cookpad. And seems several companies runs similar thing (e.g. GitHub).

Usage

typical Rails app

# Gemfile
gem 'revision_plate', require: 'revision_plate/rails'

then your Rails application will handle /site/sha.

rack application

# Gemfile
gem 'revision_plate'

# config.ru (middleware)
use RevisionPlate::Middleware, '/site/sha', "#{__dir__}/REVISION"

# config.ru (mount)
map '/site/sha' do
  run RevisionPlate::App.new("#{__dir__}/REVISION")
end

Test

$ echo 'deadbeef' > REVISION
$ (... start your app ...)
$ curl localhost:3000/site/sha
deadbeef
$ rm REVISION
$ curl localhost:3000/site/sha
REVISION_FILE_REMOVED

Advanced

I want to customize (Rails app)

remove require: 'revision_plate/rails' from Gemfile, then initialize RevisionPlate::App on routes:

# routes.rb
get '/site/sha' => RevisionPlate::App.new
get '/site/sha' => RevisionPlate::App.new("/path/to/my/favorite/REVISION")

Development

Testing

$ rake test

License

MIT License