capistrano-graphite 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/README.md +26 -14
- data/capistrano-graphite.gemspec +4 -1
- data/lib/capistrano/graphite.rb +21 -11
- data/lib/capistrano/graphite/version.rb +1 -1
- data/spec/README.md +0 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70d0ed119d1db1f582739a0c79a67738d70868da
|
4
|
+
data.tar.gz: 6ee519436aab9d5aacfb09fa9e33c01cbd290ed9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58570d882766488334b815965e85713b25efd6398901fe7288302d1c623db36f03f371f572c37f44042f1169699396631fb9fe34c4dc8fb2872fb9836c62bee1
|
7
|
+
data.tar.gz: 4f6ebe2ec90c0b33b43d033c21f1b3a1b4a219aef84760956f366895f9d903a8384f60e9512242f8506c6c647ecc04fe74b001aad7e44a01a235af1a79d8b989
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,20 +1,26 @@
|
|
1
1
|
# Capistrano::Graphite
|
2
2
|
[![Gem Version](http://img.shields.io/gem/v/capistrano-graphite.svg)][gem]
|
3
|
+
[![Dependency Status](http://img.shields.io/gemnasium/scottsuch/capistrano-graphite.svg)][gemnasium]
|
3
4
|
[![Build Status](http://img.shields.io/travis/scottsuch/capistrano-graphite.svg)][travis]
|
4
5
|
[![Code Climate](http://img.shields.io/codeclimate/github/scottsuch/capistrano-graphite.svg)][codeclimate]
|
5
6
|
|
6
7
|
[gem]: https://rubygems.org/gems/capistrano-graphite
|
8
|
+
[gemnasium]: https://gemnasium.com/scottsuch/capistrano-graphite
|
7
9
|
[travis]: http://travis-ci.org/scottsuch/capistrano-graphite
|
8
|
-
[codeclimate]: https://codeclimate.com/
|
9
|
-
This gem
|
10
|
+
[codeclimate]: https://codeclimate.com/github/scottsuch/capistrano-graphite
|
11
|
+
This gem works with Capistrano v3.1.0 and above and was based off the work on [this gem](For a gem that works with older versions of Capistrano look [here](https://github.com/hellvinz/graphite-notify) which works with Capistrano v2.x.
|
12
|
+
|
13
|
+
Adding this gem to [Capistrano](https://github.com/capistrano/capistrano) deploy extends functionality by pushing events to graphite.
|
10
14
|
Currently events are only pushed after ```deploy:updated``` and ```deploy:reverted```.
|
11
|
-
|
12
|
-
|
13
|
-
For a gem that works with older versions of capistrano go [here](https://github.com/hellvinz/graphite-notify).
|
15
|
+
|
16
|
+
Some information on events can be found in [this article](http://obfuscurity.com/2014/01/Graphite-Tip-A-Better-Way-to-Store-Events).
|
14
17
|
|
15
18
|
## Installation
|
19
|
+
Install it manually:
|
16
20
|
|
17
|
-
|
21
|
+
$ gem install capistrano-graphite
|
22
|
+
|
23
|
+
Otherwise, add this line to your application's Gemfile:
|
18
24
|
|
19
25
|
gem 'capistrano-graphite'
|
20
26
|
|
@@ -22,23 +28,29 @@ And then execute:
|
|
22
28
|
|
23
29
|
$ bundle
|
24
30
|
|
25
|
-
|
31
|
+
## Usage
|
32
|
+
### Setup your application
|
33
|
+
Add the following line to your ```Capfile```.
|
34
|
+
|
35
|
+
require "capistrano/graphite"
|
26
36
|
|
27
|
-
|
37
|
+
### Configurable options
|
38
|
+
Path to your graphite instance
|
28
39
|
|
29
|
-
|
40
|
+
set :graphite_url, "http://example.com:8000/events/" # The port distinction is optional
|
30
41
|
|
31
|
-
|
42
|
+
Disable sending events for a particular stage by setting the following to 0
|
32
43
|
|
33
|
-
|
44
|
+
set :graphite_enable_events, 0 # This is set to 1 by default
|
34
45
|
|
35
|
-
|
46
|
+
### Test that it's working
|
47
|
+
You can run the following on it's own assuming you have configured the graphite url
|
36
48
|
|
37
|
-
|
49
|
+
$ bundle exec cap <stage> deploy:graphite_deploy
|
38
50
|
|
39
51
|
## Contributing
|
40
52
|
|
41
|
-
1. Fork it
|
53
|
+
1. Fork it
|
42
54
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
43
55
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
44
56
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/capistrano-graphite.gemspec
CHANGED
@@ -8,13 +8,16 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Capistrano::Graphite::VERSION
|
9
9
|
spec.authors = ["scottsuch"]
|
10
10
|
spec.email = ["sgorsuch@gmail.com"]
|
11
|
-
spec.summary = %q{
|
11
|
+
spec.summary = %q{A gem for pushing graphite events via capistrano v3
|
12
|
+
deployment}
|
12
13
|
spec.description = %q{This gem plugs into the deploy task in capistrano to
|
13
14
|
help provide visibility to when deployments were
|
14
15
|
deployed.}
|
15
16
|
spec.homepage = "https://github.com/scottsuch/capistrano-graphite"
|
16
17
|
spec.license = "MIT"
|
17
18
|
|
19
|
+
spec.required_ruby_version = '> 1.9'
|
20
|
+
|
18
21
|
spec.files = `git ls-files -z`.split("\x0")
|
19
22
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
23
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
data/lib/capistrano/graphite.rb
CHANGED
@@ -4,24 +4,34 @@ require 'uri'
|
|
4
4
|
|
5
5
|
set :local_user, ENV['USER']
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
task :graphite_deploy do
|
7
|
+
class GraphiteInterface
|
8
|
+
def self.post_event(action)
|
10
9
|
uri = URI::parse("#{fetch(:graphite_url)}")
|
11
10
|
Net::HTTP.start(uri.host, uri.port) do |http|
|
12
|
-
http.post(uri.path, "{\"what\": \"
|
11
|
+
http.post(uri.path, "{\"what\": \"#{action} #{fetch(:application)} in #{fetch(:stage)}\", \"tags\": \"#{fetch(:application)},#{fetch(:stage)},#{release_timestamp},#{action}\", \"data\": \"#{fetch(:local_user)}\"}")
|
13
12
|
end
|
14
13
|
end
|
14
|
+
end
|
15
|
+
|
16
|
+
namespace :deploy do
|
17
|
+
desc 'notify graphite that a deployment occured'
|
18
|
+
task :graphite_deploy do
|
19
|
+
action = "deploy"
|
20
|
+
GraphiteInterface.post_event(action)
|
21
|
+
end
|
15
22
|
|
16
23
|
desc 'notify graphite that a rollback occured'
|
17
24
|
task :graphite_rollback do
|
18
|
-
|
19
|
-
|
20
|
-
http.post(uri.path, "{\"what\": \"rollback #{fetch(:application)} in #{fetch(:stage)}\", \"tags\": \"#{fetch(:application)},#{fetch(:stage)},#{release_timestamp},rollback\", \"data\": \"#{fetch(:local_user)}\"}")
|
21
|
-
end
|
25
|
+
action = "rollback"
|
26
|
+
GraphiteInterface.post_event(action)
|
22
27
|
end
|
23
28
|
|
24
|
-
#
|
25
|
-
|
26
|
-
|
29
|
+
# Check the graphite_enable_events option
|
30
|
+
if "#{fetch(:graphite_enable_events)}".to_i == 0
|
31
|
+
puts "No events will be sent to graphite."
|
32
|
+
else
|
33
|
+
# Set the order for these tasks
|
34
|
+
after 'deploy:updated', 'deploy:graphite_deploy'
|
35
|
+
after 'deploy:reverted', 'deploy:graphite_rollback'
|
36
|
+
end
|
27
37
|
end
|
data/spec/README.md
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-graphite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- scottsuch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -82,9 +82,9 @@ require_paths:
|
|
82
82
|
- lib
|
83
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- - "
|
85
|
+
- - ">"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version: '
|
87
|
+
version: '1.9'
|
88
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
89
|
requirements:
|
90
90
|
- - ">="
|
@@ -95,7 +95,7 @@ rubyforge_project:
|
|
95
95
|
rubygems_version: 2.2.2
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
|
-
summary:
|
98
|
+
summary: A gem for pushing graphite events via capistrano v3 deployment
|
99
99
|
test_files:
|
100
100
|
- spec/README.md
|
101
101
|
has_rdoc:
|