rollo 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/rollo/commands/main.rb +15 -2
- data/lib/rollo/commands/services.rb +13 -1
- data/lib/rollo/model/service.rb +10 -6
- data/lib/rollo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22045e3fa6c8b5a4cec9f59229c160aaae5a2bc9
|
4
|
+
data.tar.gz: b51a52be42f0fbafdd70a399678003ca20c84b58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da6e1d740c258510d9cd5eebfc87e3fab41119755f0c0380eac308b4ad5dd6bfa156b1a7346ab72be8a9f38af164e0ed3c3a39ec36e306a2479f9f2dcd21a86e
|
7
|
+
data.tar.gz: a08d36a6ce0552b2dc05ef0179f9d907c456a68f30141befc68bc507821edbc3bea8f188e070e2342219f383a2cc389c84a5886f1f5907f84d89844b4a3042fc
|
data/Gemfile.lock
CHANGED
data/lib/rollo/commands/main.rb
CHANGED
@@ -33,6 +33,17 @@ module Rollo
|
|
33
33
|
desc:
|
34
34
|
'The number of hosts / service instances to add / remove at ' +
|
35
35
|
'a time.')
|
36
|
+
method_option(
|
37
|
+
:maximum_service_instances,
|
38
|
+
aliases: '-mx',
|
39
|
+
type: :numeric,
|
40
|
+
desc: 'The maximum number of service instances to expand to.')
|
41
|
+
method_option(
|
42
|
+
:minimum_service_instances,
|
43
|
+
aliases: '-mn',
|
44
|
+
type: :numeric,
|
45
|
+
desc: 'The minimum number of service instances to contract to.')
|
46
|
+
|
36
47
|
def roll(region, asg_name, ecs_cluster_name)
|
37
48
|
host_cluster = Rollo::Model::HostCluster.new(asg_name, region)
|
38
49
|
service_cluster = Rollo::Model::ServiceCluster
|
@@ -64,7 +75,8 @@ module Rollo
|
|
64
75
|
[
|
65
76
|
region, asg_name, ecs_cluster_name,
|
66
77
|
service_cluster
|
67
|
-
]
|
78
|
+
],
|
79
|
+
maximum_instances: options[:maximum_service_instances])
|
68
80
|
|
69
81
|
invoke(
|
70
82
|
"hosts:terminate",
|
@@ -85,7 +97,8 @@ module Rollo
|
|
85
97
|
[
|
86
98
|
region, asg_name, ecs_cluster_name,
|
87
99
|
service_cluster
|
88
|
-
]
|
100
|
+
],
|
101
|
+
minimum_instances: options[:minimum_service_instances])
|
89
102
|
end
|
90
103
|
|
91
104
|
say("Instances in host cluster #{host_cluster.name} rolled " +
|
@@ -25,11 +25,17 @@ module Rollo
|
|
25
25
|
type: :numeric,
|
26
26
|
default: 2,
|
27
27
|
desc: 'The number of minutes to wait for services to start up.')
|
28
|
+
method_option(
|
29
|
+
:maximum_instances,
|
30
|
+
aliases: '-mx',
|
31
|
+
type: :numeric,
|
32
|
+
desc: 'The maximum number of service instances to expand to.')
|
28
33
|
|
29
34
|
def expand(
|
30
35
|
region, _, ecs_cluster_name,
|
31
36
|
service_cluster = nil)
|
32
37
|
batch_size = options[:batch_size]
|
38
|
+
maximum_instances = options[:maximum_instances]
|
33
39
|
service_start_wait_minutes = options[:startup_time]
|
34
40
|
service_start_wait_seconds = 60 * service_start_wait_minutes
|
35
41
|
|
@@ -49,7 +55,8 @@ module Rollo
|
|
49
55
|
"Increasing instance count by #{batch_size} " +
|
50
56
|
"for #{service.name}")
|
51
57
|
with_padding do
|
52
|
-
service.increase_instance_count_by(
|
58
|
+
service.increase_instance_count_by(
|
59
|
+
batch_size, maximum_instances: maximum_instances) do |on|
|
53
60
|
on.prepare do |current, target|
|
54
61
|
say(
|
55
62
|
"Changing instance count from #{current} " +
|
@@ -86,6 +93,11 @@ module Rollo
|
|
86
93
|
type: :numeric,
|
87
94
|
default: 3,
|
88
95
|
desc: 'The number of service instances to remove at a time.')
|
96
|
+
method_option(
|
97
|
+
:minimum_instances,
|
98
|
+
aliases: '-mn',
|
99
|
+
type: :numeric,
|
100
|
+
desc: 'The minimum number of service instances to contract to.')
|
89
101
|
|
90
102
|
def contract(
|
91
103
|
region, _, ecs_cluster_name,
|
data/lib/rollo/model/service.rb
CHANGED
@@ -52,24 +52,28 @@ module Rollo
|
|
52
52
|
running_count == desired_count
|
53
53
|
end
|
54
54
|
|
55
|
-
def increase_instance_count_by(count_delta, &block)
|
55
|
+
def increase_instance_count_by(count_delta, options = {}, &block)
|
56
|
+
maximum = options[:maximum_instance_count] || Float::INFINITY
|
56
57
|
initial = desired_count
|
57
58
|
increased = initial + count_delta
|
59
|
+
target = [increased, maximum].min
|
58
60
|
|
59
61
|
callbacks_for(block).try_respond_with(
|
60
|
-
:prepare, initial,
|
62
|
+
:prepare, initial, target)
|
61
63
|
|
62
|
-
ensure_instance_count(
|
64
|
+
ensure_instance_count(target, &block)
|
63
65
|
end
|
64
66
|
|
65
|
-
def decrease_instance_count_by(count_delta, &block)
|
67
|
+
def decrease_instance_count_by(count_delta, options = {}, &block)
|
68
|
+
minimum = options[:minimum_instance_count] || 0
|
66
69
|
initial = desired_count
|
67
70
|
decreased = initial - count_delta
|
71
|
+
target = [decreased, minimum].max
|
68
72
|
|
69
73
|
callbacks_for(block).try_respond_with(
|
70
|
-
:prepare, initial,
|
74
|
+
:prepare, initial, target)
|
71
75
|
|
72
|
-
ensure_instance_count(
|
76
|
+
ensure_instance_count(target, &block)
|
73
77
|
end
|
74
78
|
|
75
79
|
def ensure_instance_count(count, &block)
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toby Clemson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|