capistrano-ec2tag 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in capistrano-ec2tag.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2011 by Douglas Jarquin
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,110 @@
1
+ # capistrano-ec2tag
2
+
3
+ A Capistrano plugin aimed at easing the pain of deploying to Amazon EC2
4
+ instances by using a simple "deploy" tag.
5
+
6
+ ## Introduction
7
+
8
+ capistrano-ec2tag is a [Capistrano](https://github.com/capistrano/capistrano) plugin designed to simplify the
9
+ task of deploying to infrastructure hosted on [Amazon EC2](http://aws.amazon.com/ec2/). It was
10
+ completely inspired by the [capistrano-ec2group](https://github.com/logandk/capistrano-ec2group) plugin, to which all credit is due.
11
+
12
+ While the original [capistrano-ec2group](https://github.com/logandk/capistrano-ec2group) plugin served me well, I started to run into limitations pretty quickly. I will say that at the time that the capistrano-ec2group plugin was written, I don't think Amazon EC2 supported tags.
13
+
14
+ ## Installation
15
+
16
+ ### Set the Amazon AWS Credentials
17
+
18
+ In order for the plugin to list out hostnames of your EC2 instances, it
19
+ will need access to the Amazon EC2 API. Specify the following in your
20
+ Capistrano configuration:
21
+
22
+ ```ruby
23
+ set :aws_access_key_id, '...'
24
+ set :aws_secret_access_key, '...'
25
+ ```
26
+
27
+ **Suggestion**
28
+
29
+ My prefferred method of passing Amazon AWS credentials to the different
30
+ tools is to use environment variables. A trick I picked up from the [Chef
31
+ help site](http://help.opscode.com/discussions/questions/246-best-practices-for-multiple-developers-kniferb-in-chef-repo-or-not).
32
+
33
+ In my ~/.zshrc I have:
34
+
35
+ ```zsh
36
+ # Set the Amazon AWS credentials as environment variables
37
+ export AWS_ACCESS_KEY_ID='...'
38
+ export AWS_SECRET_ACCESS_KEY='...'
39
+ ```
40
+
41
+ Then, in my ~/.caprc I do the following:
42
+
43
+ ```ruby
44
+ set :aws_access_key_id, $AWS_ACCESS_KEY_ID
45
+ set :aws_secret_access_key, $AWS_SECRET_ACCESS_KEY
46
+ ```
47
+
48
+ ### Get the gem
49
+
50
+ The plugin is distributed as a Ruby gem.
51
+
52
+ **Ruby Gems**
53
+
54
+ ```bash
55
+ gem install capistrano-ec2tag
56
+ ```
57
+
58
+ **Bundler**
59
+
60
+ Using [bundler](http://gembundler.com/)?
61
+
62
+ ```bash
63
+ gem install bundler
64
+ ```
65
+
66
+ Then add the following to your Gemfile:
67
+
68
+ ```ruby
69
+ source "http://rubygems.org"
70
+ gem "capistrano-ec2tag"
71
+ ```
72
+
73
+ Install the gems in your manifest using:
74
+
75
+ ```bash
76
+ bundle install
77
+ ```
78
+
79
+ ## Usage
80
+
81
+ ### Tag your instances
82
+
83
+ Using the Amazon EC2 API or the AWS Management Console, add a `deploy`
84
+ tag to all the instances you want Capistrano to deploy to.
85
+
86
+ The value can be any string, but I do recommend it be both unique and
87
+ somehow explicit to the type of server this is. If you have used the [capistrano-ec2group](https://github.com/logandk/capistrano-ec2group), then this might be equal to whatever security group names you use.
88
+
89
+ ### Configure Capistrano
90
+
91
+ ```ruby
92
+ require 'capistrano/ec2tag'
93
+
94
+ task :production do
95
+ tag "production-github-web", :web
96
+ tag "production-github-job", :job
97
+ logger.info "Deploying to the PRODUCTION environment!"
98
+ end
99
+
100
+ task :staging do
101
+ tag "staging-github-web", :web
102
+ tag "staging-github-job", :job
103
+ logger.info "Deploying to the STAGING environment!"
104
+ end
105
+ ```
106
+
107
+ ## License
108
+
109
+ capistrano-ec2tag is copyright 2011 by [Douglas Jarquin](http://www.douglasjarquin.com/), released under the MIT License (see LICENSE for details).
110
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "capistrano-ec2tag"
6
+ s.version = "0.0.2"
7
+ s.authors = ["Douglas Jarquin"]
8
+ s.email = ["douglasjarquin@gmail.com"]
9
+ s.homepage = "https://github.com/douglasjarquin/capistrano-ec2tag"
10
+ s.summary = "A Capistrano plugin aimed at easing the pain of deploying to Amazon EC2 instances by using a simple \"deploy\" tag."
11
+ s.description = "capistrano-ec2tag is a Capistrano plugin designed to simplify the task of deploying to infrastructure hosted on Amazon EC2. It was completely inspired by the capistrano-ec2group plugin, to which all credit is due."
12
+
13
+ s.rubyforge_project = "capistrano-ec2tag"
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_dependency "capistrano", ">=2.1.0"
21
+ s.add_dependency "right_aws"
22
+ end
@@ -0,0 +1 @@
1
+ require "capistrano/ec2tag"
@@ -0,0 +1,24 @@
1
+ require 'right_aws'
2
+
3
+ unless Capistrano::Configuration.respond_to?(:instance)
4
+ abort "capistrano/ec2tag requires Capistrano >= 2"
5
+ end
6
+
7
+ module Capistrano
8
+ class Configuration
9
+ module Tags
10
+
11
+ def tag(which, *args)
12
+ @ec2 ||= RightAws::Ec2.new(fetch(:aws_access_key_id), fetch(:aws_secret_access_key), fetch(:aws_params, {}))
13
+
14
+ @ec2.describe_instances(:filters => { "tag-key" => "deploy", "tag-value" => "#{which}" }).each do |instance|
15
+ server(instance[:dns_name], *args) unless instance[:aws_state] != "running"
16
+ end
17
+ end
18
+
19
+ end
20
+
21
+ include Tags
22
+ end
23
+ end
24
+
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-ec2tag
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Douglas Jarquin
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-09-21 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: capistrano
16
+ requirement: &2158098480 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 2.1.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2158098480
25
+ - !ruby/object:Gem::Dependency
26
+ name: right_aws
27
+ requirement: &2158098080 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *2158098080
36
+ description: capistrano-ec2tag is a Capistrano plugin designed to simplify the task
37
+ of deploying to infrastructure hosted on Amazon EC2. It was completely inspired
38
+ by the capistrano-ec2group plugin, to which all credit is due.
39
+ email:
40
+ - douglasjarquin@gmail.com
41
+ executables: []
42
+ extensions: []
43
+ extra_rdoc_files: []
44
+ files:
45
+ - .gitignore
46
+ - Gemfile
47
+ - LICENSE
48
+ - README.markdown
49
+ - Rakefile
50
+ - capistrano-ec2tag.gemspec
51
+ - lib/capistrano-ec2tag.rb
52
+ - lib/capistrano/ec2tag.rb
53
+ homepage: https://github.com/douglasjarquin/capistrano-ec2tag
54
+ licenses: []
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project: capistrano-ec2tag
73
+ rubygems_version: 1.8.10
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: A Capistrano plugin aimed at easing the pain of deploying to Amazon EC2 instances
77
+ by using a simple "deploy" tag.
78
+ test_files: []