capistrano-ec2tag 0.0.4 → 0.1.1
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.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.markdown +16 -31
- data/capistrano-ec2tag.gemspec +3 -3
- data/lib/capistrano/ec2tag.rb +3 -5
- 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: e5e4f95baa0aadf31397a7c07698796e0d606513
|
4
|
+
data.tar.gz: 2f14ec4406631bb8ceca262599dea454bc54a716
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47f38fc1fe9cf498fe730f806985e4e50081af8b2fd219f12498f9529e139801d1d00923ab7b857c5baec7c0e9d4a53fa2d3e97adfd96b146d55b11971c0e2da
|
7
|
+
data.tar.gz: c39ec1c7c7fc9412f6947586d2d775417d85920e106bafe7606ccf641e023de8f8fff848cc0b7cf31efc07737eb3972631ad5cc737706e147ace5ff435a6fddc
|
data/LICENSE
CHANGED
data/README.markdown
CHANGED
@@ -4,12 +4,9 @@ capistrano-ec2tag is a [Capistrano](https://github.com/capistrano/capistrano) pl
|
|
4
4
|
task of deploying to infrastructure hosted on [Amazon EC2](http://aws.amazon.com/ec2/). It was
|
5
5
|
completely inspired by the [capistrano-ec2group](https://github.com/logandk/capistrano-ec2group) plugin, to which all credit is due.
|
6
6
|
|
7
|
-
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.
|
7
|
+
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 yet.
|
8
8
|
|
9
|
-
Using Tags instead of Security Groups gives you the ability to change
|
10
|
-
which servers get deployed to at any time, without having to reboot the
|
11
|
-
instance. This implementation is particularly useful for A/B deployments, or in
|
12
|
-
auto-scaling environments.
|
9
|
+
Using Tags instead of Security Groups gives you the ability to change which servers get deployed to at any time, without having to reboot the instance. This implementation is particularly useful for A/B deployments, or in auto-scaling environments.
|
13
10
|
|
14
11
|
## Installation
|
15
12
|
|
@@ -26,23 +23,22 @@ set :aws_secret_access_key, '...'
|
|
26
23
|
|
27
24
|
**Suggestion**
|
28
25
|
|
29
|
-
My
|
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).
|
26
|
+
My preferred method of passing Amazon AWS credentials to the different tools is to use environment variables. A trick I picked up from the [Chef help site](http://help.opscode.com/discussions/questions/246-best-practices-for-multiple-developers-kniferb-in-chef-repo-or-not).
|
32
27
|
|
33
28
|
In my `~/.zshrc` I have:
|
34
29
|
|
30
|
+
|
35
31
|
```zsh
|
36
|
-
#
|
32
|
+
# aws credentials
|
37
33
|
export AWS_ACCESS_KEY_ID='...'
|
38
34
|
export AWS_SECRET_ACCESS_KEY='...'
|
39
35
|
```
|
40
36
|
|
41
37
|
Then, in a `~/.caprc` I do the following:
|
42
38
|
|
43
|
-
```ruby
|
44
|
-
set :aws_access_key_id,
|
45
|
-
set :aws_secret_access_key,
|
39
|
+
``` ruby
|
40
|
+
set :aws_access_key_id, ENV['AWS_ACCESS_KEY_ID']
|
41
|
+
set :aws_secret_access_key, ENV['AWS_SECRET_ACCESS_KEY']
|
46
42
|
```
|
47
43
|
|
48
44
|
### Get the gem
|
@@ -59,20 +55,14 @@ gem install capistrano-ec2tag
|
|
59
55
|
|
60
56
|
Using [bundler](http://gembundler.com/)?
|
61
57
|
|
62
|
-
```
|
63
|
-
gem install bundler
|
64
|
-
```
|
65
|
-
|
66
|
-
Then add the following to your Gemfile:
|
67
|
-
|
68
|
-
```ruby
|
58
|
+
``` ruby
|
69
59
|
source 'http://rubygems.org'
|
70
60
|
gem 'capistrano-ec2tag'
|
71
61
|
```
|
72
62
|
|
73
63
|
Install the gems in your manifest using:
|
74
64
|
|
75
|
-
```bash
|
65
|
+
``` bash
|
76
66
|
bundle install
|
77
67
|
```
|
78
68
|
|
@@ -80,16 +70,14 @@ bundle install
|
|
80
70
|
|
81
71
|
### Tag your instances
|
82
72
|
|
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.
|
73
|
+
Using the Amazon EC2 API or the AWS Management Console, add a `deploy` tag to all the instances you want Capistrano to deploy to.
|
85
74
|
|
86
|
-
The value can be any string, but I do recommend it be both unique and
|
87
|
-
easy to recognize. 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.
|
75
|
+
The value can be any string, but I do recommend it be both unique and easy to recognize. 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
76
|
|
89
77
|
Personally, we use the folowing convention:
|
90
78
|
|
91
79
|
```
|
92
|
-
|
80
|
+
APP-ENVIRONMENT
|
93
81
|
```
|
94
82
|
|
95
83
|
### Configure Capistrano
|
@@ -98,19 +86,16 @@ ENVIRONMENT-APP-STACK
|
|
98
86
|
require 'capistrano/ec2tag'
|
99
87
|
|
100
88
|
task :production do
|
101
|
-
tag '
|
102
|
-
tag 'production-github-job', :job
|
89
|
+
tag 'github-production', :web
|
103
90
|
logger.info 'Deploying to the PRODUCTION environment!'
|
104
91
|
end
|
105
92
|
|
106
93
|
task :staging do
|
107
|
-
tag '
|
108
|
-
tag 'staging-github-job', :job
|
94
|
+
tag 'github-staging', :web
|
109
95
|
logger.info 'Deploying to the STAGING environment!'
|
110
96
|
end
|
111
97
|
```
|
112
98
|
|
113
99
|
## License
|
114
100
|
|
115
|
-
capistrano-ec2tag is copyright
|
116
|
-
|
101
|
+
capistrano-ec2tag is copyright 2013 by [Douglas Jarquin](http://douglasjarquin.com/), released under the MIT License (see LICENSE for details).
|
data/capistrano-ec2tag.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'capistrano-ec2tag'
|
6
|
-
s.version = '0.
|
6
|
+
s.version = '0.1.1'
|
7
7
|
s.authors = ['Douglas Jarquin']
|
8
8
|
s.email = ['douglasjarquin@me.com']
|
9
9
|
s.homepage = 'https://github.com/douglasjarquin/capistrano-ec2tag'
|
@@ -17,6 +17,6 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
s.require_paths = ['lib']
|
19
19
|
|
20
|
-
s.add_dependency 'capistrano', '>=2.
|
21
|
-
s.add_dependency 'aws-sdk'
|
20
|
+
s.add_dependency 'capistrano', '>=2.14.2'
|
21
|
+
s.add_dependency 'aws-sdk', '>=1.8.5'
|
22
22
|
end
|
data/lib/capistrano/ec2tag.rb
CHANGED
@@ -9,12 +9,11 @@ module Capistrano
|
|
9
9
|
module Tags
|
10
10
|
|
11
11
|
def tag(which, *args)
|
12
|
-
@ec2 ||= AWS::EC2.new({access_key_id: fetch(:aws_access_key_id), secret_access_key: fetch(:aws_secret_access_key)}.merge! fetch(:aws_params))
|
12
|
+
@ec2 ||= AWS::EC2.new({access_key_id: fetch(:aws_access_key_id), secret_access_key: fetch(:aws_secret_access_key)}.merge! fetch(:aws_params, {}))
|
13
13
|
|
14
|
-
@ec2.instances.filter('tag-key','deploy').filter('tag-value', which).each
|
14
|
+
@ec2.instances.filter('tag-key', 'deploy').filter('tag-value', which).each do |instance|
|
15
15
|
server instance.dns_name || instance.ip_address, *args if instance.status == :running
|
16
|
-
|
17
|
-
|
16
|
+
end
|
18
17
|
end
|
19
18
|
|
20
19
|
end
|
@@ -22,4 +21,3 @@ module Capistrano
|
|
22
21
|
include Tags
|
23
22
|
end
|
24
23
|
end
|
25
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-ec2tag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Douglas Jarquin
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.14.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.14.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: aws-sdk
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.8.5
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.8.5
|
41
41
|
description: capistrano-ec2tag is a Capistrano plugin designed to simplify the task
|
42
42
|
of deploying to infrastructure hosted on Amazon EC2. It was completely inspired
|
43
43
|
by the capistrano-ec2group plugin, to which all credit is due.
|