ecs_deploy 0.3.2 → 1.0.3
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.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +150 -0
- data/README.md +272 -23
- data/Rakefile +4 -0
- data/ecs_deploy.gemspec +9 -3
- data/lib/ecs_deploy/auto_scaler/auto_scaling_group_config.rb +209 -0
- data/lib/ecs_deploy/auto_scaler/cluster_resource_manager.rb +149 -0
- data/lib/ecs_deploy/auto_scaler/config_base.rb +16 -0
- data/lib/ecs_deploy/auto_scaler/instance_drainer.rb +134 -0
- data/lib/ecs_deploy/auto_scaler/service_config.rb +223 -0
- data/lib/ecs_deploy/auto_scaler/spot_fleet_request_config.rb +102 -0
- data/lib/ecs_deploy/auto_scaler/trigger_config.rb +42 -0
- data/lib/ecs_deploy/auto_scaler.rb +105 -339
- data/lib/ecs_deploy/capistrano.rb +73 -3
- data/lib/ecs_deploy/configuration.rb +6 -2
- data/lib/ecs_deploy/instance_fluctuation_manager.rb +198 -0
- data/lib/ecs_deploy/scheduled_task.rb +15 -3
- data/lib/ecs_deploy/service.rb +100 -21
- data/lib/ecs_deploy/task_definition.rb +30 -9
- data/lib/ecs_deploy/version.rb +1 -1
- data/lib/ecs_deploy.rb +1 -1
- metadata +113 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f4d2cb1f5439702efac5ec26e9cd0c47c6225e0106c05b6f73b7860098098488
|
4
|
+
data.tar.gz: 29007dc6fdeb7b64b82a0113ac78ad00025ec9693bca1b238ccca3c507065c01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42481f7631cebe62057fbd9e2c0fc6ba61ff0ee198e5d537958934df8a001c76ef5ddb6f8965c2f7db57d0098aac3b79cb43a677cdbaa95609107d29826892b8
|
7
|
+
data.tar.gz: 28a2d8072e7f94a84301e0f0607fc02c469561d1f39da439cf87d3f7b64c12e301bb77a13bb96e0823870b43af36f5f35ee3e4984567ac57ebe5ae759342d61c
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
# v1.0
|
2
|
+
|
3
|
+
## Release v1.0.3 - 2021/11/17
|
4
|
+
|
5
|
+
### Bug fixes
|
6
|
+
* Fix bug that `InstanceFluctuationManager#decrement` tries to detach instances whose status is 'DEREGISTERING'
|
7
|
+
https://github.com/reproio/ecs_deploy/pull/72
|
8
|
+
|
9
|
+
### Enhancement
|
10
|
+
* Add a cluster name to deployment logs
|
11
|
+
https://github.com/reproio/ecs_deploy/pull/71
|
12
|
+
|
13
|
+
|
14
|
+
## Release v1.0.2 - 2021/05/26
|
15
|
+
|
16
|
+
### Enhancement
|
17
|
+
|
18
|
+
* add option enable_execute_command to support ECS Exec
|
19
|
+
https://github.com/reproio/ecs_deploy/pull/69
|
20
|
+
|
21
|
+
## Release v1.0.1 - 2021/05/19
|
22
|
+
|
23
|
+
### Enhancement
|
24
|
+
|
25
|
+
* retry register_task_definition by AWS SDK feature
|
26
|
+
https://github.com/reproio/ecs_deploy/pull/67
|
27
|
+
* Support Ruby 3.0
|
28
|
+
https://github.com/reproio/ecs_deploy/pull/66
|
29
|
+
* Wait until stop old tasks
|
30
|
+
https://github.com/reproio/ecs_deploy/pull/65
|
31
|
+
* Add prioritized_over_upscale_triggers option to triggers
|
32
|
+
https://github.com/reproio/ecs_deploy/pull/62
|
33
|
+
* Display only unstable services in EcsDeploy::Service#wait_all_running
|
34
|
+
https://github.com/reproio/ecs_deploy/pull/61
|
35
|
+
|
36
|
+
## Release v1.0.0 - 2019/12/24
|
37
|
+
|
38
|
+
### New feature
|
39
|
+
|
40
|
+
* Add tasks to deploy the application faster
|
41
|
+
https://github.com/reproio/ecs_deploy/pull/57
|
42
|
+
|
43
|
+
### Enhancement
|
44
|
+
|
45
|
+
* Add parameters `ecs_wait_until_services_stable_max_attempts` and `ecs_wait_until_services_stable_delay`
|
46
|
+
https://github.com/reproio/ecs_deploy/pull/30
|
47
|
+
* Detect region automatically according to AWS SDK
|
48
|
+
https://github.com/reproio/ecs_deploy/pull/31
|
49
|
+
* Support new features of ECS to support Fargate
|
50
|
+
https://github.com/reproio/ecs_deploy/pull/32
|
51
|
+
* Ignore running tasks which don't belong to the ECS services on deregistering container instances
|
52
|
+
https://github.com/reproio/ecs_deploy/pull/33
|
53
|
+
* Drop AWS SDK 2 support
|
54
|
+
https://github.com/reproio/ecs_deploy/pull/34
|
55
|
+
* Support scheduling_strategy option
|
56
|
+
https://github.com/reproio/ecs_deploy/pull/35
|
57
|
+
* Support execution_role_arn on task_definition
|
58
|
+
https://github.com/reproio/ecs_deploy/pull/36
|
59
|
+
* Support spot fleet requests and container instance draining
|
60
|
+
https://github.com/reproio/ecs_deploy/pull/40
|
61
|
+
* Add network_configuration paramters to ScheduledTask
|
62
|
+
https://github.com/reproio/ecs_deploy/pull/46
|
63
|
+
* Support tagging ECS resources
|
64
|
+
https://github.com/reproio/ecs_deploy/pull/48
|
65
|
+
https://github.com/reproio/ecs_deploy/pull/49
|
66
|
+
* Wait for stopping tasks until tasks stop
|
67
|
+
https://github.com/reproio/ecs_deploy/pull/50
|
68
|
+
* Improve performance when start tasks
|
69
|
+
https://github.com/reproio/ecs_deploy/pull/53
|
70
|
+
* Improve stability of auto scaling groups managed by ecs_auto_scaler
|
71
|
+
https://github.com/reproio/ecs_deploy/pull/55
|
72
|
+
|
73
|
+
### Bug fixes
|
74
|
+
|
75
|
+
* Fix infinite loop that occurs when there are more than 100 container instances
|
76
|
+
https://github.com/reproio/ecs_deploy/pull/38
|
77
|
+
* Fix errors that occur on decreasing more than 20 container instances
|
78
|
+
https://github.com/reproio/ecs_deploy/pull/39
|
79
|
+
|
80
|
+
# Ancient releases
|
81
|
+
|
82
|
+
## Release v0.3.2 - 2017/23/10
|
83
|
+
|
84
|
+
### Enhancement
|
85
|
+
|
86
|
+
* Remove execution feature
|
87
|
+
https://github.com/reproio/ecs_deploy/pull/24
|
88
|
+
* Support container overrides in scheduled tasks
|
89
|
+
https://github.com/reproio/ecs_deploy/pull/26
|
90
|
+
|
91
|
+
### Bug fixes
|
92
|
+
|
93
|
+
* Fix deployment errors that occur when `ecs_scheduled_tasks` is not set
|
94
|
+
https://github.com/reproio/ecs_deploy/pull/27
|
95
|
+
|
96
|
+
## Release v0.3.1 - 2017/04/08
|
97
|
+
|
98
|
+
### Bug fixes
|
99
|
+
|
100
|
+
* Fix block parameter name
|
101
|
+
|
102
|
+
## Release v0.3.0 - 2017/03/08
|
103
|
+
|
104
|
+
### New feature
|
105
|
+
|
106
|
+
* Support ScheduledTask deployment
|
107
|
+
https://github.com/reproio/ecs_deploy/pull/22
|
108
|
+
|
109
|
+
### Enhancement
|
110
|
+
|
111
|
+
* Support network_mode and placement_constraints
|
112
|
+
* Introduce `ecs_registered_tasks` capistrano variable
|
113
|
+
https://github.com/reproio/ecs_deploy/pull/23
|
114
|
+
|
115
|
+
### Bug fixes
|
116
|
+
|
117
|
+
* Filter inactive services
|
118
|
+
https://github.com/reproio/ecs_deploy/pull/19
|
119
|
+
* Wait 10 services at once
|
120
|
+
https://github.com/reproio/ecs_deploy/pull/20
|
121
|
+
https://github.com/reproio/ecs_deploy/pull/21
|
122
|
+
|
123
|
+
## Release v0.2.0 - 2016/31/10
|
124
|
+
|
125
|
+
### Enhancement
|
126
|
+
|
127
|
+
* Support task role arn
|
128
|
+
https://github.com/reproio/ecs_deploy/pull/13
|
129
|
+
* Make the scale-in process safe
|
130
|
+
https://github.com/reproio/ecs_deploy/pull/14
|
131
|
+
* Support ALB
|
132
|
+
https://github.com/reproio/ecs_deploy/pull/15
|
133
|
+
|
134
|
+
## Release v0.1.2 - 2016/28/07
|
135
|
+
|
136
|
+
### Bug fixes
|
137
|
+
|
138
|
+
* Fix rollback bug
|
139
|
+
https://github.com/reproio/ecs_deploy/pull/11
|
140
|
+
|
141
|
+
## Release v0.1.1 - 2016/03/07
|
142
|
+
|
143
|
+
### Bug fixes
|
144
|
+
|
145
|
+
* Add missing desired_count for backend services
|
146
|
+
https://github.com/reproio/ecs_deploy/pull/9
|
147
|
+
|
148
|
+
## Release v0.1.0 - 2016/27/06
|
149
|
+
|
150
|
+
Initial release.
|
data/README.md
CHANGED
@@ -31,6 +31,8 @@ set :ecs_default_cluster, "ecs-cluster-name"
|
|
31
31
|
set :ecs_region, %w(ap-northeast-1) # optional, if nil, use environment variable
|
32
32
|
set :ecs_service_role, "customEcsServiceRole" # default: ecsServiceRole
|
33
33
|
set :ecs_deploy_wait_timeout, 600 # default: 300
|
34
|
+
set :ecs_wait_until_services_stable_max_attempts, 40 # optional
|
35
|
+
set :ecs_wait_until_services_stable_delay, 15 # optional
|
34
36
|
|
35
37
|
set :ecs_tasks, [
|
36
38
|
{
|
@@ -92,7 +94,7 @@ set :ecs_scheduled_tasks, [
|
|
92
94
|
{
|
93
95
|
cluster: "default", # Unless this key, use fetch(:ecs_default_cluster)
|
94
96
|
rule_name: "schedule_name",
|
95
|
-
schedule_expression: "cron(0 12 * * ? *"
|
97
|
+
schedule_expression: "cron(0 12 * * ? *)",
|
96
98
|
description: "schedule_description", # Optional
|
97
99
|
target_id: "task_name", # Unless this key, use task_definition_name
|
98
100
|
task_definition_name: "myapp-#{fetch(:rails_env)}",
|
@@ -187,7 +189,16 @@ And rollback
|
|
187
189
|
|
188
190
|
## Autoscaler
|
189
191
|
|
190
|
-
|
192
|
+
The autoscaler of `ecs_deploy` supports auto scaling of ECS services and clusters.
|
193
|
+
|
194
|
+
### Prerequisits
|
195
|
+
|
196
|
+
* You use a ECS cluster whose instances belong to either an auto scaling group or a spot fleet request
|
197
|
+
* You have CloudWatch alarms and you want to scale services when their state changes
|
198
|
+
|
199
|
+
### How to use autoscaler
|
200
|
+
|
201
|
+
First, write a configuration file (YAML format) like below:
|
191
202
|
|
192
203
|
```yaml
|
193
204
|
# ポーリング時にupscale_triggersに指定した状態のalarmがあればstep分serviceとinstanceを増やす (max_task_countまで)
|
@@ -200,37 +211,275 @@ polling_interval: 60
|
|
200
211
|
auto_scaling_groups:
|
201
212
|
- name: ecs-cluster-nodes
|
202
213
|
region: ap-northeast-1
|
203
|
-
buffer: 1 # タスク数に対する余剰のインスタンス数
|
204
|
-
|
205
|
-
services:
|
206
|
-
- name: repro-api-production
|
207
214
|
cluster: ecs-cluster
|
215
|
+
# autoscaler will set the capacity to (buffer + desired_tasks * required_capacity).
|
216
|
+
# Adjust this value if it takes much time to prepare ECS instances and launch new tasks.
|
217
|
+
buffer: 1
|
218
|
+
services:
|
219
|
+
- name: repro-api-production
|
220
|
+
step: 1
|
221
|
+
idle_time: 240
|
222
|
+
max_task_count: [10, 25]
|
223
|
+
scheduled_min_task_count:
|
224
|
+
- {from: "1:45", to: "4:30", count: 8}
|
225
|
+
cooldown_time_for_reach_max: 600
|
226
|
+
min_task_count: 0
|
227
|
+
# Required capacity per task (default: 1)
|
228
|
+
# You should specify "binpack" as task placement strategy if the value is less than 1 and you use an auto scaling group.
|
229
|
+
required_capacity: 0.5
|
230
|
+
upscale_triggers:
|
231
|
+
- alarm_name: "ECS [repro-api-production] CPUUtilization"
|
232
|
+
state: ALARM
|
233
|
+
- alarm_name: "ELB repro-api-a HTTPCode_Backend_5XX"
|
234
|
+
state: ALARM
|
235
|
+
step: 2
|
236
|
+
downscale_triggers:
|
237
|
+
- alarm_name: "ECS [repro-api-production] CPUUtilization (low)"
|
238
|
+
state: OK
|
239
|
+
|
240
|
+
spot_fleet_requests:
|
241
|
+
- id: sfr-354de735-2c17-4565-88c9-10ada5b957e5
|
208
242
|
region: ap-northeast-1
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
243
|
+
cluster: ecs-cluster-for-worker
|
244
|
+
buffer: 1
|
245
|
+
services:
|
246
|
+
- name: repro-worker-production
|
247
|
+
step: 1
|
248
|
+
idle_time: 240
|
249
|
+
cooldown_time_for_reach_max: 600
|
250
|
+
min_task_count: 0
|
251
|
+
# Required capacity per task (default: 1)
|
252
|
+
# The capacity assumes that WeightedCapacity is equal to the number of vCPUs.
|
253
|
+
required_capacity: 2
|
254
|
+
upscale_triggers:
|
255
|
+
- alarm_name: "ECS [repro-worker-production] CPUUtilization"
|
256
|
+
state: ALARM
|
257
|
+
downscale_triggers:
|
258
|
+
- alarm_name: "ECS [repro-worker-production] CPUUtilization (low)"
|
259
|
+
state: OK
|
260
|
+
- alarm_name: "Aurora DMLLatency is high"
|
261
|
+
state: ALARM
|
262
|
+
prioritized_over_upscale_triggers: true
|
263
|
+
|
264
|
+
# If you specify `spot_instance_intrp_warns_queue_urls` as SQS queue for spot instance interruption warnings,
|
265
|
+
# autoscaler will polls them and set the state of instances to be intrrupted to "DRAINING".
|
266
|
+
# autoscaler will also waits for the capacity of active instances in the cluster being decreased
|
267
|
+
# when the capacity of spot fleet request is decreased,
|
268
|
+
# so you should specify URLs or set the state of the instances to "DRAINING" manually.
|
269
|
+
spot_instance_intrp_warns_queue_urls:
|
270
|
+
- https://sqs.ap-northeast-1.amazonaws.com/<account-id>/spot-instance-intrp-warns
|
226
271
|
```
|
227
272
|
|
273
|
+
Then, execute the following command:
|
274
|
+
|
228
275
|
```sh
|
229
276
|
ecs_auto_scaler <config yaml>
|
230
277
|
```
|
231
278
|
|
232
279
|
I recommends deploy `ecs_auto_scaler` on ECS too.
|
233
280
|
|
281
|
+
### Signals
|
282
|
+
|
283
|
+
Signal | Description
|
284
|
+
-----------|------------------------------------------------------------
|
285
|
+
TERM, INT | Shutdown gracefully
|
286
|
+
CONT | Resume auto scaling
|
287
|
+
TSTP | Pause auto scaling (Run only container instance draining)
|
288
|
+
|
289
|
+
### IAM policy for autoscaler
|
290
|
+
|
291
|
+
The following permissions are required for the preceding configuration of "repro-api-production" service:
|
292
|
+
|
293
|
+
```
|
294
|
+
{
|
295
|
+
"Version": "2012-10-17",
|
296
|
+
"Statement": [
|
297
|
+
{
|
298
|
+
"Effect": "Allow",
|
299
|
+
"Action": [
|
300
|
+
"autoscaling:DescribeAutoScalingGroups",
|
301
|
+
"cloudwatch:DescribeAlarms",
|
302
|
+
"ec2:DescribeInstances",
|
303
|
+
"ec2:TerminateInstances",
|
304
|
+
"ecs:ListTasks"
|
305
|
+
],
|
306
|
+
"Resource": "*"
|
307
|
+
},
|
308
|
+
{
|
309
|
+
"Effect": "Allow",
|
310
|
+
"Action": [
|
311
|
+
"ecs:DescribeServices",
|
312
|
+
"ecs:UpdateService"
|
313
|
+
],
|
314
|
+
"Resource": [
|
315
|
+
"arn:aws:ecs:ap-northeast-1:<account-id>:service/ecs-cluster/repro-api-production"
|
316
|
+
]
|
317
|
+
},
|
318
|
+
{
|
319
|
+
"Effect": "Allow",
|
320
|
+
"Action": [
|
321
|
+
"ecs:DescribeTasks"
|
322
|
+
],
|
323
|
+
"Resource": [
|
324
|
+
"arn:aws:ecs:ap-northeast-1:<account-id>:task/ecs-cluster/*"
|
325
|
+
]
|
326
|
+
},
|
327
|
+
{
|
328
|
+
"Effect": "Allow",
|
329
|
+
"Action": [
|
330
|
+
"autoscaling:DetachInstances",
|
331
|
+
"autoscaling:UpdateAutoScalingGroup"
|
332
|
+
],
|
333
|
+
"Resource": [
|
334
|
+
"arn:aws:autoscaling:ap-northeast-1:<account-id>:autoScalingGroup:<group-id>:autoScalingGroupName/ecs-cluster-nodes"
|
335
|
+
]
|
336
|
+
},
|
337
|
+
{
|
338
|
+
"Effect": "Allow",
|
339
|
+
"Action": [
|
340
|
+
"ecs:DescribeContainerInstances"
|
341
|
+
],
|
342
|
+
"Resource": [
|
343
|
+
"arn:aws:ecs:ap-northeast-1:<account-id>:container-instance/ecs-cluster/*"
|
344
|
+
]
|
345
|
+
},
|
346
|
+
{
|
347
|
+
"Effect": "Allow",
|
348
|
+
"Action": [
|
349
|
+
"ecs:DeregisterContainerInstance",
|
350
|
+
"ecs:ListContainerInstances"
|
351
|
+
],
|
352
|
+
"Resource": [
|
353
|
+
"arn:aws:ecs:ap-northeast-1:<account-id>:cluster/ecs-cluster"
|
354
|
+
]
|
355
|
+
}
|
356
|
+
]
|
357
|
+
}
|
358
|
+
```
|
359
|
+
|
360
|
+
If you use spot instances, additional permissions are required like below:
|
361
|
+
|
362
|
+
```
|
363
|
+
{
|
364
|
+
"Version": "2012-10-17",
|
365
|
+
"Statement": [
|
366
|
+
{
|
367
|
+
"Effect": "Allow",
|
368
|
+
"Action": "ecs:UpdateContainerInstancesState",
|
369
|
+
"Resource": "arn:aws:ecs:ap-northeast-1:<account-id>:container-instance/ecs-cluster/*"
|
370
|
+
},
|
371
|
+
{
|
372
|
+
"Effect": "Allow",
|
373
|
+
"Action": [
|
374
|
+
"sqs:DeleteMessage",
|
375
|
+
"sqs:DeleteMessageBatch",
|
376
|
+
"sqs:ReceiveMessage"
|
377
|
+
],
|
378
|
+
"Resource": "arn:aws:sqs:ap-northeast-1:<account-id>:spot-instance-intrp-warns"
|
379
|
+
}
|
380
|
+
]
|
381
|
+
}
|
382
|
+
```
|
383
|
+
|
384
|
+
The following permissions are required for the preceding configuration of "repro-worker-production" service:
|
385
|
+
|
386
|
+
```
|
387
|
+
{
|
388
|
+
"Version": "2012-10-17",
|
389
|
+
"Statement": [
|
390
|
+
{
|
391
|
+
"Effect": "Allow",
|
392
|
+
"Action": [
|
393
|
+
"sqs:DeleteMessage",
|
394
|
+
"sqs:DeleteMessageBatch",
|
395
|
+
"sqs:ReceiveMessage"
|
396
|
+
],
|
397
|
+
"Resource": "arn:aws:sqs:ap-northeast-1:<account-id>:spot-instance-intrp-warns"
|
398
|
+
},
|
399
|
+
{
|
400
|
+
"Effect": "Allow",
|
401
|
+
"Action": [
|
402
|
+
"cloudwatch:DescribeAlarms",
|
403
|
+
"ec2:DescribeInstances",
|
404
|
+
"ec2:DescribeSpotFleetInstances",
|
405
|
+
"ec2:DescribeSpotFleetRequests",
|
406
|
+
"ec2:ModifySpotFleetRequest",
|
407
|
+
"ec2:TerminateInstances",
|
408
|
+
"ecs:ListTasks"
|
409
|
+
],
|
410
|
+
"Resource": "*"
|
411
|
+
},
|
412
|
+
{
|
413
|
+
"Effect": "Allow",
|
414
|
+
"Action": [
|
415
|
+
"ecs:DescribeServices",
|
416
|
+
"ecs:UpdateService"
|
417
|
+
],
|
418
|
+
"Resource": [
|
419
|
+
"arn:aws:ecs:ap-northeast-1:<account-id>:service/ecs-cluster-for-worker/repro-worker-production"
|
420
|
+
]
|
421
|
+
},
|
422
|
+
{
|
423
|
+
"Effect": "Allow",
|
424
|
+
"Action": [
|
425
|
+
"ecs:DescribeTasks"
|
426
|
+
],
|
427
|
+
"Resource": [
|
428
|
+
"arn:aws:ecs:ap-northeast-1:<account-id>:task/ecs-cluster-for-worker/*"
|
429
|
+
]
|
430
|
+
},
|
431
|
+
{
|
432
|
+
"Effect": "Allow",
|
433
|
+
"Action": [
|
434
|
+
"ecs:DescribeContainerInstances",
|
435
|
+
"ecs:UpdateContainerInstancesState"
|
436
|
+
],
|
437
|
+
"Resource": [
|
438
|
+
"arn:aws:ecs:ap-northeast-1:<account-id>:container-instance/ecs-cluster-for-worker/*"
|
439
|
+
]
|
440
|
+
},
|
441
|
+
{
|
442
|
+
"Effect": "Allow",
|
443
|
+
"Action": [
|
444
|
+
"ecs:ListContainerInstances"
|
445
|
+
],
|
446
|
+
"Resource": [
|
447
|
+
"arn:aws:ecs:ap-northeast-1:<account-id>:cluster/ecs-cluster-for-worker"
|
448
|
+
]
|
449
|
+
}
|
450
|
+
]
|
451
|
+
}
|
452
|
+
```
|
453
|
+
|
454
|
+
### How to deploy faster with Auto Scaling Group
|
455
|
+
|
456
|
+
Add following configuration to your deploy.rb and hooks if you need.
|
457
|
+
|
458
|
+
```ruby
|
459
|
+
# deploy.rb
|
460
|
+
set :ecs_instance_fluctuation_manager_configs, [
|
461
|
+
{
|
462
|
+
region: "ap-northeast-1",
|
463
|
+
cluster: "CLUSTER_NAME",
|
464
|
+
auto_scaling_group_name: "AUTO_SCALING_GROUP_NAME",
|
465
|
+
desired_capacity: 20, # original capacity of auto scaling group
|
466
|
+
}
|
467
|
+
]
|
468
|
+
```
|
469
|
+
|
470
|
+
This configuration enables tasks `ecs:increase_instances_to_max_size` and `ecs:terminate_redundant_instances`.
|
471
|
+
If this configuration is not set, the above tasks do nothing.
|
472
|
+
The task `ecs:increase_instances_to_max_size` will increase ECS instances.
|
473
|
+
The task `ecs:terminate_redundant_instances` will decrease ECS instances considering AZ balance.
|
474
|
+
|
475
|
+
Hook configuration example:
|
476
|
+
|
477
|
+
```ruby
|
478
|
+
after "deploy:updating", "ecs:increase_instances_to_max_size"
|
479
|
+
after "deploy:finished", "ecs:terminate_redundant_instances"
|
480
|
+
after "deploy:failed", "ecs:terminate_redundant_instances"
|
481
|
+
```
|
482
|
+
|
234
483
|
## Development
|
235
484
|
|
236
485
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
data/ecs_deploy.gemspec
CHANGED
@@ -18,10 +18,16 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "aws-sdk", "~>
|
21
|
+
spec.add_runtime_dependency "aws-sdk-autoscaling", "~> 1"
|
22
|
+
spec.add_runtime_dependency "aws-sdk-cloudwatch", "~> 1"
|
23
|
+
spec.add_runtime_dependency "aws-sdk-cloudwatchevents", "~> 1"
|
24
|
+
spec.add_runtime_dependency "aws-sdk-ec2", "~> 1"
|
25
|
+
spec.add_runtime_dependency "aws-sdk-ecs", "~> 1"
|
26
|
+
spec.add_runtime_dependency "aws-sdk-sqs", "~> 1"
|
22
27
|
spec.add_runtime_dependency "terminal-table"
|
23
28
|
spec.add_runtime_dependency "paint"
|
24
29
|
|
25
|
-
spec.add_development_dependency "bundler", "
|
26
|
-
spec.add_development_dependency "rake", "
|
30
|
+
spec.add_development_dependency "bundler", ">= 1.11", "< 3"
|
31
|
+
spec.add_development_dependency "rake", ">= 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
33
|
end
|