rollo 0.7.0 → 0.8.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile +4 -2
- data/Gemfile.lock +1127 -523
- data/LICENSE.txt +1 -1
- data/Rakefile +134 -10
- data/bin/console +4 -3
- data/lib/rollo.rb +3 -1
- data/lib/rollo/commands.rb +2 -0
- data/lib/rollo/commands/hosts.rb +125 -79
- data/lib/rollo/commands/main.rb +67 -52
- data/lib/rollo/commands/services.rb +92 -57
- data/lib/rollo/model.rb +2 -0
- data/lib/rollo/model/host.rb +4 -2
- data/lib/rollo/model/host_cluster.rb +32 -22
- data/lib/rollo/model/scaling_activity.rb +8 -6
- data/lib/rollo/model/service.rb +28 -19
- data/lib/rollo/model/service_cluster.rb +19 -14
- data/lib/rollo/version.rb +3 -1
- metadata +141 -39
- data/.envrc +0 -5
- data/.gitignore +0 -31
- data/.rspec +0 -3
- data/.ruby-version +0 -1
- data/.travis.yml +0 -5
- data/exe/rollo +0 -5
- data/go +0 -61
- data/rollo.gemspec +0 -37
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Rollo
|
2
4
|
module Model
|
3
5
|
class ScalingActivity
|
@@ -18,14 +20,14 @@ module Rollo
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def started_after_completion_of?(other)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
id != other.id &&
|
24
|
+
!start_time.nil? &&
|
25
|
+
!other.end_time.nil? &&
|
26
|
+
start_time > other.end_time
|
25
27
|
end
|
26
28
|
|
27
|
-
def
|
28
|
-
%w
|
29
|
+
def complete?
|
30
|
+
%w[Successful Failed Cancelled].include?(@activity.status_code)
|
29
31
|
end
|
30
32
|
end
|
31
33
|
end
|
data/lib/rollo/model/service.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'aws-sdk'
|
2
4
|
require 'wait'
|
3
5
|
require 'hollerback'
|
@@ -6,8 +8,9 @@ module Rollo
|
|
6
8
|
module Model
|
7
9
|
class Service
|
8
10
|
def initialize(
|
9
|
-
|
10
|
-
|
11
|
+
ecs_cluster_name, ecs_service_arn, region,
|
12
|
+
ecs_resource = nil, waiter = nil
|
13
|
+
)
|
11
14
|
@ecs_cluster_name = ecs_cluster_name
|
12
15
|
@ecs_service_arn = ecs_service_arn
|
13
16
|
@ecs_resource = ecs_resource || Aws::ECS::Resource.new(region: region)
|
@@ -25,10 +28,10 @@ module Rollo
|
|
25
28
|
end
|
26
29
|
|
27
30
|
def reload
|
28
|
-
@ecs_service =
|
31
|
+
@ecs_service = ecs_service
|
29
32
|
end
|
30
33
|
|
31
|
-
def
|
34
|
+
def replica?
|
32
35
|
@ecs_service.scheduling_strategy == 'REPLICA'
|
33
36
|
end
|
34
37
|
|
@@ -42,13 +45,14 @@ module Rollo
|
|
42
45
|
|
43
46
|
def desired_count=(count)
|
44
47
|
@ecs_resource.client
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
.update_service(
|
49
|
+
cluster: @ecs_cluster_name,
|
50
|
+
service: @ecs_service_arn,
|
51
|
+
desired_count: count
|
52
|
+
)
|
49
53
|
end
|
50
54
|
|
51
|
-
def
|
55
|
+
def desired_count_met?
|
52
56
|
running_count == desired_count
|
53
57
|
end
|
54
58
|
|
@@ -59,7 +63,8 @@ module Rollo
|
|
59
63
|
target = [increased, maximum].min
|
60
64
|
|
61
65
|
callbacks_for(block).try_respond_with(
|
62
|
-
|
66
|
+
:prepare, initial, target
|
67
|
+
)
|
63
68
|
|
64
69
|
ensure_instance_count(target, &block)
|
65
70
|
end
|
@@ -71,7 +76,8 @@ module Rollo
|
|
71
76
|
target = [decreased, minimum].max
|
72
77
|
|
73
78
|
callbacks_for(block).try_respond_with(
|
74
|
-
|
79
|
+
:prepare, initial, target
|
80
|
+
)
|
75
81
|
|
76
82
|
ensure_instance_count(target, &block)
|
77
83
|
end
|
@@ -84,20 +90,23 @@ module Rollo
|
|
84
90
|
def wait_for_service_health(&block)
|
85
91
|
@waiter.until do |attempt|
|
86
92
|
reload
|
87
|
-
|
88
|
-
|
89
|
-
|
93
|
+
if block
|
94
|
+
callbacks_for(block)
|
95
|
+
.try_respond_with(:waiting_for_health, attempt)
|
96
|
+
end
|
97
|
+
desired_count_met?
|
90
98
|
end
|
91
99
|
end
|
92
100
|
|
93
101
|
private
|
94
102
|
|
95
|
-
def
|
103
|
+
def ecs_service
|
96
104
|
@ecs_resource.client
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
105
|
+
.describe_services(
|
106
|
+
cluster: @ecs_cluster_name,
|
107
|
+
services: [@ecs_service_arn]
|
108
|
+
)
|
109
|
+
.services[0]
|
101
110
|
end
|
102
111
|
|
103
112
|
def callbacks_for(block)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'aws-sdk'
|
2
4
|
require 'hollerback'
|
3
5
|
|
@@ -10,7 +12,7 @@ module Rollo
|
|
10
12
|
@region = region
|
11
13
|
@ecs_cluster_name = ecs_cluster_name
|
12
14
|
@ecs_resource = ecs_resource || Aws::ECS::Resource.new(region: region)
|
13
|
-
@ecs_cluster =
|
15
|
+
@ecs_cluster = ecs_cluster
|
14
16
|
end
|
15
17
|
|
16
18
|
def name
|
@@ -18,9 +20,9 @@ module Rollo
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def replica_services
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
ecs_service_arns
|
24
|
+
.collect { |arn| Service.new(@ecs_cluster_name, arn, @region) }
|
25
|
+
.select(&:replica?)
|
24
26
|
end
|
25
27
|
|
26
28
|
def with_replica_services(&block)
|
@@ -28,7 +30,8 @@ module Rollo
|
|
28
30
|
|
29
31
|
callbacks = Hollerback::Callbacks.new(block)
|
30
32
|
callbacks.try_respond_with(
|
31
|
-
|
33
|
+
:start, all_replica_services
|
34
|
+
)
|
32
35
|
|
33
36
|
all_replica_services.each do |service|
|
34
37
|
callbacks.try_respond_with(:each_service, service)
|
@@ -37,17 +40,19 @@ module Rollo
|
|
37
40
|
|
38
41
|
private
|
39
42
|
|
40
|
-
def
|
41
|
-
@ecs_resource
|
42
|
-
|
43
|
-
|
43
|
+
def ecs_cluster
|
44
|
+
@ecs_resource
|
45
|
+
.client
|
46
|
+
.describe_clusters(clusters: [@ecs_cluster_name])
|
47
|
+
.clusters[0]
|
44
48
|
end
|
45
49
|
|
46
|
-
def
|
47
|
-
@ecs_resource
|
48
|
-
|
49
|
-
|
50
|
+
def ecs_service_arns
|
51
|
+
@ecs_resource
|
52
|
+
.client
|
53
|
+
.list_services(cluster: @ecs_cluster.cluster_name)
|
54
|
+
.inject([]) { |arns, response| arns + response.service_arns }
|
50
55
|
end
|
51
56
|
end
|
52
57
|
end
|
53
|
-
end
|
58
|
+
end
|
data/lib/rollo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rollo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- InfraBlocks Maintainers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -39,47 +39,61 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.22'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: hollerback
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: thor
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.20'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.20'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: wait
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.5'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.5'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: aruba
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.14'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.14'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: bundler
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,64 +108,148 @@ dependencies:
|
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '2.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: gem-release
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: irbtools
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.2'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.2'
|
97
139
|
- !ruby/object:Gem::Dependency
|
98
140
|
name: rake
|
99
141
|
requirement: !ruby/object:Gem::Requirement
|
100
142
|
requirements:
|
101
143
|
- - "~>"
|
102
144
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
145
|
+
version: '13.0'
|
104
146
|
type: :development
|
105
147
|
prerelease: false
|
106
148
|
version_requirements: !ruby/object:Gem::Requirement
|
107
149
|
requirements:
|
108
150
|
- - "~>"
|
109
151
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
152
|
+
version: '13.0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rake_circle_ci
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.9'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.9'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rake_github
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0.5'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0.5'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: rake_gpg
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0.12'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0.12'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: rake_ssh
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0.4'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0.4'
|
111
209
|
- !ruby/object:Gem::Dependency
|
112
210
|
name: rspec
|
113
211
|
requirement: !ruby/object:Gem::Requirement
|
114
212
|
requirements:
|
115
213
|
- - "~>"
|
116
214
|
- !ruby/object:Gem::Version
|
117
|
-
version: '3.
|
215
|
+
version: '3.9'
|
118
216
|
type: :development
|
119
217
|
prerelease: false
|
120
218
|
version_requirements: !ruby/object:Gem::Requirement
|
121
219
|
requirements:
|
122
220
|
- - "~>"
|
123
221
|
- !ruby/object:Gem::Version
|
124
|
-
version: '3.
|
222
|
+
version: '3.9'
|
125
223
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
224
|
+
name: rubocop
|
127
225
|
requirement: !ruby/object:Gem::Requirement
|
128
226
|
requirements:
|
129
227
|
- - "~>"
|
130
228
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
229
|
+
version: '1.12'
|
132
230
|
type: :development
|
133
231
|
prerelease: false
|
134
232
|
version_requirements: !ruby/object:Gem::Requirement
|
135
233
|
requirements:
|
136
234
|
- - "~>"
|
137
235
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
236
|
+
version: '1.12'
|
139
237
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
238
|
+
name: rubocop-rake
|
141
239
|
requirement: !ruby/object:Gem::Requirement
|
142
240
|
requirements:
|
143
241
|
- - "~>"
|
144
242
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
243
|
+
version: '0.5'
|
146
244
|
type: :development
|
147
245
|
prerelease: false
|
148
246
|
version_requirements: !ruby/object:Gem::Requirement
|
149
247
|
requirements:
|
150
248
|
- - "~>"
|
151
249
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
250
|
+
version: '0.5'
|
153
251
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
252
|
+
name: rubocop-rspec
|
155
253
|
requirement: !ruby/object:Gem::Requirement
|
156
254
|
requirements:
|
157
255
|
- - "~>"
|
@@ -164,19 +262,27 @@ dependencies:
|
|
164
262
|
- - "~>"
|
165
263
|
- !ruby/object:Gem::Version
|
166
264
|
version: '2.2'
|
265
|
+
- !ruby/object:Gem::Dependency
|
266
|
+
name: simplecov
|
267
|
+
requirement: !ruby/object:Gem::Requirement
|
268
|
+
requirements:
|
269
|
+
- - "~>"
|
270
|
+
- !ruby/object:Gem::Version
|
271
|
+
version: '0.21'
|
272
|
+
type: :development
|
273
|
+
prerelease: false
|
274
|
+
version_requirements: !ruby/object:Gem::Requirement
|
275
|
+
requirements:
|
276
|
+
- - "~>"
|
277
|
+
- !ruby/object:Gem::Version
|
278
|
+
version: '0.21'
|
167
279
|
description: Strategies for rolling ECS container instance clusters.
|
168
280
|
email:
|
169
|
-
-
|
170
|
-
executables:
|
171
|
-
- rollo
|
281
|
+
- maintainers@infrablocks.io
|
282
|
+
executables: []
|
172
283
|
extensions: []
|
173
284
|
extra_rdoc_files: []
|
174
285
|
files:
|
175
|
-
- ".envrc"
|
176
|
-
- ".gitignore"
|
177
|
-
- ".rspec"
|
178
|
-
- ".ruby-version"
|
179
|
-
- ".travis.yml"
|
180
286
|
- CODE_OF_CONDUCT.md
|
181
287
|
- Gemfile
|
182
288
|
- Gemfile.lock
|
@@ -185,8 +291,6 @@ files:
|
|
185
291
|
- Rakefile
|
186
292
|
- bin/console
|
187
293
|
- bin/setup
|
188
|
-
- exe/rollo
|
189
|
-
- go
|
190
294
|
- lib/rollo.rb
|
191
295
|
- lib/rollo/commands.rb
|
192
296
|
- lib/rollo/commands/hosts.rb
|
@@ -199,7 +303,6 @@ files:
|
|
199
303
|
- lib/rollo/model/service.rb
|
200
304
|
- lib/rollo/model/service_cluster.rb
|
201
305
|
- lib/rollo/version.rb
|
202
|
-
- rollo.gemspec
|
203
306
|
homepage: https://github.com/infrablocks/rollo
|
204
307
|
licenses:
|
205
308
|
- MIT
|
@@ -212,15 +315,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
212
315
|
requirements:
|
213
316
|
- - ">="
|
214
317
|
- !ruby/object:Gem::Version
|
215
|
-
version: '
|
318
|
+
version: '2.6'
|
216
319
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
320
|
requirements:
|
218
|
-
- - "
|
321
|
+
- - ">"
|
219
322
|
- !ruby/object:Gem::Version
|
220
|
-
version:
|
323
|
+
version: 1.3.1
|
221
324
|
requirements: []
|
222
|
-
|
223
|
-
rubygems_version: 2.5.2.3
|
325
|
+
rubygems_version: 3.0.1
|
224
326
|
signing_key:
|
225
327
|
specification_version: 4
|
226
328
|
summary: Cluster / service roller for AWS ECS.
|