ecs_deployer 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +29 -0
- data/example/sample.rb +3 -2
- data/lib/ecs_deployer.rb +1 -0
- data/lib/ecs_deployer/client.rb +6 -1
- data/lib/ecs_deployer/commander.rb +6 -3
- data/lib/ecs_deployer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20871c53d17d5880cbad461a406946237eefc9af
|
4
|
+
data.tar.gz: 448e81e983fde427f655c58c338d44fdce0b96dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0defb0456435c369c9d702b80cf17a978dcc3cf6519a38fac98c8d50ea1b7e4d2e14c790add458e3e2637a0e4640c77a3ce73d82c84ec0d7934103f8dc80a8b
|
7
|
+
data.tar.gz: 9d40483d9921c311b35804d14562fea2eda070274d54924279af12dc87029b57d19547ba943dd0a7c22023841358f5b6f3d5f1b68830311bac5d41fcbac819c6
|
data/README.md
CHANGED
@@ -18,6 +18,35 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install ecs_deployer
|
20
20
|
|
21
|
+
## Task definition
|
22
|
+
|
23
|
+
Write task definition in YAML format.
|
24
|
+
For available parameters see [Task Definition Parameters](http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html).
|
25
|
+
The sample file is in `example/fixtures/task.yml`.
|
26
|
+
|
27
|
+
```
|
28
|
+
containerDefinitions:
|
29
|
+
- name: wordpress
|
30
|
+
links:
|
31
|
+
- mysql
|
32
|
+
image: wordpress
|
33
|
+
essential: true
|
34
|
+
portMappings:
|
35
|
+
- containerPort: 80
|
36
|
+
hostPort: 80
|
37
|
+
memory: 500
|
38
|
+
cpu: 10
|
39
|
+
- environment:
|
40
|
+
- name: MYSQL_ROOT_PASSWORD
|
41
|
+
value: password
|
42
|
+
name: mysql
|
43
|
+
image: mysql
|
44
|
+
cpu: 10
|
45
|
+
memory: 500
|
46
|
+
essential: true
|
47
|
+
family: hello_world
|
48
|
+
```
|
49
|
+
|
21
50
|
## Usage
|
22
51
|
|
23
52
|
```
|
data/example/sample.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
require 'ecs_deployer'
|
3
3
|
|
4
|
-
task_path = File.expand_path('./fixtures/
|
4
|
+
task_path = File.expand_path('./fixtures/production.yml', File.dirname(File.realpath(__FILE__)))
|
5
5
|
|
6
|
-
ecs_deployer = EcsDeployer::Client.new('
|
6
|
+
ecs_deployer = EcsDeployer::Client.new('sandbox-ecs-production')
|
7
7
|
ecs_deployer.register_task(task_path)
|
8
8
|
ecs_deployer.update_service('application')
|
9
|
+
# ecs_deployer.log
|
data/lib/ecs_deployer.rb
CHANGED
data/lib/ecs_deployer/client.rb
CHANGED
@@ -51,7 +51,12 @@ module EcsDeployer
|
|
51
51
|
def update_service(service_name, wait = true, timeout = 300)
|
52
52
|
register_clone_task(service_name) if @new_task_definition_arn.empty?
|
53
53
|
@ecs_command.update_service(service_name, @family_name, @revision)
|
54
|
-
wait_for_deploy if wait
|
54
|
+
wait_for_deploy(service_name, timeout) if wait
|
55
|
+
end
|
56
|
+
|
57
|
+
# @return [String]
|
58
|
+
def log
|
59
|
+
@ecs_command.log
|
55
60
|
end
|
56
61
|
|
57
62
|
private
|
@@ -77,6 +77,11 @@ module EcsDeployer
|
|
77
77
|
exec('register-task-definition', args)
|
78
78
|
end
|
79
79
|
|
80
|
+
# @return [String]
|
81
|
+
def log
|
82
|
+
@runtime.buffered_log
|
83
|
+
end
|
84
|
+
|
80
85
|
private
|
81
86
|
# @param [String] command
|
82
87
|
# @param [Hash] args
|
@@ -93,12 +98,10 @@ module EcsDeployer
|
|
93
98
|
command = "aws ecs #{command} #{arg}"
|
94
99
|
result = @runtime.exec(command)
|
95
100
|
|
96
|
-
raise
|
101
|
+
raise CommandError.new unless result.buffered_stderr.empty?
|
97
102
|
|
98
103
|
result = result.buffered_stdout
|
99
104
|
Oj.load(result)
|
100
105
|
end
|
101
106
|
end
|
102
|
-
|
103
|
-
class EcsCommandError < RuntimeError; end
|
104
107
|
end
|
data/lib/ecs_deployer/version.rb
CHANGED