opendelivery 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/opendelivery.rb +22 -0
- data/lib/opendelivery/domain.rb +22 -0
- data/lib/opendelivery/machine_image.rb +22 -0
- data/lib/opendelivery/source_control.rb +22 -0
- data/lib/opendelivery/stack.rb +24 -2
- data/lib/opendelivery/storage.rb +22 -0
- data/lib/opsworks.rb +280 -0
- metadata +14 -61
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9562a9c0e627bb45347a5fbfe5b0aaba410cbc91
|
4
|
+
data.tar.gz: 42c260add6ebf8ee5e07955126940ea8b31c95ca
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4b34afebb55cdbf69342de9263e4bafe669e4c0665fa4b9cd31cb0f2debbe94d641c2093040c5bf44137f19c5197624af66024b117cd50894b8d4459dc793186
|
7
|
+
data.tar.gz: d62bb83d8cdd73f05993efc90b02170a9e0cd602bc70c5c16286e16724e4c1365835d65681dea0d3885035a70f1d1715ebc37c24fad48ea96bbe4aa603af19cc
|
data/lib/opendelivery.rb
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
#Copyright (c) 2014 Stelligent Systems LLC
|
2
|
+
#
|
3
|
+
#MIT LICENSE
|
4
|
+
#
|
5
|
+
#Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
#of this software and associated documentation files (the "Software"), to deal
|
7
|
+
#in the Software without restriction, including without limitation the rights
|
8
|
+
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
#copies of the Software, and to permit persons to whom the Software is
|
10
|
+
#furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
#The above copyright notice and this permission notice shall be included in
|
13
|
+
#all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
#THE SOFTWARE.
|
22
|
+
|
1
23
|
require 'opendelivery/source_control.rb'
|
2
24
|
require 'opendelivery/domain.rb'
|
3
25
|
require 'opendelivery/machine_image.rb'
|
data/lib/opendelivery/domain.rb
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
#Copyright (c) 2014 Stelligent Systems LLC
|
2
|
+
#
|
3
|
+
#MIT LICENSE
|
4
|
+
#
|
5
|
+
#Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
#of this software and associated documentation files (the "Software"), to deal
|
7
|
+
#in the Software without restriction, including without limitation the rights
|
8
|
+
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
#copies of the Software, and to permit persons to whom the Software is
|
10
|
+
#furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
#The above copyright notice and this permission notice shall be included in
|
13
|
+
#all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
#THE SOFTWARE.
|
22
|
+
|
1
23
|
require 'aws-sdk'
|
2
24
|
require 'encrypto_signo'
|
3
25
|
|
@@ -1,3 +1,25 @@
|
|
1
|
+
#Copyright (c) 2014 Stelligent Systems LLC
|
2
|
+
#
|
3
|
+
#MIT LICENSE
|
4
|
+
#
|
5
|
+
#Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
#of this software and associated documentation files (the "Software"), to deal
|
7
|
+
#in the Software without restriction, including without limitation the rights
|
8
|
+
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
#copies of the Software, and to permit persons to whom the Software is
|
10
|
+
#furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
#The above copyright notice and this permission notice shall be included in
|
13
|
+
#all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
#THE SOFTWARE.
|
22
|
+
|
1
23
|
require 'aws-sdk'
|
2
24
|
|
3
25
|
module OpenDelivery
|
@@ -1,3 +1,25 @@
|
|
1
|
+
#Copyright (c) 2014 Stelligent Systems LLC
|
2
|
+
#
|
3
|
+
#MIT LICENSE
|
4
|
+
#
|
5
|
+
#Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
#of this software and associated documentation files (the "Software"), to deal
|
7
|
+
#in the Software without restriction, including without limitation the rights
|
8
|
+
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
#copies of the Software, and to permit persons to whom the Software is
|
10
|
+
#furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
#The above copyright notice and this permission notice shall be included in
|
13
|
+
#all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
#THE SOFTWARE.
|
22
|
+
|
1
23
|
module OpenDelivery
|
2
24
|
class SourceControl
|
3
25
|
def initialize(dir)
|
data/lib/opendelivery/stack.rb
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
#Copyright (c) 2014 Stelligent Systems LLC
|
2
|
+
#
|
3
|
+
#MIT LICENSE
|
4
|
+
#
|
5
|
+
#Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
#of this software and associated documentation files (the "Software"), to deal
|
7
|
+
#in the Software without restriction, including without limitation the rights
|
8
|
+
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
#copies of the Software, and to permit persons to whom the Software is
|
10
|
+
#furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
#The above copyright notice and this permission notice shall be included in
|
13
|
+
#all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
#THE SOFTWARE.
|
22
|
+
|
1
23
|
require 'aws-sdk'
|
2
24
|
|
3
25
|
module OpenDelivery
|
@@ -48,7 +70,7 @@ module OpenDelivery
|
|
48
70
|
|
49
71
|
|
50
72
|
def create(stack_name, template, parameters = {}, wait=false, domain=nil)
|
51
|
-
|
73
|
+
@cfn.stacks.create(stack_name,
|
52
74
|
File.open(template, "r").read,
|
53
75
|
:parameters => parameters,
|
54
76
|
:capabilities => ["CAPABILITY_IAM"],
|
@@ -142,7 +164,7 @@ module OpenDelivery
|
|
142
164
|
rescue AWS::CloudFormation::Errors::Throttling
|
143
165
|
status = "Rate limit exceeded, retrying..."
|
144
166
|
print_status(status, silent)
|
145
|
-
sleep
|
167
|
+
sleep(sleep_time * 0.1)
|
146
168
|
end
|
147
169
|
if keep_watching
|
148
170
|
sleep(sleep_time)
|
data/lib/opendelivery/storage.rb
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
#Copyright (c) 2014 Stelligent Systems LLC
|
2
|
+
#
|
3
|
+
#MIT LICENSE
|
4
|
+
#
|
5
|
+
#Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
#of this software and associated documentation files (the "Software"), to deal
|
7
|
+
#in the Software without restriction, including without limitation the rights
|
8
|
+
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
#copies of the Software, and to permit persons to whom the Software is
|
10
|
+
#furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
#The above copyright notice and this permission notice shall be included in
|
13
|
+
#all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
#THE SOFTWARE.
|
22
|
+
|
1
23
|
require 'aws-sdk'
|
2
24
|
|
3
25
|
module OpenDelivery
|
data/lib/opsworks.rb
ADDED
@@ -0,0 +1,280 @@
|
|
1
|
+
#Copyright (c) 2014 Stelligent Systems LLC
|
2
|
+
#
|
3
|
+
#MIT LICENSE
|
4
|
+
#
|
5
|
+
#Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
#of this software and associated documentation files (the "Software"), to deal
|
7
|
+
#in the Software without restriction, including without limitation the rights
|
8
|
+
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
#copies of the Software, and to permit persons to whom the Software is
|
10
|
+
#furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
#The above copyright notice and this permission notice shall be included in
|
13
|
+
#all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
#THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'aws-sdk'
|
24
|
+
|
25
|
+
module OpsWorks
|
26
|
+
|
27
|
+
def create_and_launch_stack(stack_description)
|
28
|
+
stack_id = create_stack(stack_description)
|
29
|
+
launch_stack(stack_id)
|
30
|
+
deploy_apps(stack_id)
|
31
|
+
stack_id
|
32
|
+
end
|
33
|
+
|
34
|
+
def create_and_launch_stack_in_order(stack_description, layers_by_order)
|
35
|
+
stack_id = create_stack(stack_description)
|
36
|
+
launch_stack_in_order(stack_id, layers_by_order)
|
37
|
+
deploy_apps(stack_id)
|
38
|
+
stack_id
|
39
|
+
end
|
40
|
+
|
41
|
+
def create_stack(stack_description)
|
42
|
+
opsworks_client = AWS::OpsWorks::Client::V20130218.new
|
43
|
+
|
44
|
+
response = opsworks_client.create_stack(stack_description.stack_description)
|
45
|
+
stack_id = response[:stack_id]
|
46
|
+
|
47
|
+
stack_description.layer_descriptions.each do |layer_description|
|
48
|
+
layer_description[:layer][:stack_id] = stack_id
|
49
|
+
|
50
|
+
response = opsworks_client.create_layer(layer_description[:layer])
|
51
|
+
layer_id = response[:layer_id]
|
52
|
+
|
53
|
+
layer_description[:instances].each do |instance_description|
|
54
|
+
instance_description[:stack_id] = stack_id
|
55
|
+
instance_description[:layer_ids] = [layer_id]
|
56
|
+
response = opsworks_client.create_instance(instance_description)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
stack_description.app_descriptions.each do |app_description|
|
61
|
+
app_description[:stack_id] = stack_id
|
62
|
+
response = opsworks_client.create_app(app_description)
|
63
|
+
end
|
64
|
+
|
65
|
+
stack_id
|
66
|
+
end
|
67
|
+
|
68
|
+
def launch_stack(stack_id)
|
69
|
+
opsworks_client = AWS::OpsWorks::Client::V20130218.new
|
70
|
+
|
71
|
+
opsworks_client.start_stack(:stack_id => stack_id)
|
72
|
+
|
73
|
+
wait_on_setup(stack_id)
|
74
|
+
|
75
|
+
wait_on_all_configures(stack_id)
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
def launch_stack_in_order(stack_id, layers_by_order)
|
80
|
+
opsworks_client = AWS::OpsWorks::Client::V20130218.new
|
81
|
+
|
82
|
+
layers_by_order.each do |layer_names|
|
83
|
+
layer_names.each do |layer_name|
|
84
|
+
|
85
|
+
response = opsworks_client.describe_layers( :stack_id => stack_id)
|
86
|
+
layer = response[:layers].find { |layer| layer[:shortname] == layer_name }
|
87
|
+
raise "layer #{layer_name} not found in stack: #{stack_id}" if layer.nil?
|
88
|
+
|
89
|
+
response = opsworks_client.describe_instances( :layer_id => layer[:layer_id])
|
90
|
+
response[:instances].each do |instance|
|
91
|
+
opsworks_client.start_instance( :instance_id => instance[:instance_id])
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
layer_names.each do |layer_name|
|
96
|
+
response = opsworks_client.describe_layers( :stack_id => stack_id)
|
97
|
+
layer = response[:layers].find { |layer| layer[:shortname] == layer_name }
|
98
|
+
raise "layer #{layer_name} not found in stack: #{stack_id}" if layer.nil?
|
99
|
+
|
100
|
+
wait_on_layer_setup(layer[:layer_id])
|
101
|
+
wait_on_layer_configures(layer[:layer_id])
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def deploy_apps(stack_id)
|
107
|
+
deployment_ids = []
|
108
|
+
opsworks_client = AWS::OpsWorks::Client::V20130218.new
|
109
|
+
response = opsworks_client.describe_apps(:stack_id => stack_id)
|
110
|
+
response[:apps].each do |app|
|
111
|
+
|
112
|
+
puts "DEPLOYING THE APP: #{app}"
|
113
|
+
response = opsworks_client.create_deployment(:stack_id => stack_id,
|
114
|
+
:app_id => app[:app_id],
|
115
|
+
:command => {
|
116
|
+
:name => 'deploy',
|
117
|
+
:args => deployment_args_factory(app)
|
118
|
+
})
|
119
|
+
deployment_ids << response[:deployment_id]
|
120
|
+
end
|
121
|
+
|
122
|
+
max_attempts = 250
|
123
|
+
num_attempts = 0
|
124
|
+
|
125
|
+
deployments_complete = false
|
126
|
+
until deployments_complete
|
127
|
+
response = opsworks_client.describe_deployments(:deployment_ids => deployment_ids)
|
128
|
+
deployments_complete = response[:deployments].inject(true) do |status, deployment|
|
129
|
+
puts "Deployment status: #{deployment[:status]}"
|
130
|
+
|
131
|
+
if deployment[:status] == 'failed'
|
132
|
+
raise 'deployment failed'
|
133
|
+
end
|
134
|
+
|
135
|
+
status and (deployment[:status] == 'successful')
|
136
|
+
end
|
137
|
+
num_attempts += 1
|
138
|
+
if num_attempts >= max_attempts
|
139
|
+
raise 'stuck waiting on configure command max attempts'
|
140
|
+
end
|
141
|
+
sleep 10
|
142
|
+
end
|
143
|
+
deployment_ids
|
144
|
+
end
|
145
|
+
|
146
|
+
def discover_private_ips(stack_id, layer_name)
|
147
|
+
opsworks_client = AWS::OpsWorks::Client::V20130218.new
|
148
|
+
response = opsworks_client.describe_layers( :stack_id => stack_id)
|
149
|
+
layer = response[:layers].find { |layer| layer[:name] == layer_name }
|
150
|
+
raise "layer #{layer_name} not found in stack: #{stack_id}" if layer.nil?
|
151
|
+
|
152
|
+
response = opsworks_client.describe_instances( :layer_id => layer[:layer_id] )
|
153
|
+
response[:instances].collect { |instance| instance[:private_ip] }
|
154
|
+
end
|
155
|
+
|
156
|
+
def discover_public_ips(stack_id, layer_name)
|
157
|
+
opsworks_client = AWS::OpsWorks::Client::V20130218.new
|
158
|
+
response = opsworks_client.describe_layers( :stack_id => stack_id)
|
159
|
+
layer = response[:layers].find { |layer| layer[:name] == layer_name }
|
160
|
+
raise "layer #{layer_name} not found in stack: #{stack_id}" if layer.nil?
|
161
|
+
|
162
|
+
response = opsworks_client.describe_instances( :layer_id => layer[:layer_id] )
|
163
|
+
response[:instances].collect { |instance| instance[:public_ip] }
|
164
|
+
end
|
165
|
+
|
166
|
+
private
|
167
|
+
|
168
|
+
def deployment_args_factory(app)
|
169
|
+
if app[:type] == 'rails'
|
170
|
+
{
|
171
|
+
'migrate' => %w{true}
|
172
|
+
}
|
173
|
+
else
|
174
|
+
{}
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
def complete(status)
|
179
|
+
failure(status) or success(status)
|
180
|
+
end
|
181
|
+
|
182
|
+
def failure(status)
|
183
|
+
%w{setup_failed start_failed terminated connection_lost}.include? status
|
184
|
+
end
|
185
|
+
|
186
|
+
def success(status)
|
187
|
+
%w{online}.include? status
|
188
|
+
end
|
189
|
+
|
190
|
+
def wait_on_setup(stack_id)
|
191
|
+
opsworks_client = AWS::OpsWorks::Client::V20130218.new
|
192
|
+
|
193
|
+
setup_complete = false
|
194
|
+
until setup_complete
|
195
|
+
response = opsworks_client.describe_instances(:stack_id => stack_id)
|
196
|
+
setup_complete = response[:instances].inject(true) do |status, instance|
|
197
|
+
if failure(instance[:status])
|
198
|
+
raise 'setup failed'
|
199
|
+
end
|
200
|
+
|
201
|
+
instance_status(instance)
|
202
|
+
|
203
|
+
status and complete(instance[:status])
|
204
|
+
end
|
205
|
+
sleep 10
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
def wait_on_layer_setup(layer_id)
|
210
|
+
opsworks_client = AWS::OpsWorks::Client::V20130218.new
|
211
|
+
|
212
|
+
setup_complete = false
|
213
|
+
until setup_complete
|
214
|
+
response = opsworks_client.describe_instances(:layer_id => layer_id)
|
215
|
+
setup_complete = response[:instances].inject(true) do |status, instance|
|
216
|
+
if failure(instance[:status])
|
217
|
+
raise 'setup failed'
|
218
|
+
end
|
219
|
+
|
220
|
+
instance_status(instance)
|
221
|
+
|
222
|
+
status and complete(instance[:status])
|
223
|
+
end
|
224
|
+
sleep 10
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
def instance_status(instance)
|
229
|
+
puts "Instance: #{instance[:instance_id]} has status #{instance[:status]}"
|
230
|
+
end
|
231
|
+
|
232
|
+
def configure_status(configure_command)
|
233
|
+
puts "Configure command: #{configure_command}"
|
234
|
+
end
|
235
|
+
|
236
|
+
def wait_on_all_configures(stack_id)
|
237
|
+
opsworks_client = AWS::OpsWorks::Client::V20130218.new
|
238
|
+
response = opsworks_client.describe_instances(:stack_id => stack_id)
|
239
|
+
response[:instances].each do |instance|
|
240
|
+
wait_on_configure(instance[:instance_id])
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
def wait_on_layer_configures(layer_id)
|
245
|
+
opsworks_client = AWS::OpsWorks::Client::V20130218.new
|
246
|
+
response = opsworks_client.describe_instances(:layer_id => layer_id)
|
247
|
+
response[:instances].each do |instance|
|
248
|
+
wait_on_configure(instance[:instance_id])
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
def wait_on_configure(instance_id)
|
253
|
+
opsworks_client = AWS::OpsWorks::Client::V20130218.new
|
254
|
+
|
255
|
+
max_attempts = 250
|
256
|
+
num_attempts = 0
|
257
|
+
|
258
|
+
while true
|
259
|
+
response = opsworks_client.describe_commands(:instance_id => instance_id)
|
260
|
+
configure_command = response[:commands].find { |command| command[:type] == 'configure' }
|
261
|
+
|
262
|
+
configure_status(configure_command)
|
263
|
+
|
264
|
+
unless configure_command.nil?
|
265
|
+
#i guess just bail if superseded, waiting on configure events is somewhat dubious after seeing more complex stacks in action anyway!
|
266
|
+
if %w{successful superseded}.include? configure_command[:status]
|
267
|
+
return
|
268
|
+
elsif configure_command[:status] == 'failed'
|
269
|
+
raise 'configure failed'
|
270
|
+
end
|
271
|
+
end
|
272
|
+
num_attempts += 1
|
273
|
+
if num_attempts >= max_attempts
|
274
|
+
raise 'stuck waiting on configure command max attempts'
|
275
|
+
end
|
276
|
+
sleep 10
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opendelivery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brian Jakovich
|
@@ -11,28 +10,25 @@ authors:
|
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date: 2014-
|
13
|
+
date: 2014-04-18 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: rdoc
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
|
-
- -
|
19
|
+
- - '>='
|
22
20
|
- !ruby/object:Gem::Version
|
23
21
|
version: '0'
|
24
22
|
type: :development
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
|
-
- -
|
26
|
+
- - '>='
|
30
27
|
- !ruby/object:Gem::Version
|
31
28
|
version: '0'
|
32
29
|
- !ruby/object:Gem::Dependency
|
33
30
|
name: rspec
|
34
31
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
32
|
requirements:
|
37
33
|
- - '='
|
38
34
|
- !ruby/object:Gem::Version
|
@@ -40,7 +36,6 @@ dependencies:
|
|
40
36
|
type: :development
|
41
37
|
prerelease: false
|
42
38
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
39
|
requirements:
|
45
40
|
- - '='
|
46
41
|
- !ruby/object:Gem::Version
|
@@ -48,7 +43,6 @@ dependencies:
|
|
48
43
|
- !ruby/object:Gem::Dependency
|
49
44
|
name: simplecov
|
50
45
|
requirement: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
46
|
requirements:
|
53
47
|
- - '='
|
54
48
|
- !ruby/object:Gem::Version
|
@@ -56,7 +50,6 @@ dependencies:
|
|
56
50
|
type: :development
|
57
51
|
prerelease: false
|
58
52
|
version_requirements: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
53
|
requirements:
|
61
54
|
- - '='
|
62
55
|
- !ruby/object:Gem::Version
|
@@ -64,7 +57,6 @@ dependencies:
|
|
64
57
|
- !ruby/object:Gem::Dependency
|
65
58
|
name: cucumber
|
66
59
|
requirement: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
60
|
requirements:
|
69
61
|
- - '='
|
70
62
|
- !ruby/object:Gem::Version
|
@@ -72,47 +64,13 @@ dependencies:
|
|
72
64
|
type: :development
|
73
65
|
prerelease: false
|
74
66
|
version_requirements: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
67
|
requirements:
|
77
68
|
- - '='
|
78
69
|
- !ruby/object:Gem::Version
|
79
70
|
version: 1.3.6
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
|
-
name: aws-sdk
|
82
|
-
requirement: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
|
-
requirements:
|
85
|
-
- - '='
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version: 1.16.0
|
88
|
-
type: :development
|
89
|
-
prerelease: false
|
90
|
-
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
|
-
requirements:
|
93
|
-
- - '='
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: 1.16.0
|
96
|
-
- !ruby/object:Gem::Dependency
|
97
|
-
name: encrypto_signo
|
98
|
-
requirement: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
|
-
requirements:
|
101
|
-
- - '='
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 1.0.0
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
|
-
requirements:
|
109
|
-
- - '='
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: 1.0.0
|
112
71
|
- !ruby/object:Gem::Dependency
|
113
72
|
name: encrypto_signo
|
114
73
|
requirement: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
74
|
requirements:
|
117
75
|
- - '='
|
118
76
|
- !ruby/object:Gem::Version
|
@@ -120,7 +78,6 @@ dependencies:
|
|
120
78
|
type: :runtime
|
121
79
|
prerelease: false
|
122
80
|
version_requirements: !ruby/object:Gem::Requirement
|
123
|
-
none: false
|
124
81
|
requirements:
|
125
82
|
- - '='
|
126
83
|
- !ruby/object:Gem::Version
|
@@ -128,33 +85,29 @@ dependencies:
|
|
128
85
|
- !ruby/object:Gem::Dependency
|
129
86
|
name: aws-sdk
|
130
87
|
requirement: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
88
|
requirements:
|
133
89
|
- - '='
|
134
90
|
- !ruby/object:Gem::Version
|
135
|
-
version: 1.
|
91
|
+
version: 1.35.0
|
136
92
|
type: :runtime
|
137
93
|
prerelease: false
|
138
94
|
version_requirements: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
95
|
requirements:
|
141
96
|
- - '='
|
142
97
|
- !ruby/object:Gem::Version
|
143
|
-
version: 1.
|
98
|
+
version: 1.35.0
|
144
99
|
- !ruby/object:Gem::Dependency
|
145
100
|
name: json
|
146
101
|
requirement: !ruby/object:Gem::Requirement
|
147
|
-
none: false
|
148
102
|
requirements:
|
149
|
-
- -
|
103
|
+
- - '>='
|
150
104
|
- !ruby/object:Gem::Version
|
151
105
|
version: '0'
|
152
106
|
type: :runtime
|
153
107
|
prerelease: false
|
154
108
|
version_requirements: !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
109
|
requirements:
|
157
|
-
- -
|
110
|
+
- - '>='
|
158
111
|
- !ruby/object:Gem::Version
|
159
112
|
version: '0'
|
160
113
|
description: A collection of tools that are used in the Open Delivery platform.
|
@@ -169,30 +122,30 @@ files:
|
|
169
122
|
- lib/opendelivery/source_control.rb
|
170
123
|
- lib/opendelivery/stack.rb
|
171
124
|
- lib/opendelivery/storage.rb
|
125
|
+
- lib/opsworks.rb
|
172
126
|
homepage: http://stelligent.com
|
173
127
|
licenses:
|
174
128
|
- MIT
|
129
|
+
metadata: {}
|
175
130
|
post_install_message:
|
176
131
|
rdoc_options: []
|
177
132
|
require_paths:
|
178
133
|
- lib
|
179
134
|
- lib
|
180
135
|
required_ruby_version: !ruby/object:Gem::Requirement
|
181
|
-
none: false
|
182
136
|
requirements:
|
183
|
-
- -
|
137
|
+
- - '>='
|
184
138
|
- !ruby/object:Gem::Version
|
185
139
|
version: 1.9.3
|
186
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
|
-
none: false
|
188
141
|
requirements:
|
189
|
-
- -
|
142
|
+
- - '>='
|
190
143
|
- !ruby/object:Gem::Version
|
191
144
|
version: '0'
|
192
145
|
requirements: []
|
193
146
|
rubyforge_project:
|
194
|
-
rubygems_version:
|
147
|
+
rubygems_version: 2.2.2
|
195
148
|
signing_key:
|
196
|
-
specification_version:
|
149
|
+
specification_version: 4
|
197
150
|
summary: Open Delivery tools and utilities
|
198
151
|
test_files: []
|