ufo 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +28 -438
- data/README.md +0 -8
- data/docs/_docs/conventions.md +1 -1
- data/docs/_docs/helpers.md +1 -0
- data/docs/_docs/settings.md +25 -24
- data/docs/_docs/tutorial-ufo-ship.md +1 -1
- data/docs/_docs/ufo-env.md +10 -10
- data/docs/_docs/variables.md +8 -8
- data/lib/starter_project/Dockerfile +1 -1
- data/lib/starter_project/ufo/settings.yml +7 -7
- data/lib/starter_project/ufo/task_definitions.rb +13 -9
- data/lib/starter_project/ufo/variables/{stag.rb → development.rb} +4 -4
- data/lib/starter_project/ufo/variables/{prod.rb → production.rb} +3 -3
- data/lib/ufo.rb +1 -0
- data/lib/ufo/aws_services.rb +4 -1
- data/lib/ufo/cli.rb +9 -10
- data/lib/ufo/command.rb +23 -0
- data/lib/ufo/docker.rb +4 -5
- data/lib/ufo/docker/builder.rb +1 -2
- data/lib/ufo/env.rb +1 -1
- data/lib/ufo/help.rb +9 -0
- data/lib/ufo/help/destroy.md +5 -0
- data/lib/ufo/help/docker.md +4 -0
- data/lib/ufo/help/docker/base.md +9 -0
- data/lib/ufo/help/docker/build.md +6 -0
- data/lib/ufo/help/docker/clean.md +14 -0
- data/lib/ufo/help/docker/name.md +5 -0
- data/lib/ufo/help/init.md +11 -0
- data/lib/ufo/help/scale.md +5 -0
- data/lib/ufo/help/ship.md +17 -0
- data/lib/ufo/help/ships.md +18 -0
- data/lib/ufo/help/task.md +10 -0
- data/lib/ufo/help/tasks.md +7 -0
- data/lib/ufo/help/tasks/build.md +7 -0
- data/lib/ufo/help/tasks/register.md +5 -0
- data/lib/ufo/init.rb +2 -3
- data/lib/ufo/ship.rb +1 -1
- data/lib/ufo/task.rb +5 -1
- data/lib/ufo/tasks.rb +2 -3
- data/lib/ufo/version.rb +1 -1
- data/ufo.gemspec +4 -1
- metadata +63 -9
- data/lib/ufo/cli/help.rb +0 -124
- data/lib/ufo/docker/help.rb +0 -65
- data/lib/ufo/tasks/help.rb +0 -26
data/lib/ufo/docker.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
module Ufo
|
2
2
|
class Docker < Command
|
3
|
-
autoload :Help, 'ufo/docker/help'
|
4
3
|
autoload :Builder, 'ufo/docker/builder'
|
5
4
|
autoload :Dockerfile, 'ufo/docker/dockerfile'
|
6
5
|
autoload :Cleaner, 'ufo/docker/cleaner'
|
7
6
|
|
8
7
|
desc "build", "builds docker image"
|
9
|
-
long_desc Help.build
|
8
|
+
long_desc Help.text("docker:build")
|
10
9
|
option :push, type: :boolean, default: false
|
11
10
|
def build
|
12
11
|
builder = Docker::Builder.new(options)
|
@@ -15,7 +14,7 @@ module Ufo
|
|
15
14
|
end
|
16
15
|
|
17
16
|
desc "base", "builds docker image from Dockerfile.base and update current Dockerfile"
|
18
|
-
long_desc Help.base
|
17
|
+
long_desc Help.text("docker:base")
|
19
18
|
option :push, type: :boolean, default: true
|
20
19
|
def base
|
21
20
|
builder = Docker::Builder.new(options.dup.merge(
|
@@ -31,7 +30,7 @@ module Ufo
|
|
31
30
|
|
32
31
|
desc "name", "displays the full docker image with tag that will be generated"
|
33
32
|
option :generate, type: :boolean, default: false, desc: "Generate a name without storing it"
|
34
|
-
long_desc Help.name
|
33
|
+
long_desc Help.text("docker:name")
|
35
34
|
def name
|
36
35
|
full_image_name = Docker::Builder.new(options).full_image_name
|
37
36
|
puts full_image_name
|
@@ -40,7 +39,7 @@ module Ufo
|
|
40
39
|
desc "clean IMAGE_NAME", "Cleans up old images. Keeps a specified amount."
|
41
40
|
option :keep, type: :numeric, default: 3
|
42
41
|
option :tag_prefix, default: "ufo"
|
43
|
-
long_desc Help.clean
|
42
|
+
long_desc Help.text("docker:clean")
|
44
43
|
def clean(image_name)
|
45
44
|
Docker::Cleaner.new(image_name, options).cleanup
|
46
45
|
end
|
data/lib/ufo/docker/builder.rb
CHANGED
@@ -103,7 +103,6 @@ module Ufo
|
|
103
103
|
FileUtils.mkdir_p(dirname) unless File.exist?(dirname)
|
104
104
|
full_image_name = generate_name
|
105
105
|
IO.write(docker_name_path, full_image_name)
|
106
|
-
IO.write("#{@project_root}/ufo/version", full_image_name)
|
107
106
|
end
|
108
107
|
|
109
108
|
def generate_name
|
@@ -112,7 +111,7 @@ module Ufo
|
|
112
111
|
|
113
112
|
def docker_name_path
|
114
113
|
# output gets entirely wiped by tasks builder so dotn use that folder
|
115
|
-
"#{@project_root}/ufo/docker_image_name_#{@image_namespace}.txt"
|
114
|
+
"#{@project_root}/ufo/data/docker_image_name_#{@image_namespace}.txt"
|
116
115
|
end
|
117
116
|
|
118
117
|
def timestamp
|
data/lib/ufo/env.rb
CHANGED
@@ -10,7 +10,7 @@ class Ufo::Env
|
|
10
10
|
if map
|
11
11
|
ufo_env = map[ENV['AWS_PROFILE']] || map['default']
|
12
12
|
end
|
13
|
-
ufo_env ||= '
|
13
|
+
ufo_env ||= 'development' # defaults to development
|
14
14
|
ufo_env = ENV['UFO_ENV'] if ENV['UFO_ENV'] # highest precedence
|
15
15
|
|
16
16
|
Kernel.const_set(:UFO_ENV, ufo_env)
|
data/lib/ufo/help.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
The docker cache task builds a docker image using the Dockerfile.base file and
|
2
|
+
updates the FROM Dockerfile image with the generated image from Dockerfile.base.
|
3
|
+
|
4
|
+
Examples:
|
5
|
+
|
6
|
+
ufo docker base
|
7
|
+
ufo docker base --no-push # do not push the image to the registry
|
8
|
+
|
9
|
+
Docker image tongueroo/hi:base-2016-10-21T15-50-57-88071f5 built.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Examples:
|
2
|
+
|
3
|
+
Say you currently have these images:
|
4
|
+
|
5
|
+
* tongueroo/hi:ufo-2016-10-15T19-29-06-88071f5
|
6
|
+
* tongueroo/hi:ufo-2016-10-16T19-29-06-88071f5
|
7
|
+
* tongueroo/hi:ufo-2016-10-17T19-29-06-88071f5
|
8
|
+
* tongueroo/hi:ufo-2016-10-18T19-29-06-88071f5
|
9
|
+
|
10
|
+
To clean them up and keep the 3 more recent:
|
11
|
+
|
12
|
+
ufo docker clean tongueroo/hi
|
13
|
+
|
14
|
+
This will remove tongueroo/hi:ufo-2016-10-15T19-29-06-88071f5.
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Examples:
|
2
|
+
|
3
|
+
ufo init --app=hi --image=tongueroo/hi
|
4
|
+
|
5
|
+
The app is that application name that you want to show up on the ECS dashboard. It is strongly encourage to have the app name be a single word.
|
6
|
+
|
7
|
+
The image is the base portion of image name that will be pushed to the docker registry, ie: DockerHub or AWS ECR. The image should not include the tag since the tag is generated upon a `ufo ship`. For example:
|
8
|
+
|
9
|
+
tongueroo/hi => tongueroo/hi:ufo-2018-02-08T21-04-02-3c86158
|
10
|
+
|
11
|
+
The generated `tongueroo/hi:ufo-2018-02-08T21-04-02-3c86158` image name gets pushed to the docker registry.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Examples:
|
2
|
+
|
3
|
+
To build the docker image, generate the task definition and ship it, run:
|
4
|
+
|
5
|
+
ufo ship hi-web
|
6
|
+
|
7
|
+
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 `hi-web-1` service and use the `hi-web` task, run:
|
8
|
+
|
9
|
+
ufo ship hi-web-1 --task hi-web
|
10
|
+
|
11
|
+
The deploy will also created the ECS service if the service does not yet exist on the cluster. The deploy will prompt you for the ELB `--target-group` if you are shipping a web container that does not yet exist. If it is not a web container the `--target-group` option gets ignored.
|
12
|
+
|
13
|
+
The prommpt can be bypassed by specifying a valid `--target-group` option or specifying the `---no-target-group-prompt` option.
|
14
|
+
|
15
|
+
ufo ship hi-web --target-group arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/hi-web/jsdlfjsdkd
|
16
|
+
|
17
|
+
ufo ship hi-web --no-target-group-prompt
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Builds docker image, registers it and ships it to multiple services. This deploys the same docker image to multiple ECS services.
|
2
|
+
|
3
|
+
Examples:
|
4
|
+
|
5
|
+
ufo ships hi-web hi-clock hi-worker
|
6
|
+
|
7
|
+
By convention the task definition and service names match for each of the services you ship. If you need to override to this convention then you can specify the task definition for each service with a special syntax. In the special syntax the service and task definition is separated by a colon. Example:
|
8
|
+
|
9
|
+
ufo ships hi-web-1:hi-web hi-clock-1 hi-worker-1
|
10
|
+
|
11
|
+
Here ufo will deploy to the hi-web-1 ECS Service using the hi-web task definition, but use the convention for the rest of the service.
|
12
|
+
|
13
|
+
For each service being deployed to, ufo will create the ECS service if the service does not yet exist on the cluster. The deploy process will prompt you for the ELB `--target-group` if you are deploying to a 'web' service that does not yet exist. Ufo determines that it is a web service by the name of the service. If the service has 'web' in the name then it is considered a web service. If it is not a web service then the `--target-group` option gets ignored.
|
14
|
+
|
15
|
+
The prommpt can be bypassed by specifying a valid `--target-group` option or specifying the `---no-target-group-prompt` option. Examples:
|
16
|
+
|
17
|
+
ufo ships hi-web hi-clock hi-worker --target-group arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/hi-web/jsdlfjsdkd
|
18
|
+
ufo ships hi-web hi-clock hi-worker --no-target-group-prompt
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Examples:
|
2
|
+
|
3
|
+
To run a one time task with ECS:
|
4
|
+
|
5
|
+
ufo task hi-migrate
|
6
|
+
|
7
|
+
You can also override the command used by the Docker container in the task definitions via command.
|
8
|
+
|
9
|
+
ufo task hi-web --command bin/migrate
|
10
|
+
ufo task hi-web --command bin/with_env bundle exec rake db:migrate:redo VERSION=xxx
|
data/lib/ufo/init.rb
CHANGED
data/lib/ufo/ship.rb
CHANGED
@@ -227,7 +227,7 @@ module Ufo
|
|
227
227
|
# the ECS console. `ufo scale` will allow you to updated the desired_count from the
|
228
228
|
# CLI though.
|
229
229
|
def create_service
|
230
|
-
puts "This service #{@service} does not yet exist in the #{@cluster} cluster. This deploy will create it."
|
230
|
+
puts "This service #{@service.colorize(:green)} does not yet exist in the #{@cluster.colorize(:green)} cluster. This deploy will create it."
|
231
231
|
container = container_info(@task_definition)
|
232
232
|
target_group = target_group_prompt(container)
|
233
233
|
|
data/lib/ufo/task.rb
CHANGED
@@ -16,7 +16,11 @@ module Ufo
|
|
16
16
|
cluster: @cluster,
|
17
17
|
task_definition: @task_definition
|
18
18
|
}
|
19
|
-
|
19
|
+
if @options[:command]
|
20
|
+
task_options.merge!(overrides: overrides)
|
21
|
+
puts "Running task with container overrides."
|
22
|
+
puts "Command: #{@options[:command].join(' ')}"
|
23
|
+
end
|
20
24
|
resp = ecs.run_task(task_options)
|
21
25
|
puts "Task ARN: #{resp.tasks[0].task_arn}" unless @options[:mute]
|
22
26
|
end
|
data/lib/ufo/tasks.rb
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
module Ufo
|
2
2
|
class Tasks < Command
|
3
|
-
autoload :Help, 'ufo/tasks/help'
|
4
3
|
autoload :Builder, 'ufo/tasks/builder'
|
5
4
|
autoload :Register, 'ufo/tasks/register'
|
6
5
|
|
7
6
|
desc "build", "builds task definitions"
|
8
|
-
long_desc Help.build
|
7
|
+
long_desc Help.text("tasks:build")
|
9
8
|
option :pretty, type: :boolean, default: true, desc: "Pretty format the json for the task definitions"
|
10
9
|
def build
|
11
10
|
Tasks::Builder.new(options).build
|
12
11
|
end
|
13
12
|
|
14
13
|
desc "register", "register all built task definitions in ufo/output"
|
15
|
-
long_desc Help.register
|
14
|
+
long_desc Help.text("tasks:register")
|
16
15
|
def register
|
17
16
|
Tasks::Register.register(:all, options)
|
18
17
|
end
|
data/lib/ufo/version.rb
CHANGED
data/ufo.gemspec
CHANGED
@@ -22,7 +22,10 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency "hashie"
|
23
23
|
spec.add_dependency "colorize"
|
24
24
|
spec.add_dependency "deep_merge"
|
25
|
-
spec.add_dependency "aws-sdk"
|
25
|
+
spec.add_dependency "aws-sdk-ecs"
|
26
|
+
spec.add_dependency "aws-sdk-ec2"
|
27
|
+
spec.add_dependency "aws-sdk-elasticloadbalancingv2"
|
28
|
+
spec.add_dependency "aws-sdk-cloudwatchlogs"
|
26
29
|
spec.add_dependency "plissken"
|
27
30
|
|
28
31
|
spec.add_development_dependency "bundler", "~> 1.3"
|
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: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -67,7 +67,49 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: aws-sdk
|
70
|
+
name: aws-sdk-ecs
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: aws-sdk-ec2
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: aws-sdk-elasticloadbalancingv2
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: aws-sdk-cloudwatchlogs
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
72
114
|
requirements:
|
73
115
|
- - ">="
|
@@ -276,12 +318,11 @@ files:
|
|
276
318
|
- lib/starter_project/ufo/task_definitions.rb
|
277
319
|
- lib/starter_project/ufo/templates/main.json.erb
|
278
320
|
- lib/starter_project/ufo/variables/base.rb
|
279
|
-
- lib/starter_project/ufo/variables/
|
280
|
-
- lib/starter_project/ufo/variables/
|
321
|
+
- lib/starter_project/ufo/variables/development.rb
|
322
|
+
- lib/starter_project/ufo/variables/production.rb
|
281
323
|
- lib/ufo.rb
|
282
324
|
- lib/ufo/aws_services.rb
|
283
325
|
- lib/ufo/cli.rb
|
284
|
-
- lib/ufo/cli/help.rb
|
285
326
|
- lib/ufo/command.rb
|
286
327
|
- lib/ufo/default/settings.yml
|
287
328
|
- lib/ufo/defaults.rb
|
@@ -290,7 +331,6 @@ files:
|
|
290
331
|
- lib/ufo/docker/builder.rb
|
291
332
|
- lib/ufo/docker/cleaner.rb
|
292
333
|
- lib/ufo/docker/dockerfile.rb
|
293
|
-
- lib/ufo/docker/help.rb
|
294
334
|
- lib/ufo/dsl.rb
|
295
335
|
- lib/ufo/dsl/helper.rb
|
296
336
|
- lib/ufo/dsl/outputter.rb
|
@@ -299,6 +339,21 @@ files:
|
|
299
339
|
- lib/ufo/ecr/auth.rb
|
300
340
|
- lib/ufo/ecr/cleaner.rb
|
301
341
|
- lib/ufo/env.rb
|
342
|
+
- lib/ufo/help.rb
|
343
|
+
- lib/ufo/help/destroy.md
|
344
|
+
- lib/ufo/help/docker.md
|
345
|
+
- lib/ufo/help/docker/base.md
|
346
|
+
- lib/ufo/help/docker/build.md
|
347
|
+
- lib/ufo/help/docker/clean.md
|
348
|
+
- lib/ufo/help/docker/name.md
|
349
|
+
- lib/ufo/help/init.md
|
350
|
+
- lib/ufo/help/scale.md
|
351
|
+
- lib/ufo/help/ship.md
|
352
|
+
- lib/ufo/help/ships.md
|
353
|
+
- lib/ufo/help/task.md
|
354
|
+
- lib/ufo/help/tasks.md
|
355
|
+
- lib/ufo/help/tasks/build.md
|
356
|
+
- lib/ufo/help/tasks/register.md
|
302
357
|
- lib/ufo/init.rb
|
303
358
|
- lib/ufo/log_group.rb
|
304
359
|
- lib/ufo/scale.rb
|
@@ -307,7 +362,6 @@ files:
|
|
307
362
|
- lib/ufo/task.rb
|
308
363
|
- lib/ufo/tasks.rb
|
309
364
|
- lib/ufo/tasks/builder.rb
|
310
|
-
- lib/ufo/tasks/help.rb
|
311
365
|
- lib/ufo/tasks/register.rb
|
312
366
|
- lib/ufo/templates/default.json.erb
|
313
367
|
- lib/ufo/util.rb
|
@@ -341,7 +395,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
341
395
|
version: '0'
|
342
396
|
requirements: []
|
343
397
|
rubyforge_project:
|
344
|
-
rubygems_version: 2.
|
398
|
+
rubygems_version: 2.7.3
|
345
399
|
signing_key:
|
346
400
|
specification_version: 4
|
347
401
|
summary: Build Docker Containers and Ship Them to AWS ECS
|
data/lib/ufo/cli/help.rb
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
module Ufo
|
2
|
-
class CLI < Command
|
3
|
-
class Help
|
4
|
-
class << self
|
5
|
-
def init
|
6
|
-
<<-EOL
|
7
|
-
Examples:
|
8
|
-
|
9
|
-
$ ufo init --app=hi --image=tongueroo/hi
|
10
|
-
|
11
|
-
The image should not include the tag since the tag is generated upon a `ufo ship`.
|
12
|
-
EOL
|
13
|
-
end
|
14
|
-
|
15
|
-
def docker
|
16
|
-
<<-EOL
|
17
|
-
Examples:
|
18
|
-
|
19
|
-
$ ufo docker build
|
20
|
-
|
21
|
-
$ ufo docker tag
|
22
|
-
EOL
|
23
|
-
end
|
24
|
-
|
25
|
-
def tasks
|
26
|
-
<<-EOL
|
27
|
-
Examples:
|
28
|
-
|
29
|
-
$ ufo tasks build
|
30
|
-
|
31
|
-
Builds all the task defintiions.
|
32
|
-
|
33
|
-
Note all the existing ufo/output generated task defintions are wiped out.
|
34
|
-
EOL
|
35
|
-
end
|
36
|
-
|
37
|
-
def ship
|
38
|
-
<<-EOL
|
39
|
-
Examples:
|
40
|
-
|
41
|
-
To build the docker image, generate the task definition and ship it, run:
|
42
|
-
|
43
|
-
$ ufo ship hi-web-prod
|
44
|
-
|
45
|
-
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 `hi-web-prod-1` service and use the `hi-web-prod` task, run:
|
46
|
-
|
47
|
-
$ ufo ship hi-web-prod-1 --task hi-web-prod
|
48
|
-
|
49
|
-
The deploy will also created the ECS service if the service does not yet exist on the cluster. The deploy will prompt you for the ELB `--target-group` if you are shipping a web container that does not yet exist. If it is not a web container the `--target-group` option gets ignored.
|
50
|
-
|
51
|
-
The prommpt can be bypassed by specifying a valid `--target-group` option or specifying the `---no-target-group-prompt` option.
|
52
|
-
|
53
|
-
$ ufo ship hi-web-prod --target-group arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/hi-web-prod/jsdlfjsdkd
|
54
|
-
|
55
|
-
$ ufo ship hi-web-prod --no-target-group-prompt
|
56
|
-
EOL
|
57
|
-
end
|
58
|
-
|
59
|
-
def ships
|
60
|
-
<<-EOL
|
61
|
-
Builds docker image, registers it and ships it to multiple services. This deploys the same docker image to multiple ECS services.
|
62
|
-
|
63
|
-
Examples:
|
64
|
-
|
65
|
-
$ ufo ships hi-web-prod hi-clock-prod hi-worker-prod
|
66
|
-
|
67
|
-
By convention the task definition and service names match for each of the services you ship. If you need to override to this convention then you can specify the task definition for each service with a special syntax. In the special syntax the service and task definition is separated by a colon. Example:
|
68
|
-
|
69
|
-
$ ufo ships hi-web-prod-1:hi-web-prod hi-clock-prod-1 hi-worker-prod-1
|
70
|
-
|
71
|
-
Here ufo will deploy to the hi-web-prod-1 ECS Service using the hi-web-prod task definition, but use the convention for the rest of the service.
|
72
|
-
|
73
|
-
For each service being deployed to, ufo will create the ECS service if the service does not yet exist on the cluster. The deploy process will prompt you for the ELB `--target-group` if you are deploying to a 'web' service that does not yet exist. Ufo determines that it is a web service by the name of the service. If the service has 'web' in the name then it is considered a web service. If it is not a web service then the `--target-group` option gets ignored.
|
74
|
-
|
75
|
-
The prommpt can be bypassed by specifying a valid `--target-group` option or specifying the `---no-target-group-prompt` option. Examples:
|
76
|
-
|
77
|
-
$ ufo ships hi-web-prod hi-clock-prod hi-worker-prod --target-group arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/hi-web-prod/jsdlfjsdkd
|
78
|
-
|
79
|
-
$ ufo ships hi-web-prod hi-clock-prod hi-worker-prod --no-target-group-prompt
|
80
|
-
EOL
|
81
|
-
end
|
82
|
-
|
83
|
-
def task
|
84
|
-
<<-EOL
|
85
|
-
Examples:
|
86
|
-
|
87
|
-
To run a one time task with ECS:
|
88
|
-
|
89
|
-
$ ufo task hi-migrate-prod
|
90
|
-
|
91
|
-
You can also override the command used by the Docker container in the task definitions via command.
|
92
|
-
|
93
|
-
ufo task hi-web-prod --command bin/migrate
|
94
|
-
|
95
|
-
ufo task hi-web-prod --command bin/with_env bundle exec rake db:migrate:redo VERSION=xxx
|
96
|
-
|
97
|
-
EOL
|
98
|
-
end
|
99
|
-
|
100
|
-
def destroy
|
101
|
-
<<-EOL
|
102
|
-
Examples:
|
103
|
-
|
104
|
-
Destroys the service. It will automatcally set the desired task size to 0 and stop all task so the destory happens in one command.
|
105
|
-
|
106
|
-
$ ufo destroy hi-web-prod
|
107
|
-
|
108
|
-
EOL
|
109
|
-
end
|
110
|
-
|
111
|
-
def scale
|
112
|
-
<<-EOL
|
113
|
-
Examples:
|
114
|
-
|
115
|
-
Scales the service. Simple wrapper for `aws ecs update-service --service xxx ----desired-count xxx`
|
116
|
-
|
117
|
-
$ ufo scale hi-web-prod 5
|
118
|
-
|
119
|
-
EOL
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|