Capistrano::Graphite
This gem works with Capistrano v3.0.0 and above and was based off the work on this gem which works with Capistrano v2.x.
Adding this gem to Capistrano extends functionality by pushing events to graphite upon deployment and rollback.
Currently events are only pushed after deploy:updated
and deploy:reverted
.
Some information on events can be found in this article.
Installation
Install it manually:
$ gem install capistrano-graphite
Otherwise, add this line to your application's Gemfile:
gem 'capistrano-graphite'
And then execute:
$ bundle
Usage
Setup your application
Add the following line to your Capfile
.
require "capistrano/graphite"
Configurable options
Path to your graphite instance. Port and user:password are optional.
set :graphite_url, "http://user:password@example.com:8000/events/"
Disable sending events for a particular stage by setting the following:
set :suppress_graphite_events, "true" # This is set to false by default
Note that the config graphite_enable_events
was deprecated in version 1.0.0.
Optionally, override the rest of graphite settings:
set :graphite_event_user, ENV.fetch('USER', 'unknown')
set :graphite_event_data, -> { fetch(:graphite_event_user) }
set :graphite_event_tags, -> (action) do
[fetch(:application), fetch(:stage), release_timestamp, action].join(',')
end
set :graphite_event_msg, -> (action) do
"#{action} #{fetch(:application)} in #{fetch(:stage)}"
end
Test that it's working
You can run the following on it's own assuming you have configured the graphite url
$ bundle exec cap <stage> deploy:post_graphite['deploy']
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request