tass 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/tass +15 -1
- data/lib/tapjoy/autoscaling_bootstrap/AWS/Autoscaling/group.rb +9 -1
- data/lib/tapjoy/autoscaling_bootstrap/AWS/Autoscaling/launch_config.rb +3 -1
- data/lib/tapjoy/autoscaling_bootstrap/AWS/autoscaling.rb +2 -0
- data/lib/tapjoy/autoscaling_bootstrap/autoscaling/config.rb +5 -1
- data/lib/tapjoy/autoscaling_bootstrap/autoscaling/group.rb +12 -1
- data/lib/tapjoy/autoscaling_bootstrap/configure_autoscaler.rb +18 -1
- data/lib/tapjoy/autoscaling_bootstrap/launch_configuration.rb +7 -6
- data/lib/tapjoy/autoscaling_bootstrap/version.rb +2 -2
- metadata +45 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79e07e545d00ebfdf7c693c8364c34ff1f34db9f
|
4
|
+
data.tar.gz: c154c83fa1bf2d09c72fdf7d49de63c015f4af01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54a540a2fe9185b3e753cb0e978f8d0b6deede19ba571bf084472d5327b8dc369c6bc35dae46539a1546835b8a5acb6efe60dd36a18d3229aa3e9ea26ee8f4e5
|
7
|
+
data.tar.gz: bc8c7c3fd4f818adaa42dacfe375edefa110dfeed526ec0cdb2d88bd7ad11ccbb67d2872919b8ec7979fed8bb21b543464b738555acdc1b0edb962bb6585a3bb
|
data/bin/tass
CHANGED
@@ -78,6 +78,19 @@ when 'create'
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
81
|
+
|
82
|
+
if config.key?(:asg_metrics)
|
83
|
+
# We list all metrics because otherwise we can't get GroupStandbyInstances
|
84
|
+
Tapjoy::AutoscalingBootstrap::AWS::Autoscaling.client.enable_metrics_collection({
|
85
|
+
auto_scaling_group_name: Tapjoy::AutoscalingBootstrap.scaler_name,
|
86
|
+
metrics: %w(
|
87
|
+
GroupMinSize GroupMaxSize GroupDesiredCapacity GroupInServiceInstances
|
88
|
+
GroupPendingInstances GroupStandbyInstances GroupTerminatingInstances
|
89
|
+
GroupTotalInstances
|
90
|
+
),
|
91
|
+
granularity: '1Minute'
|
92
|
+
})
|
93
|
+
end
|
81
94
|
end
|
82
95
|
when 'update'
|
83
96
|
opts = Trollop.options do
|
@@ -96,7 +109,8 @@ when 'update'
|
|
96
109
|
else
|
97
110
|
confirm_config(aws_env, config, opts)
|
98
111
|
|
99
|
-
Tapjoy::AutoscalingBootstrap::
|
112
|
+
Tapjoy::AutoscalingBootstrap::AutoscalingGroup.new.create(
|
113
|
+
opts, config, aws_env, user_data)
|
100
114
|
end
|
101
115
|
when 'audit'
|
102
116
|
opts = Trollop.options do
|
@@ -37,7 +37,7 @@ module Tapjoy
|
|
37
37
|
)
|
38
38
|
end
|
39
39
|
|
40
|
-
def create(zones:, health_check_type: nil, tags:,
|
40
|
+
def create(zones:, health_check_type: nil, placement_group: nil, tags:,
|
41
41
|
vpc_subnets: nil, termination_policies: , **unused_values)
|
42
42
|
|
43
43
|
group_hash = {
|
@@ -47,12 +47,20 @@ module Tapjoy
|
|
47
47
|
min_size: 0, max_size: 0, desired_capacity: 0,
|
48
48
|
termination_policies: termination_policies,
|
49
49
|
vpc_zone_identifier: vpc_subnets,
|
50
|
+
placement_group: placement_group,
|
50
51
|
tags: Tapjoy::AutoscalingBootstrap::Autoscaling::Group.new.generate_tags(tags)
|
51
52
|
}
|
52
53
|
|
53
54
|
self.client.create_auto_scaling_group(**group_hash)
|
54
55
|
end
|
55
56
|
|
57
|
+
def update_launch_config(scaler_name)
|
58
|
+
self.client.update_auto_scaling_group(
|
59
|
+
auto_scaling_group_name: scaler_name,
|
60
|
+
launch_configuration_name: Tapjoy::AutoscalingBootstrap.config_name,
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
56
64
|
def attach_elb(elb_list)
|
57
65
|
self.client.attach_load_balancers({
|
58
66
|
auto_scaling_group_name: Tapjoy::AutoscalingBootstrap.scaler_name,
|
@@ -16,7 +16,7 @@ module Tapjoy
|
|
16
16
|
|
17
17
|
def create(image_id:, instance_type:, security_groups:, user_data:,
|
18
18
|
keypair:, iam_instance_profile:, classic_link_vpc_id: nil,
|
19
|
-
classic_link_sg_ids: nil, **unused_values)
|
19
|
+
classic_link_sg_ids: nil, spot_price: nil, ebs_optimized: true, **unused_values)
|
20
20
|
|
21
21
|
self.client.create_launch_configuration(
|
22
22
|
launch_configuration_name: Tapjoy::AutoscalingBootstrap.config_name,
|
@@ -28,6 +28,8 @@ module Tapjoy
|
|
28
28
|
key_name: keypair,
|
29
29
|
classic_link_vpc_id: classic_link_vpc_id,
|
30
30
|
classic_link_vpc_security_groups: classic_link_sg_ids,
|
31
|
+
spot_price: spot_price,
|
32
|
+
ebs_optimized: ebs_optimized,
|
31
33
|
)
|
32
34
|
end
|
33
35
|
|
@@ -34,7 +34,11 @@ module Tapjoy
|
|
34
34
|
|
35
35
|
def delete
|
36
36
|
puts "Deleting launch config #{Tapjoy::AutoscalingBootstrap.config_name}"
|
37
|
-
|
37
|
+
begin
|
38
|
+
Tapjoy::AutoscalingBootstrap::AWS::Autoscaling::LaunchConfig.delete
|
39
|
+
rescue Aws::AutoScaling::Errors::ResourceInUse
|
40
|
+
puts "Not deleting the existing launch config, because it's currently in use"
|
41
|
+
end
|
38
42
|
end
|
39
43
|
end
|
40
44
|
end
|
@@ -31,9 +31,20 @@ module Tapjoy
|
|
31
31
|
Tapjoy::AutoscalingBootstrap::AWS::Autoscaling::Group.create(**config)
|
32
32
|
end
|
33
33
|
|
34
|
+
def update(config:, aws_env:, user_data:)
|
35
|
+
if exists
|
36
|
+
puts "Updating launch config for scaling group: #{@scaler_name}"
|
37
|
+
Tapjoy::AutoscalingBootstrap::LaunchConfiguration.new(config, aws_env, user_data)
|
38
|
+
Tapjoy::AutoscalingBootstrap::AWS::Autoscaling::Group.update_launch_config(@scaler_name)
|
39
|
+
# increment_autoscale_group
|
40
|
+
else
|
41
|
+
abort("Scaling group \"#{@scaler_name}\" doesn't exist, and therefore cannot be updated.")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
34
45
|
# Check if autoscale group exists
|
35
46
|
def exists
|
36
|
-
|
47
|
+
Tapjoy::AutoscalingBootstrap::AWS::Autoscaling::Group.describe.nil? ? false : true
|
37
48
|
end
|
38
49
|
|
39
50
|
# Encode user data into required base64 form
|
@@ -7,7 +7,11 @@ module Tapjoy
|
|
7
7
|
|
8
8
|
if misc_config[:create_as_group]
|
9
9
|
sec_group_exists(aws_env[:security_groups]) unless misc_config[:vpc_subnets]
|
10
|
-
|
10
|
+
if autoscaling_group_exists?
|
11
|
+
update_autoscaling_group(misc_config, aws_env, user_data)
|
12
|
+
else
|
13
|
+
create_autoscaling_group(misc_config, aws_env, user_data)
|
14
|
+
end
|
11
15
|
else
|
12
16
|
puts 'Skipping creating autoscale group and launch config'
|
13
17
|
puts "\n"
|
@@ -16,6 +20,11 @@ module Tapjoy
|
|
16
20
|
|
17
21
|
private
|
18
22
|
|
23
|
+
# Check if ASG exists so we know whether to create or update
|
24
|
+
def autoscaling_group_exists?
|
25
|
+
Tapjoy::AutoscalingBootstrap::AWS::Autoscaling::Group.describe.nil? ? false : true
|
26
|
+
end
|
27
|
+
|
19
28
|
# Check if security group exists and create it if it does not
|
20
29
|
def sec_group_exists(groups)
|
21
30
|
groups.each do |group|
|
@@ -35,6 +44,14 @@ module Tapjoy
|
|
35
44
|
Tapjoy::AutoscalingBootstrap.group.create(config: misc_config,
|
36
45
|
aws_env: aws_env, user_data: user_data)
|
37
46
|
end
|
47
|
+
|
48
|
+
def update_autoscaling_group(misc_config, aws_env, user_data)
|
49
|
+
Tapjoy::AutoscalingBootstrap.group.update(
|
50
|
+
config: misc_config,
|
51
|
+
aws_env: aws_env,
|
52
|
+
user_data: user_data
|
53
|
+
)
|
54
|
+
end
|
38
55
|
end
|
39
56
|
end
|
40
57
|
end
|
@@ -10,8 +10,12 @@ module Tapjoy
|
|
10
10
|
updated_config = current.to_hash.merge!(new_config)
|
11
11
|
|
12
12
|
lc_name = "#{Tapjoy::AutoscalingBootstrap.config_name}_#{date_stamp}"
|
13
|
-
update(
|
14
|
-
|
13
|
+
update(
|
14
|
+
config_name: lc_name,
|
15
|
+
scaler_name: Tapjoy::AutoscalingBootstrap.scaler_name,
|
16
|
+
user_data: user_data,
|
17
|
+
updated_config: updated_config, aws_env: aws_env
|
18
|
+
)
|
15
19
|
end
|
16
20
|
|
17
21
|
def current
|
@@ -26,16 +30,13 @@ module Tapjoy
|
|
26
30
|
|
27
31
|
def update(config_name:, scaler_name: 'NaS', user_data: user_data,
|
28
32
|
updated_config:, aws_env:)
|
29
|
-
|
30
33
|
Tapjoy::AutoscalingBootstrap.config_name = config_name
|
31
|
-
Tapjoy::AutoscalingBootstrap.scaler_name = scaler_name
|
32
|
-
|
33
34
|
Tapjoy::AutoscalingBootstrap.config.create(updated_config, aws_env,
|
34
35
|
user_data)
|
35
36
|
end
|
36
37
|
|
37
38
|
def date_stamp
|
38
|
-
Time.now.strftime('%Y%m%d-%H%M%S')
|
39
|
+
Time.now.utc.strftime('%Y%m%d-%H%M%S')
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ali Tayarani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|
@@ -136,6 +136,48 @@ dependencies:
|
|
136
136
|
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 0.2.2
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: codacy-coverage
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: pry
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: pry-byebug
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
139
181
|
description: TASS is the suite of tools that the Tapjoy Operations team uses to manage
|
140
182
|
autoscaling groups and launch configurations.
|
141
183
|
email: ali.tayarani@tapjoy.com
|
@@ -190,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
232
|
version: '0'
|
191
233
|
requirements: []
|
192
234
|
rubyforge_project:
|
193
|
-
rubygems_version: 2.
|
235
|
+
rubygems_version: 2.5.1
|
194
236
|
signing_key:
|
195
237
|
specification_version: 4
|
196
238
|
summary: Tapjoy Autoscaling Suite
|