ecs_deployer 2.1.13 → 2.2.0
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 +4 -4
- data/README.md +4 -13
- data/lib/ecs_deployer/cli.rb +4 -2
- data/lib/ecs_deployer/service/client.rb +32 -25
- data/lib/ecs_deployer/version.rb +1 -1
- metadata +2 -3
- data/config.local.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 074c9a43276dd4667e47d6177aa20fdfb2b65d85dda2f40c79184b2a2a63d938
|
4
|
+
data.tar.gz: b2ed769b0f71267662bbbe9e6c5130498377f2865c1dd933eb1560f4eb3149cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe22a8d339905fcb4300951a4bf48c502a34d19974ce9c1cc871dcecde0c3140bc6eeed9854dc68bf832e84ac107be6d3b6a64d8f9c8d27deb081be6da3f916e
|
7
|
+
data.tar.gz: 1a049a1f2d7d8794fa96b61b30039e19833fca8dfa4ae3559befb4681b7aa95da83c37ff957182a84589569f78aac2444a9b28c817d24f963ee7d1518be1a692
|
data/README.md
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
# Release news
|
2
|
-
|
3
|
-
I developed ECS deployment tool based on `ecs_deployer`.
|
4
|
-
|
5
|
-
http://github.com/metaps/genova
|
6
|
-
|
7
1
|
# ECS Deployer
|
8
2
|
|
9
3
|
[](https://badge.fury.io/rb/ecs_deployer)
|
@@ -11,9 +5,10 @@ http://github.com/metaps/genova
|
|
11
5
|
[](https://codeclimate.com/github/naomichi-y/ecs_deployer)
|
12
6
|
[](https://circleci.com/gh/naomichi-y/ecs_deployer/tree/master)
|
13
7
|
|
14
|
-
##
|
8
|
+
## Features
|
15
9
|
|
16
|
-
|
10
|
+
This package provides ability to deploy tasks to AWS ECS.
|
11
|
+
The library is used by [genova](https://github.com/metaps/genova).
|
17
12
|
|
18
13
|
* Task
|
19
14
|
* Create
|
@@ -23,8 +18,6 @@ Deploy Docker container on AWS ECS.
|
|
23
18
|
* Create
|
24
19
|
* Update
|
25
20
|
|
26
|
-
This package is used in [Genova (ECS Deployment Manager)](https://github.com/metaps/genova).
|
27
|
-
|
28
21
|
## Installation
|
29
22
|
|
30
23
|
Add this line to your application's Gemfile:
|
@@ -70,7 +63,7 @@ Encrypted values must be enclosed in `${XXX}`.
|
|
70
63
|
```yaml
|
71
64
|
- environment:
|
72
65
|
- name: MYSQL_ROOT_PASSWORD
|
73
|
-
value: ${
|
66
|
+
value: ${...}
|
74
67
|
```
|
75
68
|
|
76
69
|
Values are decrypted when task is created.
|
@@ -87,8 +80,6 @@ deployer.register_task('development.yml', tag: 'latest')
|
|
87
80
|
|
88
81
|
### CLI
|
89
82
|
|
90
|
-
Please create `.env` from `.env.default` file, before running.
|
91
|
-
|
92
83
|
#### Register new task
|
93
84
|
|
94
85
|
```bash
|
data/lib/ecs_deployer/cli.rb
CHANGED
@@ -11,6 +11,8 @@ module EcsDeployer
|
|
11
11
|
@aws_options[:profile] = options[:profile] if options[:profile]
|
12
12
|
@aws_options[:region] = options[:region] if options[:region]
|
13
13
|
|
14
|
+
@logger = Logger.new(STDOUT)
|
15
|
+
|
14
16
|
nil
|
15
17
|
end
|
16
18
|
|
@@ -37,12 +39,12 @@ module EcsDeployer
|
|
37
39
|
option :wait, type: :boolean, default: true
|
38
40
|
option :wait_timeout, type: :numeric, default: 600
|
39
41
|
def update_service
|
40
|
-
deploy_client = EcsDeployer::Client.new(options[:cluster],
|
42
|
+
deploy_client = EcsDeployer::Client.new(options[:cluster], @logger, @aws_options)
|
41
43
|
service_client = deploy_client.service
|
42
44
|
service_client.wait_timeout = options[:wait_timeout]
|
43
45
|
result = service_client.update(options[:service], nil, options[:wait])
|
44
46
|
|
45
|
-
puts "
|
47
|
+
puts "Service has been successfully updated: #{result.service_arn}"
|
46
48
|
end
|
47
49
|
|
48
50
|
desc 'encrypt', 'Encrypt value of argument with KMS.'
|
@@ -90,25 +90,24 @@ module EcsDeployer
|
|
90
90
|
desired_status: 'RUNNING'
|
91
91
|
)
|
92
92
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
93
|
+
new_task_count = 0
|
94
|
+
status_logs = []
|
95
|
+
|
96
|
+
if result[:task_arns].size.positive?
|
97
|
+
result = @ecs.describe_tasks(
|
98
|
+
cluster: @cluster,
|
99
|
+
tasks: result[:task_arns]
|
100
|
+
)
|
101
|
+
|
102
|
+
result[:tasks].each do |task|
|
103
|
+
new_task_count += 1 if task_definition_arn == task[:task_definition_arn] && task[:last_status] == 'RUNNING'
|
104
|
+
status_logs << " #{task[:task_definition_arn]} [#{task[:last_status]}]"
|
105
|
+
end
|
106
106
|
end
|
107
107
|
|
108
108
|
{
|
109
|
-
|
110
|
-
|
111
|
-
task_status_logs: task_status_logs
|
109
|
+
new_task_count: new_task_count,
|
110
|
+
status_logs: status_logs
|
112
111
|
}
|
113
112
|
end
|
114
113
|
|
@@ -118,30 +117,38 @@ module EcsDeployer
|
|
118
117
|
raise ServiceNotFoundError, "'#{service}' service is not found." unless exist?(service)
|
119
118
|
|
120
119
|
wait_time = 0
|
121
|
-
@logger.info 'Start
|
120
|
+
@logger.info 'Start deployment.'
|
121
|
+
|
122
|
+
result = @ecs.describe_services(
|
123
|
+
cluster: @cluster,
|
124
|
+
services: [service]
|
125
|
+
)
|
126
|
+
desired_count = result[:services][0][:desired_count]
|
122
127
|
|
123
128
|
loop do
|
124
129
|
sleep(@polling_interval)
|
125
130
|
wait_time += @polling_interval
|
126
131
|
result = deploy_status(service, task_definition_arn)
|
127
132
|
|
128
|
-
@logger.info "
|
133
|
+
@logger.info "Updating... [#{result[:new_task_count]}/#{desired_count}] (#{wait_time} seconds elapsed)"
|
129
134
|
@logger.info "New task: #{task_definition_arn}"
|
130
135
|
@logger.info LOG_SEPARATOR
|
131
136
|
|
132
|
-
result[:
|
133
|
-
|
134
|
-
|
137
|
+
if result[:status_logs].count.positive?
|
138
|
+
result[:status_logs].each do |log|
|
139
|
+
@logger.info log
|
140
|
+
end
|
135
141
|
|
136
|
-
|
142
|
+
@logger.info LOG_SEPARATOR
|
143
|
+
end
|
137
144
|
|
138
|
-
if result[:
|
139
|
-
@logger.info "Service update succeeded. [#{result[:
|
145
|
+
if result[:new_task_count] == desired_count
|
146
|
+
@logger.info "Service update succeeded. [#{result[:new_task_count]}/#{desired_count}]"
|
140
147
|
@logger.info "New task definition: #{task_definition_arn}"
|
141
148
|
|
142
149
|
break
|
143
150
|
else
|
144
|
-
@logger.info 'You can stop process with Ctrl+C. Deployment
|
151
|
+
@logger.info 'You can stop process with Ctrl+C. Deployment continues in background.'
|
145
152
|
|
146
153
|
if wait_time > @wait_timeout
|
147
154
|
@logger.info "New task definition: #{task_definition_arn}"
|
data/lib/ecs_deployer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecs_deployer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- naomichi-y
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -182,7 +182,6 @@ files:
|
|
182
182
|
- bin/console
|
183
183
|
- bin/setup
|
184
184
|
- circle.yml
|
185
|
-
- config.local.yml
|
186
185
|
- config.yml
|
187
186
|
- ecs_deployer.gemspec
|
188
187
|
- example/register_task.rb
|
data/config.local.yml
DELETED