simplygenius-atmos 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02b47aaaf544e268b0d3a9a9d6a69d8165f165ef9e9e500753ec8c87787228b4
4
- data.tar.gz: 673992076c584283ee340d683a5a0c5aa8d9c9b0c4203cac7c96250480a012a1
3
+ metadata.gz: 967259ac48e43b57455a18b59e4aa5ce3e8f3c45ce4497a069668d8539191c7d
4
+ data.tar.gz: 61cc1ca6c174588587b1982f5e6de1ba08c59690610503bffd1a05ee40e9d4bc
5
5
  SHA512:
6
- metadata.gz: a4a7fc7d2c74988b22482c4252023fb4ecd1f0216bb8f28b0e802b5ee7a4532a4fa6f995cca60f11e7015545d20566463d577f3cb656240563436490a4c70237
7
- data.tar.gz: 2396303b7e6ce14afc455597477be362f3ea77a3540d6187ec743efe2a2f48dcc8ab5f2fc7a2175da3ad2e5addeeb72f6b1dabaeb2ebc9d2a85262ad8a70cdd8
6
+ metadata.gz: 150ea6f5147379574f36df0fc62d8102d9be7e3cab4254c3df9b78d0734b0916f91b715d59b976eeaf8a0643e889b0817b23f5ede32ebfaac11101587f9f7ff7
7
+ data.tar.gz: cb82a1291212a3b6d2e6cf7642dfc15653f4a5525438041655dee5d95a6e66890c50c40b9d2bcd5381af5939742019b0bf858c14c2f9d4eaf44a3faccaa7e751
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ 0.9.4 (03/20/2019)
2
+ ------------------
3
+
4
+ * allow deploying the same image to multiple services and make task vs service auto detected [9f841d7](https://github.com/simplygenius/atmos/commit/9f841d7)
5
+ * fix link [deba98f](https://github.com/simplygenius/atmos/commit/deba98f)
6
+
1
7
  0.9.3 (02/12/2019)
2
8
  ------------------
3
9
 
data/README.md CHANGED
@@ -62,7 +62,7 @@ The [terraform docs](https://www.terraform.io/docs/index.html) are excellent.
62
62
 
63
63
  ## Quickstart
64
64
 
65
- See the [screencast](https://simplygenius.wistia.com/projects/h595iz9tbq) for a detailed walkthrough (~1 hour) of the quickstart. Or try the [condensed screencast](https://simplygenius.wistia.com/medias/2syql5mnud) if you just want to take a quick look (~7m)
65
+ See the [screencast](https://simplygenius.wistia.com/medias/zamoxtlqe0) for a detailed walkthrough (~1 hour) of the quickstart. Or try the [condensed screencast](https://simplygenius.wistia.com/medias/2syql5mnud) if you just want to take a quick look (~7m)
66
66
 
67
67
  [Create an AWS account](https://portal.aws.amazon.com/billing/signup)
68
68
  Setup root account access keys, make note of the numeric account id
@@ -24,17 +24,14 @@ module SimplyGenius
24
24
  option ["-i", "--image"],
25
25
  "IMAGE", "The local container image to deploy\nDefaults to service/task name"
26
26
 
27
- option ["-t", "--task"],
28
- :flag, "Deploy as a task, not a service\n"
29
-
30
27
  option ["-v", "--revision"],
31
28
  "REVISION", "Use as the remote image revision\n"
32
29
 
33
- parameter "NAME",
34
- "The name of the service (or task) to deploy"
30
+ parameter "NAME ...",
31
+ "The name of the service (or task) to deploy\nWhen multiple, the first is the primary, and\nthe rest get deployed with its image"
35
32
 
36
33
  def default_image
37
- name
34
+ name_list.first
38
35
  end
39
36
 
40
37
  def execute
@@ -42,11 +39,14 @@ module SimplyGenius
42
39
  ClimateControl.modify(auth_env) do
43
40
  mgr = Atmos.config.provider.container_manager
44
41
 
45
- result = mgr.push(name, image, revision: revision)
46
- if task?
47
- result = result.merge(mgr.deploy_task(name, result[:remote_image]))
48
- else
49
- result = result.merge(mgr.deploy_service(cluster, name, result[:remote_image]))
42
+ primary_name = name_list.first
43
+
44
+ result = mgr.push(primary_name, image, revision: revision)
45
+
46
+ name_list.each do |name|
47
+ resp = mgr.deploy(cluster, name, result[:remote_image])
48
+ result[:task_definitions] ||= []
49
+ result[:task_definitions] << resp[:task_definition]
50
50
  end
51
51
 
52
52
  logger.info "Container deployed:\n #{display result}"
@@ -40,23 +40,23 @@ module SimplyGenius
40
40
  logger.info "Tagging local image '#{local_image}' with #{tags}"
41
41
  tags.each {|t| run("docker", "tag", local_image, "#{ecs_image}:#{t}") }
42
42
 
43
- logger.info "Pushing tagged image to ECR repo"
43
+ logger.info "Pushing tagged image to ECR repo #{ecs_image}"
44
44
  tags.each {|t| run("docker", "push", "#{ecs_image}:#{t}") }
45
45
 
46
46
  result[:remote_image] = "#{ecs_image}:#{revision}"
47
47
  return result
48
48
  end
49
49
 
50
- def deploy_task(task, remote_image)
50
+ def deploy_task(name, remote_image)
51
51
  result = {}
52
52
 
53
53
  ecs = ::Aws::ECS::Client.new
54
54
  resp = nil
55
55
 
56
- resp = ecs.list_task_definitions(family_prefix: task, sort: 'DESC')
56
+ resp = ecs.list_task_definitions(family_prefix: name, sort: 'DESC')
57
57
  latest_defn_arn = resp.task_definition_arns.first
58
58
 
59
- logger.info "Latest task definition: #{latest_defn_arn}"
59
+ logger.info "Current task definition for #{name}: #{latest_defn_arn}"
60
60
 
61
61
  resp = ecs.describe_task_definition(task_definition: latest_defn_arn)
62
62
  latest_defn = resp.task_definition
@@ -71,31 +71,28 @@ module SimplyGenius
71
71
  resp = ecs.register_task_definition(**new_defn)
72
72
  result[:task_definition] = resp.task_definition.task_definition_arn
73
73
 
74
- logger.info "Updated task=#{task} to #{result[:task_definition]} with image #{remote_image}"
74
+ logger.info "Updated task=#{name} to #{result[:task_definition]} with image #{remote_image}"
75
75
 
76
76
  return result
77
77
  end
78
78
 
79
- def deploy_service(cluster, service, remote_image)
80
- result = {}
79
+ def deploy(cluster, name, remote_image)
80
+ result = deploy_task(name, remote_image)
81
+ new_taskdef = result[:task_definition]
81
82
 
83
+ # Only trigger restart if name is a service
82
84
  ecs = ::Aws::ECS::Client.new
83
- resp = nil
84
-
85
- # Get current task definition name from service
86
- resp = ecs.describe_services(cluster: cluster, services: [service])
87
- current_defn_arn = resp.services.first.task_definition
88
- defn_name = current_defn_arn.split("/").last.split(":").first
89
-
90
- logger.info "Current task definition (name=#{defn_name}): #{current_defn_arn}"
91
- result = deploy_task(defn_name, remote_image)
92
- new_taskdef = result[:task_definition]
85
+ resp = ecs.describe_services(cluster: cluster, services: [name])
93
86
 
94
- logger.info "Updating service with new task definition: #{new_taskdef}"
87
+ if resp.services.size > 0
88
+ logger.info "Updating service with new task definition: #{new_taskdef}"
95
89
 
96
- resp = ecs.update_service(cluster: cluster, service: service, task_definition: new_taskdef)
90
+ resp = ecs.update_service(cluster: cluster, service: name, task_definition: new_taskdef)
97
91
 
98
- logger.info "Updated service=#{service} on cluster=#{cluster} to #{new_taskdef} with image #{remote_image}"
92
+ logger.info "Updated service=#{name} on cluster=#{cluster} to #{new_taskdef} with image #{remote_image}"
93
+ else
94
+ logger.info "#{name} is not a service"
95
+ end
99
96
 
100
97
  return result
101
98
  end
@@ -1,5 +1,5 @@
1
1
  module SimplyGenius
2
2
  module Atmos
3
- VERSION = "0.9.3"
3
+ VERSION = "0.9.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplygenius-atmos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Conway
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-13 00:00:00.000000000 Z
11
+ date: 2019-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler