ecs_deployer 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 444e5bc59a8e36d802159972a87f2666be7c9290
4
- data.tar.gz: bfd5c946ae731fa11a5f26f0d4d47e544ca305cf
3
+ metadata.gz: 20871c53d17d5880cbad461a406946237eefc9af
4
+ data.tar.gz: 448e81e983fde427f655c58c338d44fdce0b96dd
5
5
  SHA512:
6
- metadata.gz: 71bdb245b4cc67c7ec6bbbd428d462668d93a0c2de76874dd6f0c5e0167139b154657215f49af924604139aeba4493ca01b5e92ef9977a5d32d169f61218a626
7
- data.tar.gz: 85d0213211ba7807c2b0897e565543f63991bb009302a3cfba316c54c82c7e758238f08f6c78772539f83199b255ae235735cf95e6aff9b97084d0c0c7b2fe93
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/task.yml', File.dirname(File.realpath(__FILE__)))
4
+ task_path = File.expand_path('./fixtures/production.yml', File.dirname(File.realpath(__FILE__)))
5
5
 
6
- ecs_deployer = EcsDeployer::Client.new('cluster_name')
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
@@ -6,4 +6,5 @@ module EcsDeployer
6
6
  class ServiceNotFoundError < EcsDeployer::Error; end
7
7
  class TaskNotFoundError < EcsDeployer::Error; end
8
8
  class DeployTimeoutError < EcsDeployer::Error; end
9
+ class CommandError < EcsDeployer::Error; end
9
10
  end
@@ -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 EcsCommandError.new unless result.buffered_stderr.empty?
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
@@ -1,3 +1,3 @@
1
1
  module EcsDeployer
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecs_deployer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - naomichi-y