ufo 4.1.6 → 4.1.7

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: a483c161490cb3856ee429ffa12e4d75d8443a00bb8712d0274b322dc7eb7a00
4
- data.tar.gz: 4fbe98c516f119218a9eaedde01f81221163412855b62ca726bd6dc935e6f7b7
3
+ metadata.gz: 75ec49e17bcba80691ed111954edc66403d8144536be56168665db85db974768
4
+ data.tar.gz: f60ee60c3dd19a8ed44dd7788811c3003dc5d73f6276d5715a4a0c32fdcbcba4
5
5
  SHA512:
6
- metadata.gz: f11255a49c787365803f8514de49a0a6be79d658b2b5fcca701cfa0fb41c903a1238b6b70dd75fb92f3da3f15d28e22c9295655787f280577f8a363581e18918
7
- data.tar.gz: c5b98c8fe3985efd2dc849e84e39c751e469678585bc71fcc6cca09483bb52c4983cc22dba5173b0a12c05ae4c3288995ba1c84f718fdcce3e4fb520867f6aee
6
+ metadata.gz: 15bc1ff63ee2f7c9cf959f2ee2da0dba750a8447ffb3a40ad22703050b28160b57329b1b8ca6f716298b62dd44b457fdebf8519921bb03139e634b3de40761af
7
+ data.tar.gz: e52d45d8e7c5900fb8c8bcc2851781bf94300f630eb5587629c1e612d187e3eb37526d26ec46296e7a35c1870db72d405216ced9811b1ebbd716a5990951e7ad
@@ -3,6 +3,9 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [4.1.7]
7
+ - add scheduling-strategy option #55 from tongueroo/scheduling-strategy
8
+
6
9
  ## [4.1.6]
7
10
  - update bin/deploy starter wrapper
8
11
  - update quick start with note about ecr image
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ufo (4.1.6)
4
+ ufo (4.1.7)
5
5
  aws-sdk-cloudformation
6
6
  aws-sdk-cloudwatchlogs
7
7
  aws-sdk-ec2
@@ -25,19 +25,19 @@ GEM
25
25
  minitest (~> 5.1)
26
26
  tzinfo (~> 1.1)
27
27
  aws-eventstream (1.0.1)
28
- aws-partitions (1.107.0)
29
- aws-sdk-cloudformation (1.10.0)
28
+ aws-partitions (1.111.0)
29
+ aws-sdk-cloudformation (1.11.0)
30
30
  aws-sdk-core (~> 3, >= 3.26.0)
31
31
  aws-sigv4 (~> 1.0)
32
32
  aws-sdk-cloudwatchlogs (1.10.0)
33
33
  aws-sdk-core (~> 3, >= 3.26.0)
34
34
  aws-sigv4 (~> 1.0)
35
- aws-sdk-core (3.36.0)
35
+ aws-sdk-core (3.38.0)
36
36
  aws-eventstream (~> 1.0)
37
37
  aws-partitions (~> 1.0)
38
38
  aws-sigv4 (~> 1.0)
39
39
  jmespath (~> 1.0)
40
- aws-sdk-ec2 (1.54.0)
40
+ aws-sdk-ec2 (1.56.0)
41
41
  aws-sdk-core (~> 3, >= 3.26.0)
42
42
  aws-sigv4 (~> 1.0)
43
43
  aws-sdk-ecr (1.8.0)
@@ -55,7 +55,7 @@ GEM
55
55
  codeclimate-test-reporter (1.0.9)
56
56
  simplecov (<= 0.13)
57
57
  colorize (0.8.1)
58
- concurrent-ruby (1.0.5)
58
+ concurrent-ruby (1.1.3)
59
59
  deep_merge (1.2.1)
60
60
  diff-lcs (1.3)
61
61
  docile (1.1.5)
@@ -90,7 +90,7 @@ GEM
90
90
  simplecov-html (~> 0.10.0)
91
91
  simplecov-html (0.10.2)
92
92
  text-table (1.2.4)
93
- thor (0.20.0)
93
+ thor (0.20.3)
94
94
  thread_safe (0.3.6)
95
95
  tilt (2.0.8)
96
96
  tzinfo (1.2.5)
@@ -54,23 +54,24 @@ A more detailed post is available here: [How to Create Unlimited Extra Environme
54
54
  ## Options
55
55
 
56
56
  ```
57
- [--ecr-keep=N] # ECR specific cleanup of old images. Specifies how many images to keep. Only runs if the images are ECR images. Defaults keeps all images.
58
- [--elb=ELB] # Decides to create elb, not create elb or use existing target group.
59
- [--elb-eip-ids=one two three] # EIP Allocation ids to use for network load balancer.
60
- [--elb-type=ELB_TYPE] # ELB type: application or network. Keep current deployed elb type when not specified.
61
- [--pretty], [--no-pretty] # Pretty format the json for the task definitions
62
- # Default: true
63
- [--stop-old-tasks], [--no-stop-old-tasks] # Stop old tasks as part of deployment to speed it up
64
- [--task=TASK] # ECS task name, to override the task name convention.
65
- [--wait], [--no-wait] # Wait for deployment to complete
66
- # Default: true
67
- [--register], [--no-register] # Register task definition
68
- # Default: true
69
- [--build], [--no-build] # Build task definition
70
- # Default: true
71
- [--verbose], [--no-verbose]
72
- [--mute], [--no-mute]
73
- [--noop], [--no-noop]
74
- [--cluster=CLUSTER] # Cluster. Overrides .ufo/settings.yml.
57
+ [--ecr-keep=N] # ECR specific cleanup of old images. Specifies how many images to keep. Only runs if the images are ECR images. Defaults keeps all images.
58
+ [--elb=ELB] # Decides to create elb, not create elb or use existing target group.
59
+ [--elb-eip-ids=one two three] # EIP Allocation ids to use for network load balancer.
60
+ [--elb-type=ELB_TYPE] # ELB type: application or network. Keep current deployed elb type when not specified.
61
+ [--pretty], [--no-pretty] # Pretty format the json for the task definitions
62
+ # Default: true
63
+ [--scheduling-strategy=SCHEDULING_STRATEGY] # Scheduling strategy to use for the service. IE: replica, daemon
64
+ [--stop-old-tasks], [--no-stop-old-tasks] # Stop old tasks as part of deployment to speed it up
65
+ [--task=TASK] # ECS task name, to override the task name convention.
66
+ [--wait], [--no-wait] # Wait for deployment to complete
67
+ # Default: true
68
+ [--register], [--no-register] # Register task definition
69
+ # Default: true
70
+ [--build], [--no-build] # Build task definition
71
+ # Default: true
72
+ [--verbose], [--no-verbose]
73
+ [--mute], [--no-mute]
74
+ [--noop], [--no-noop]
75
+ [--cluster=CLUSTER] # Cluster. Overrides .ufo/settings.yml.
75
76
  ```
76
77
 
@@ -25,7 +25,7 @@ The ECS service gets created if the service does not yet exist on the cluster.
25
25
 
26
26
  ### Conventions
27
27
 
28
- By convention the task and service names match. If you need override to this convention then you can specific the task. For example if you want to ship to the `demo-web-1` service and use the `demo-web` task, run:
28
+ By convention, the task and service names match. If you need to override this convention, then you can use the task option. For example, if you want to ship to the `demo-web-1` service and use the `demo-web` task, run:
29
29
 
30
30
  ufo ship demo-web-1 --task demo-web
31
31
 
@@ -69,7 +69,7 @@ Let's you want skip the docker build phase and only want use ufo to deploy a tas
69
69
 
70
70
  ### Not Waiting for Deployments to Complete
71
71
 
72
- By default when ufo updates the ECS service with the new task definition it does so synchronuously. It'll wait until the CloudFormation stack finishes. You can make it asynchronuously with the `--no-wait` option:
72
+ By default when ufo updates the ECS service with the new task definition, it does so synchronuously. It'll wait until the CloudFormation stack finishes. You can make it asynchronuously with the `--no-wait` option:
73
73
 
74
74
  ufo ship demo-web --no-wait
75
75
 
@@ -88,7 +88,7 @@ Refer to [Route53 Support](http://ufoships.com/docs/route53-support/) for more i
88
88
 
89
89
  ### Cleaning up Docker Images Automatically
90
90
 
91
- Since ufo builds the Docker image every time there's a deployment you will end up with a long list of docker images. Ufo automatically cleans up older docker images at the end of the deploy process if you are using AWS ECR. By default ufo keeps the most recent 30 Docker images. This can be adjust with the `--ecr-keep` option.
91
+ Since ufo builds the Docker image every time there's a deployment, you eventually will end up with a long list of Docker images. Ufo automatically cleans up older docker images at the end of the deploy process if you are using AWS ECR. By default ufo keeps the most recent 30 Docker images. This can be adjusted with the `--ecr-keep` option.
92
92
 
93
93
  docker ship demo-web --ecr-keep 2
94
94
 
@@ -99,23 +99,32 @@ You should see something like this:
99
99
 
100
100
  If you are using DockerHub or another registry, ufo does not automatically clean up images.
101
101
 
102
+ ### Scheduling Strategy
103
+
104
+ You can set the ECS scheduling strategy dynamically. Here's an example:
105
+
106
+ ufo ship --scheduling-strategy daemon
107
+
108
+ You can change the scheduling strategy by explicitly specifying it. Otherwise, the scheduling strategy state is maintained for future deployments, so you do not have to specify it repeatedly. The default scheduling strategy is replica.
109
+
102
110
 
103
111
  ## Options
104
112
 
105
113
  ```
106
- [--ecr-keep=N] # ECR specific cleanup of old images. Specifies how many images to keep. Only runs if the images are ECR images. Defaults keeps all images.
107
- [--elb=ELB] # Decides to create elb, not create elb or use existing target group.
108
- [--elb-eip-ids=one two three] # EIP Allocation ids to use for network load balancer.
109
- [--elb-type=ELB_TYPE] # ELB type: application or network. Keep current deployed elb type when not specified.
110
- [--pretty], [--no-pretty] # Pretty format the json for the task definitions
111
- # Default: true
112
- [--stop-old-tasks], [--no-stop-old-tasks] # Stop old tasks as part of deployment to speed it up
113
- [--task=TASK] # ECS task name, to override the task name convention.
114
- [--wait], [--no-wait] # Wait for deployment to complete
115
- # Default: true
116
- [--verbose], [--no-verbose]
117
- [--mute], [--no-mute]
118
- [--noop], [--no-noop]
119
- [--cluster=CLUSTER] # Cluster. Overrides .ufo/settings.yml.
114
+ [--ecr-keep=N] # ECR specific cleanup of old images. Specifies how many images to keep. Only runs if the images are ECR images. Defaults keeps all images.
115
+ [--elb=ELB] # Decides to create elb, not create elb or use existing target group.
116
+ [--elb-eip-ids=one two three] # EIP Allocation ids to use for network load balancer.
117
+ [--elb-type=ELB_TYPE] # ELB type: application or network. Keep current deployed elb type when not specified.
118
+ [--pretty], [--no-pretty] # Pretty format the json for the task definitions
119
+ # Default: true
120
+ [--scheduling-strategy=SCHEDULING_STRATEGY] # Scheduling strategy to use for the service. IE: replica, daemon
121
+ [--stop-old-tasks], [--no-stop-old-tasks] # Stop old tasks as part of deployment to speed it up
122
+ [--task=TASK] # ECS task name, to override the task name convention.
123
+ [--wait], [--no-wait] # Wait for deployment to complete
124
+ # Default: true
125
+ [--verbose], [--no-verbose]
126
+ [--mute], [--no-mute]
127
+ [--noop], [--no-noop]
128
+ [--cluster=CLUSTER] # Cluster. Overrides .ufo/settings.yml.
120
129
  ```
121
130
 
@@ -51,18 +51,19 @@ Note: The `--task` option is not used with the `ufo ships` command.
51
51
  ## Options
52
52
 
53
53
  ```
54
- [--ecr-keep=N] # ECR specific cleanup of old images. Specifies how many images to keep. Only runs if the images are ECR images. Defaults keeps all images.
55
- [--elb=ELB] # Decides to create elb, not create elb or use existing target group.
56
- [--elb-eip-ids=one two three] # EIP Allocation ids to use for network load balancer.
57
- [--elb-type=ELB_TYPE] # ELB type: application or network. Keep current deployed elb type when not specified.
58
- [--pretty], [--no-pretty] # Pretty format the json for the task definitions
59
- # Default: true
60
- [--stop-old-tasks], [--no-stop-old-tasks] # Stop old tasks as part of deployment to speed it up
61
- [--task=TASK] # ECS task name, to override the task name convention.
62
- [--wait], [--no-wait] # Wait for deployment to complete
63
- [--verbose], [--no-verbose]
64
- [--mute], [--no-mute]
65
- [--noop], [--no-noop]
66
- [--cluster=CLUSTER] # Cluster. Overrides .ufo/settings.yml.
54
+ [--ecr-keep=N] # ECR specific cleanup of old images. Specifies how many images to keep. Only runs if the images are ECR images. Defaults keeps all images.
55
+ [--elb=ELB] # Decides to create elb, not create elb or use existing target group.
56
+ [--elb-eip-ids=one two three] # EIP Allocation ids to use for network load balancer.
57
+ [--elb-type=ELB_TYPE] # ELB type: application or network. Keep current deployed elb type when not specified.
58
+ [--pretty], [--no-pretty] # Pretty format the json for the task definitions
59
+ # Default: true
60
+ [--scheduling-strategy=SCHEDULING_STRATEGY] # Scheduling strategy to use for the service. IE: replica, daemon
61
+ [--stop-old-tasks], [--no-stop-old-tasks] # Stop old tasks as part of deployment to speed it up
62
+ [--task=TASK] # ECS task name, to override the task name convention.
63
+ [--wait], [--no-wait] # Wait for deployment to complete
64
+ [--verbose], [--no-verbose]
65
+ [--mute], [--no-mute]
66
+ [--noop], [--no-noop]
67
+ [--cluster=CLUSTER] # Cluster. Overrides .ufo/settings.yml.
67
68
  ```
68
69
 
@@ -7,13 +7,17 @@ In a hurry? No sweat! Here's a quick start to using ufo that takes only a few mi
7
7
  gem install ufo
8
8
  git clone https://github.com/tongueroo/demo-ufo.git demo
9
9
  cd demo
10
- ufo init --image=tongueroo/demo-ufo
10
+ ufo init --image=tongueroo/demo-ufo # NOTE: use your own account
11
11
  ufo current --service demo-web
12
12
  ufo ship
13
13
  ufo ps
14
14
  ufo scale 2
15
15
 
16
- Note: The example pushes the Docker image to Dockerhub. If you are using ECR instead, you can specific an ECR repo with the `--image` option. Example:
16
+ Note: The example pushes the Docker image to Dockerhub account. You need push access the repo. So, you will need to an account that you have access to. You can control that with the `--image` option. Example:
17
+
18
+ ufo init --image=yourusername/yourrepo # use your own account
19
+
20
+ Also, if you are using ECR instead, you can specific an ECR repo with the `--image` option. Example:
17
21
 
18
22
  ufo init --image 123456789012.dkr.ecr.us-west-2.amazonaws.com/myimage
19
23
 
@@ -40,6 +40,10 @@ Parameters:
40
40
  Description: ELB EIP Allocation ids to use for network load balancer
41
41
  Type: String
42
42
  Default: ''
43
+ EcsSchedulingStrategy:
44
+ Description: The scheduling strategy to use for the service
45
+ Type: String
46
+ Default: 'REPLICA'
43
47
  Conditions:
44
48
  CreateElbIsTrue: !Equals [ !Ref CreateElb, true ]
45
49
  ElbTargetGroupIsBlank: !Equals [ !Ref ElbTargetGroup, '' ]
@@ -213,6 +217,7 @@ Resources:
213
217
  - - ContainerName: <%= @container[:name] %>
214
218
  ContainerPort: <%= @container[:port] || 80 %>
215
219
  TargetGroupArn: !Ref ElbTargetGroup
220
+ SchedulingStrategy: !Ref EcsSchedulingStrategy
216
221
  <%= custom_properties(:Ecs) %>
217
222
 
218
223
  EcsSecurityGroup:
@@ -26,18 +26,19 @@ module Ufo
26
26
 
27
27
  long_desc Help.text(:init)
28
28
  Init.cli_options.each do |args|
29
- option *args
29
+ option(*args)
30
30
  end
31
31
  register(Init, "init", "init", "Set up initial ufo files.")
32
32
 
33
33
  # common options to deploy. ship, and ships command
34
34
  ship_options = Proc.new do
35
- option :ecr_keep, type: :numeric, desc: "ECR specific cleanup of old images. Specifies how many images to keep. Only runs if the images are ECR images. Defaults keeps all images."
36
35
  # All elb options remember their 'state'
36
+ option :ecr_keep, type: :numeric, desc: "ECR specific cleanup of old images. Specifies how many images to keep. Only runs if the images are ECR images. Defaults keeps all images."
37
37
  option :elb, desc: "Decides to create elb, not create elb or use existing target group."
38
38
  option :elb_eip_ids, type: :array, desc: "EIP Allocation ids to use for network load balancer."
39
39
  option :elb_type, desc: "ELB type: application or network. Keep current deployed elb type when not specified."
40
40
  option :pretty, type: :boolean, default: true, desc: "Pretty format the json for the task definitions"
41
+ option :scheduling_strategy, desc: "Scheduling strategy to use for the service. IE: replica, daemon"
41
42
  option :stop_old_tasks, type: :boolean, default: false, desc: "Stop old tasks as part of deployment to speed it up"
42
43
  option :task, desc: "ECS task name, to override the task name convention."
43
44
  option :wait, type: :boolean, desc: "Wait for deployment to complete", default: true
@@ -12,7 +12,7 @@ The ECS service gets created if the service does not yet exist on the cluster.
12
12
 
13
13
  ### Conventions
14
14
 
15
- By convention the task and service names match. If you need override to this convention then you can specific the task. For example if you want to ship to the `demo-web-1` service and use the `demo-web` task, run:
15
+ By convention, the task and service names match. If you need to override this convention, then you can use the task option. For example, if you want to ship to the `demo-web-1` service and use the `demo-web` task, run:
16
16
 
17
17
  ufo ship demo-web-1 --task demo-web
18
18
 
@@ -56,7 +56,7 @@ Let's you want skip the docker build phase and only want use ufo to deploy a tas
56
56
 
57
57
  ### Not Waiting for Deployments to Complete
58
58
 
59
- By default when ufo updates the ECS service with the new task definition it does so synchronuously. It'll wait until the CloudFormation stack finishes. You can make it asynchronuously with the `--no-wait` option:
59
+ By default when ufo updates the ECS service with the new task definition, it does so synchronuously. It'll wait until the CloudFormation stack finishes. You can make it asynchronuously with the `--no-wait` option:
60
60
 
61
61
  ufo ship demo-web --no-wait
62
62
 
@@ -75,7 +75,7 @@ Refer to [Route53 Support](http://ufoships.com/docs/route53-support/) for more i
75
75
 
76
76
  ### Cleaning up Docker Images Automatically
77
77
 
78
- Since ufo builds the Docker image every time there's a deployment you will end up with a long list of docker images. Ufo automatically cleans up older docker images at the end of the deploy process if you are using AWS ECR. By default ufo keeps the most recent 30 Docker images. This can be adjust with the `--ecr-keep` option.
78
+ Since ufo builds the Docker image every time there's a deployment, you eventually will end up with a long list of Docker images. Ufo automatically cleans up older docker images at the end of the deploy process if you are using AWS ECR. By default ufo keeps the most recent 30 Docker images. This can be adjusted with the `--ecr-keep` option.
79
79
 
80
80
  docker ship demo-web --ecr-keep 2
81
81
 
@@ -86,3 +86,10 @@ You should see something like this:
86
86
 
87
87
  If you are using DockerHub or another registry, ufo does not automatically clean up images.
88
88
 
89
+ ### Scheduling Strategy
90
+
91
+ You can set the ECS scheduling strategy dynamically. Here's an example:
92
+
93
+ ufo ship --scheduling-strategy daemon
94
+
95
+ You can change the scheduling strategy by explicitly specifying it. Otherwise, the scheduling strategy state is maintained for future deployments, so you do not have to specify it repeatedly. The default scheduling strategy is replica.
@@ -114,6 +114,7 @@ module Ufo
114
114
 
115
115
  EcsDesiredCount: current_desired_count,
116
116
  EcsTaskDefinition: task_definition_arn,
117
+ EcsSchedulingStrategy: scheduling_strategy,
117
118
  }
118
119
 
119
120
  hash[:EcsSecurityGroups] = network[:ecs_security_groups].join(',') if network[:ecs_security_groups]
@@ -138,7 +139,15 @@ module Ufo
138
139
  end
139
140
  memoize :context
140
141
 
142
+ def scheduling_strategy
143
+ strategy = @options[:scheduling_strategy] || context.scheduling_strategy
144
+ strategy.upcase
145
+ end
146
+
141
147
  def current_desired_count
148
+ # Cannot set ECS desired count when is scheduling_strategy DAEMON
149
+ return '' if scheduling_strategy == "DAEMON"
150
+
142
151
  info = Info.new(@service, @options)
143
152
  service = info.service
144
153
  if service
@@ -138,7 +138,14 @@ class Ufo::Stack
138
138
  param = stack.parameters.find do |p|
139
139
  p.parameter_key == key
140
140
  end
141
- param.parameter_value
141
+ param.parameter_value if param
142
+ end
143
+
144
+ def scheduling_strategy
145
+ unless @new_stack
146
+ scheduling_strategy = get_parameter_value(@stack, "EcsSchedulingStrategy")
147
+ end
148
+ scheduling_strategy || 'REPLICA' # defaults to REPLICA
142
149
  end
143
150
 
144
151
  def reset_empty_eip_ids?
@@ -1,3 +1,3 @@
1
1
  module Ufo
2
- VERSION = "4.1.6"
2
+ VERSION = "4.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ufo
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.6
4
+ version: 4.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-31 00:00:00.000000000 Z
11
+ date: 2018-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-cloudformation