capify-ec2 1.1.15 → 1.1.16.pre
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/Changelog.md +12 -0
- data/lib/capify-ec2.rb +8 -0
- data/lib/capify-ec2/capistrano.rb +4 -2
- data/lib/capify-ec2/version.rb +1 -1
- data/readme.md +81 -52
- metadata +12 -9
data/Changelog.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 1.1.16 (Sep 23, 2011)
|
2
|
+
|
3
|
+
Features:
|
4
|
+
|
5
|
+
- Added 'option' handling. Allows users to move cap options ('cron,' 'db,' 'resque,' etc.) to 'Option' field at AWS.
|
6
|
+
|
7
|
+
## 1.1.15 (Sep 02, 2011)
|
8
|
+
|
9
|
+
Bugfixes:
|
10
|
+
|
11
|
+
- Fixed problem with ec2:ssh task not terminating properly
|
12
|
+
|
1
13
|
## 1.1.14 (Aug 24, 2011)
|
2
14
|
|
3
15
|
Bugfixes:
|
data/lib/capify-ec2.rb
CHANGED
@@ -40,6 +40,14 @@ class CapifyEc2
|
|
40
40
|
end
|
41
41
|
roles
|
42
42
|
end
|
43
|
+
def options
|
44
|
+
option = case_insensitive_tag("Option")
|
45
|
+
options = option.nil? ? [] : [option]
|
46
|
+
if (options_tag = case_insensitive_tag("Options"))
|
47
|
+
options += case_insensitive_tag("Options").split(/\s*,\s*/)
|
48
|
+
end
|
49
|
+
options
|
50
|
+
end
|
43
51
|
end
|
44
52
|
instances << instance
|
45
53
|
end
|
@@ -113,9 +113,10 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def define_role(role, instance)
|
116
|
-
|
116
|
+
options = role[:options]
|
117
117
|
new_options = {}
|
118
|
-
|
118
|
+
options.each {|key, value| new_options[key] = true if value.to_s == instance.name}
|
119
|
+
instance.options.each {|option| new_options[option.to_sym] = true}
|
119
120
|
|
120
121
|
if new_options
|
121
122
|
role role[:name].to_sym, instance.dns_name, new_options
|
@@ -132,4 +133,5 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
132
133
|
roles.reject! { true }
|
133
134
|
end
|
134
135
|
|
136
|
+
|
135
137
|
end
|
data/lib/capify-ec2/version.rb
CHANGED
data/readme.md
CHANGED
@@ -5,7 +5,7 @@ capify-ec2 is used to generate capistrano namespaces using ec2 tags.
|
|
5
5
|
|
6
6
|
eg: If you have three servers on amazon's ec2.
|
7
7
|
|
8
|
-
server-1 Tag: Role => "web"
|
8
|
+
server-1 Tag: Role => "web", Options => "cron, resque"
|
9
9
|
server-2 Tag: Role => "db"
|
10
10
|
server-3 Tag: Roles => "web, db"
|
11
11
|
|
@@ -15,74 +15,91 @@ Installing
|
|
15
15
|
|
16
16
|
In your deploy.rb:
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
```ruby
|
19
|
+
require "capify-ec2/capistrano"
|
20
|
+
ec2_roles :web
|
21
|
+
```
|
20
22
|
|
21
23
|
Will generate
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
25
|
+
```ruby
|
26
|
+
task :server-1 do
|
27
|
+
role :web, {server-1 public dns fetched from Amazon}, :cron=>true, :resque=>true
|
28
|
+
end
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
+
task :server-3 do
|
31
|
+
role :web, {server-1 public dns fetched from Amazon}
|
32
|
+
end
|
30
33
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
task :web do
|
35
|
+
role :web, {server-1 public dns fetched from Amazon}, :cron=>true, :resque=>true
|
36
|
+
role :web, {server-3 public dns fetched from Amazon}
|
37
|
+
end
|
38
|
+
```
|
35
39
|
|
36
40
|
Additionally
|
37
41
|
|
38
|
-
|
39
|
-
|
42
|
+
```ruby
|
43
|
+
require "capify-ec2/capistrano"
|
44
|
+
ec2_roles :db
|
45
|
+
```
|
40
46
|
|
41
47
|
Will generate
|
42
48
|
|
43
|
-
|
44
|
-
|
45
|
-
|
49
|
+
```ruby
|
50
|
+
task :server-2 do
|
51
|
+
role :db, {server-2 public dns fetched from Amazon}
|
52
|
+
end
|
46
53
|
|
47
|
-
|
48
|
-
|
49
|
-
|
54
|
+
task :server-3 do
|
55
|
+
role :db, {server-3 public dns fetched from Amazon}
|
56
|
+
end
|
50
57
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
58
|
+
task :db do
|
59
|
+
role :db, {server-2 public dns fetched from Amazon}
|
60
|
+
role :db, {server-3 public dns fetched from Amazon}
|
61
|
+
end
|
62
|
+
```
|
55
63
|
|
56
64
|
Running
|
57
65
|
|
58
|
-
|
66
|
+
```ruby
|
67
|
+
cap web date
|
68
|
+
```
|
59
69
|
|
60
70
|
will run the date command on all server's tagged with the web role
|
61
71
|
|
62
72
|
Running
|
63
73
|
|
64
|
-
|
74
|
+
```ruby
|
75
|
+
cap server-1 ec2:register-instance -s loadbalancer=elb-1
|
76
|
+
```
|
65
77
|
|
66
78
|
will register server-1 to be used by elb-1
|
67
79
|
|
68
80
|
Running
|
69
81
|
|
70
|
-
|
82
|
+
```ruby
|
83
|
+
cap server-1 ec2:deregister-instance
|
84
|
+
```
|
71
85
|
|
72
86
|
will remove server-1 from whatever instance it is currently
|
73
87
|
registered against.
|
74
88
|
|
75
89
|
Running
|
76
|
-
|
77
|
-
cap ec2:status
|
78
90
|
|
91
|
+
```ruby
|
92
|
+
cap ec2:status
|
93
|
+
```
|
79
94
|
|
80
95
|
will list the currently running servers and their associated details
|
81
96
|
(public dns, instance id, roles etc)
|
82
97
|
|
83
98
|
Running
|
84
99
|
|
85
|
-
|
100
|
+
```ruby
|
101
|
+
cap ec2:ssh #
|
102
|
+
```
|
86
103
|
|
87
104
|
will launch ssh using the user and port specified in your configuration.
|
88
105
|
The # argument is the index of the server to ssh into. Use the 'ec2:status'
|
@@ -91,37 +108,47 @@ command to see the list of servers with their indices.
|
|
91
108
|
More options
|
92
109
|
====================================================
|
93
110
|
|
94
|
-
|
111
|
+
In addition to specifying options (e.g. 'cron') at the server level, it is also possible to specify it at the project level.
|
112
|
+
Use with caution! This does not work with autoscaling.
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
ec2_roles {:name=>"web", :options=>{:cron=>"server-1"}}
|
116
|
+
```
|
95
117
|
|
96
118
|
Will generate
|
97
119
|
|
98
|
-
|
99
|
-
|
100
|
-
|
120
|
+
```ruby
|
121
|
+
task :server-1 do
|
122
|
+
role :web, {server-1 public dns fetched from Amazon}, :cron=>true
|
123
|
+
end
|
101
124
|
|
102
|
-
|
103
|
-
|
104
|
-
|
125
|
+
task :server-3 do
|
126
|
+
role :web, {server-1 public dns fetched from Amazon}
|
127
|
+
end
|
105
128
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
129
|
+
task :web do
|
130
|
+
role :web, {server-1 public dns fetched from Amazon}, :cron=>true
|
131
|
+
role :web, {server-3 public dns fetched from Amazon}
|
132
|
+
end
|
133
|
+
```
|
110
134
|
|
111
135
|
Which is cool if you want a task like this in deploy.rb
|
112
136
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
137
|
+
```ruby
|
138
|
+
task :update_cron => :web, :only=>{:cron} do
|
139
|
+
Do something to a server with cron on it
|
140
|
+
end
|
117
141
|
|
118
142
|
ec2_roles :name=>:web, :options=>{ :default => true }
|
143
|
+
```
|
119
144
|
|
120
145
|
Will make :web the default role so you can just type 'cap deploy'.
|
121
146
|
Multiple roles can be defaults so:
|
122
147
|
|
148
|
+
```ruby
|
123
149
|
ec2_roles :name=>:web, :options=>{ :default => true }
|
124
150
|
ec2_roles :name=>:app, :options=>{ :default => true }
|
151
|
+
```
|
125
152
|
|
126
153
|
would be the equivalent of 'cap app web deploy'
|
127
154
|
|
@@ -131,12 +158,14 @@ Ec2 config
|
|
131
158
|
This gem requires 'config/ec2.yml' in your project.
|
132
159
|
The yml file needs to look something like this:
|
133
160
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
161
|
+
```ruby
|
162
|
+
:aws_access_key_id: "YOUR ACCESS KEY"
|
163
|
+
:aws_secret_access_key: "YOUR SECRET"
|
164
|
+
:aws_params:
|
165
|
+
:region: 'eu-west-1'
|
166
|
+
:load_balanced: true
|
167
|
+
:project_tag: "YOUR APP NAME"
|
168
|
+
```
|
140
169
|
|
141
170
|
The :aws_params are optional.
|
142
171
|
If :load_balanced is set to true, the gem uses pre and post-deploy
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capify-ec2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 961915932
|
5
|
+
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
|
9
|
+
- 16
|
10
|
+
- pre
|
11
|
+
version: 1.1.16.pre
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Noah Cantor
|
@@ -16,7 +17,7 @@ autorequire:
|
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
19
|
|
19
|
-
date: 2011-09-
|
20
|
+
date: 2011-09-23 00:00:00 +01:00
|
20
21
|
default_executable:
|
21
22
|
dependencies:
|
22
23
|
- !ruby/object:Gem::Dependency
|
@@ -108,12 +109,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
110
|
none: false
|
110
111
|
requirements:
|
111
|
-
- - "
|
112
|
+
- - ">"
|
112
113
|
- !ruby/object:Gem::Version
|
113
|
-
hash:
|
114
|
+
hash: 25
|
114
115
|
segments:
|
115
|
-
-
|
116
|
-
|
116
|
+
- 1
|
117
|
+
- 3
|
118
|
+
- 1
|
119
|
+
version: 1.3.1
|
117
120
|
requirements: []
|
118
121
|
|
119
122
|
rubyforge_project: capify-ec2
|