Skip to content

Show the release_hashref file from a Cartage package

License

Notifications You must be signed in to change notification settings

richardsondx/cartage-rack

 
 

Repository files navigation

cartage-rack by Kinetic Cafe

code

github.com/KineticCafe/cartage-rack/

issues

github.com/KineticCafe/cartage-rack/issues

continuous integration

<img src=“https://travis-ci.org/KineticCafe/cartage-rack.png” />

Description

cartage-rack is a plug-in for cartage to provide a Rack application.

Cartage provides a repeatable means to create a package for a Rails application that can be used in deployment with a configuration tool like Ansible, Chef, Puppet, or Salt. The package is created with its dependencies bundled in vendor/bundle, so it can be deployed in environments with strict access control rules and without requiring development tool access.

Synopsis

Cartage::Rack provides a Rack application generator to read and return the release_hashref from an endpoint to verify that the server was deployed. This endpoint supports both JSON and plaintext output. To add this to a Rails application, simply mount it in config/routes.rb:

require 'cartage/rack'

Rails.application.routes.draw do
  get '/release' => Cartage::Rack.mount(Rails.root)
end

Or map it in a normal Rack application in config.ru:

require 'cartage/rack'
map('/release') do
  run Cartage::Rack.mount(Dir.pwd)
end

It can then be queried easily:

% rails start
% curl localhost:3000/release
development: (git) main
% curl localhost:3000/release.json | jshon
{
  "env" : "development",
  "release_hashref" : "(git) main"
}

If there is a release_hashref file, the value returned will be from this file. There are two versions of release_hashref files supported; the original format (Cartage 1.0 and 1.1) has one line (just the hashref of the release). The new format has two lines, the hashref of the release and the timestamp of the release.

% curl localhost:3000/release.json | jshon
{
  "env" : "production",
  "release_hashref" : "134458c3e3c02dd7c1cac8d5d41d85ce1e4decab"
  "timestamp" : "20150411001143"
}

Install

Add cartage-rack to your Gemfile:

gem 'cartage-rack', '~> 1.1'

Or manually install:

% gem install cartage-rack

cartage-rack Semantic Versioning

cartage-rack uses a Semantic Versioning scheme with one change:

  • When PATCH is zero (0), it will be omitted from version references.

cartage-rack will generally track cartage for major versions to ensure plugin API compatibility.

:include: Contributing.rdoc

:include: Licence.rdoc

About

Show the release_hashref file from a Cartage package

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%