ufo 2.3.0 → 3.0.0

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.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +57 -0
  3. data/.gitmodules +3 -0
  4. data/.rspec +1 -0
  5. data/CHANGELOG.md +16 -1
  6. data/Gemfile.lock +16 -3
  7. data/README.md +5 -1
  8. data/docs/_docs/auto-completion.md +27 -0
  9. data/docs/_docs/automated-cleanup.md +1 -1
  10. data/docs/_docs/conventions.md +2 -2
  11. data/docs/_docs/helpers.md +6 -6
  12. data/docs/_docs/run-in-pieces.md +15 -8
  13. data/docs/_docs/settings.md +61 -49
  14. data/docs/_docs/structure.md +2 -2
  15. data/docs/_docs/tutorial-ufo-docker-build.md +10 -3
  16. data/docs/_docs/tutorial-ufo-init.md +48 -16
  17. data/docs/_docs/tutorial-ufo-ship.md +14 -7
  18. data/docs/_docs/tutorial-ufo-ships.md +1 -1
  19. data/docs/_docs/tutorial-ufo-tasks-build.md +23 -14
  20. data/docs/_docs/ufo-deploy.md +30 -0
  21. data/docs/_docs/ufo-docker-base.md +3 -3
  22. data/docs/_docs/ufo-docker-build.md +3 -3
  23. data/docs/_docs/ufo-docker-push.md +43 -0
  24. data/docs/_docs/ufo-env.md +17 -15
  25. data/docs/_docs/ufo-init.md +14 -1
  26. data/docs/_docs/ufo-scale.md +2 -4
  27. data/docs/_docs/ufo-ships.md +2 -2
  28. data/docs/_docs/variables.md +6 -6
  29. data/docs/_includes/commands.html +4 -4
  30. data/docs/_includes/subnav.html +3 -0
  31. data/docs/_includes/summary.html +2 -2
  32. data/docs/_includes/ufo-ship-options.md +0 -2
  33. data/docs/docs.md +5 -1
  34. data/docs/quick-start.md +19 -10
  35. data/lib/{starter_project → template}/.env +0 -0
  36. data/lib/template/.ufo/settings.yml.tt +27 -0
  37. data/lib/{starter_project/ufo/task_definitions.rb → template/.ufo/task_definitions.rb.tt} +0 -0
  38. data/lib/{starter_project/ufo → template/.ufo}/templates/main.json.erb +0 -0
  39. data/lib/{starter_project/ufo → template/.ufo}/variables/base.rb +0 -0
  40. data/lib/{starter_project/ufo → template/.ufo}/variables/development.rb +0 -0
  41. data/lib/{starter_project/ufo → template/.ufo}/variables/production.rb +0 -0
  42. data/lib/{starter_project → template}/Dockerfile +0 -0
  43. data/lib/{starter_project/bin/deploy → template/bin/deploy.tt} +0 -0
  44. data/lib/ufo.rb +9 -2
  45. data/lib/ufo/cli.rb +34 -29
  46. data/lib/ufo/completer.rb +86 -64
  47. data/lib/ufo/core.rb +42 -0
  48. data/lib/ufo/default.rb +4 -6
  49. data/lib/ufo/default/settings.yml +24 -22
  50. data/lib/ufo/deploy.rb +0 -0
  51. data/lib/ufo/docker.rb +12 -2
  52. data/lib/ufo/docker/builder.rb +19 -49
  53. data/lib/ufo/docker/cleaner.rb +4 -2
  54. data/lib/ufo/docker/dockerfile.rb +1 -2
  55. data/lib/ufo/docker/pusher.rb +53 -0
  56. data/lib/ufo/dsl.rb +1 -2
  57. data/lib/ufo/dsl/helper.rb +3 -4
  58. data/lib/ufo/dsl/outputter.rb +1 -1
  59. data/lib/ufo/dsl/task_definition.rb +17 -37
  60. data/lib/ufo/ecr/auth.rb +22 -2
  61. data/lib/ufo/ecs.rb +5 -0
  62. data/lib/ufo/ecs/service.rb +21 -0
  63. data/lib/ufo/help/completion.md +1 -1
  64. data/lib/ufo/help/completion_script.md +1 -1
  65. data/lib/ufo/help/deploy.md +14 -0
  66. data/lib/ufo/help/docker/name.md +13 -2
  67. data/lib/ufo/help/docker/push.md +11 -0
  68. data/lib/ufo/init.rb +48 -65
  69. data/lib/ufo/log_group.rb +5 -2
  70. data/lib/ufo/sequence.rb +27 -0
  71. data/lib/ufo/setting.rb +18 -8
  72. data/lib/ufo/ship.rb +23 -46
  73. data/lib/ufo/tasks/builder.rb +8 -11
  74. data/lib/ufo/tasks/register.rb +2 -3
  75. data/lib/ufo/upgrade3.rb +64 -0
  76. data/lib/ufo/util.rb +0 -2
  77. data/lib/ufo/version.rb +1 -1
  78. data/spec/fixtures/home_existing/.docker/config.json +1 -1
  79. data/spec/fixtures/settings.yml +23 -0
  80. data/spec/lib/cli_spec.rb +1 -9
  81. data/spec/lib/completion_spec.rb +18 -0
  82. data/spec/lib/core_spec.rb +16 -0
  83. data/spec/lib/ecr_auth_spec.rb +1 -3
  84. data/spec/lib/ecr_cleaner_spec.rb +1 -3
  85. data/spec/lib/setting_spec.rb +12 -0
  86. data/spec/lib/ship_spec.rb +2 -4
  87. data/spec/lib/task_spec.rb +0 -2
  88. data/spec/spec_helper.rb +12 -2
  89. data/ufo.gemspec +2 -0
  90. metadata +47 -13
  91. data/lib/starter_project/ufo/settings.yml +0 -18
  92. data/lib/ufo/env.rb +0 -18
  93. data/lib/ufo/help/sub/goodbye.md +0 -5
@@ -16,7 +16,20 @@ ufo init --app=hi --image=tongueroo/hi
16
16
 
17
17
  You should see output similiar to this:
18
18
 
19
- <img src="/img/tutorials/ufo-init.png" class="doc-photo" />
19
+ ```sh
20
+ $ ufo init --app=hi --image=tongueroo/hi
21
+ Setting up ufo project...
22
+ create .ufo/settings.yml
23
+ create .ufo/task_definitions.rb
24
+ create .ufo/templates/main.json.erb
25
+ create .ufo/variables/base.rb
26
+ create .ufo/variables/development.rb
27
+ create .ufo/variables/production.rb
28
+ create Dockerfile
29
+ create bin/deploy
30
+ append .gitignore
31
+ Starter ufo files created.
32
+ ```
20
33
 
21
34
  The standard directory structure of the ufo folder looks like this:
22
35
 
@@ -5,7 +5,7 @@ title: ufo scale
5
5
  Ufo provides a command to quickly scale up and down an ECS service. Here's an example of how you use it:
6
6
 
7
7
  ```sh
8
- ufo scale hi-web
8
+ ufo scale hi-web 3
9
9
  ```
10
10
 
11
11
  You should get output similiar to below:
@@ -16,8 +16,6 @@ Scale hi-web service in stag cluster to 3
16
16
 
17
17
  While scaling via this method is quick and convenient the [ECS Service AutoScaling](http://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-auto-scaling.html) that is built into ECS is a much more powerful way to manage scaling your ECS service.
18
18
 
19
- <a id="prev" class="btn btn-basic" href="{% link _docs/ufo-ships.md %}">Back</a>
19
+ <a id="prev" class="btn btn-basic" href="{% link _docs/ufo-deploy.md %}">Back</a>
20
20
  <a id="next" class="btn btn-primary" href="{% link _docs/ufo-destroy.md %}">Next Step</a>
21
21
  <p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
22
-
23
-
@@ -40,13 +40,13 @@ ufo ships hi-web-1:my-task hi-clock-1:another-task hi-worker-1:third-task
40
40
 
41
41
  ### ufo ships Options
42
42
 
43
- The `ufo ships` and `ufo ship` command support the same options. The options are presented here again for convenience:
43
+ The `ufo ships`, `ufo ship`, `ufo deploy` command support the same options. The options are presented here again for convenience:
44
44
 
45
45
  {% include ufo-ship-options.md %}
46
46
 
47
47
  Note: The `--task` option is not used with the `ufo ships` command.
48
48
 
49
49
  <a id="prev" class="btn btn-basic" href="{% link _docs/ufo-ship.md %}">Back</a>
50
- <a id="next" class="btn btn-primary" href="{% link _docs/ufo-scale.md %}">Next Step</a>
50
+ <a id="next" class="btn btn-primary" href="{% link _docs/ufo-deploy.md %}">Next Step</a>
51
51
  <p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
52
52
 
@@ -4,7 +4,7 @@ title: Shared Variables
4
4
 
5
5
  Often times, you end up using the set of common variables across your task definitions for a project. Ufo supports a shared variables concept to help with this. You specify variables files in the `ufo/variables` folder and they are made availale to your `ufo/task_definitions.rb` as well as your `ufo/templates` files.
6
6
 
7
- For example, given `config/variables/base.rb`:
7
+ For example, given `variables/base.rb`:
8
8
 
9
9
  ```
10
10
  @image = helper.full_image_name # includes the git sha tongueroo/hi:ufo-[sha].
@@ -17,7 +17,7 @@ You can now use @image in your `ufo/templates/main.json.erb` without having to e
17
17
 
18
18
  ### Layering
19
19
 
20
- Shared variables also support a concept called layering. The `config/variables/base.rb` file is treated specially and will always be evaluated. Additionally, ufo will also evaluate the `config/variables/[UFO_ENV].rb` according to what UFO_ENV's value is. Thanks layering, you can easily override variables to suite different environments like production or staging. For example:
20
+ Shared variables also support a concept called layering. The `variables/base.rb` file is treated specially and will always be evaluated. Additionally, ufo will also evaluate the `variables/[UFO_ENV].rb` according to what UFO_ENV's value is. Thanks to layering, you can easily override variables to suit different environments like `production` or `development`. For example:
21
21
 
22
22
  `ufo/variables/base.rb`:
23
23
 
@@ -28,7 +28,7 @@ Shared variables also support a concept called layering. The `config/variables/
28
28
  @environment = helper.env_file(".env")
29
29
  ```
30
30
 
31
- When `ufo ship` is ran with `UFO_ENV=production` he `config/variables/production.rb` will be evaluated and layered on top of the variables defined in `base.rb:
31
+ When `ufo ship` is ran with `UFO_ENV=production` he `variables/production.rb` will be evaluated and layered on top of the variables defined in `base.rb:
32
32
 
33
33
  `ufo/variables/production.rb`:
34
34
 
@@ -39,14 +39,14 @@ When `ufo ship` is ran with `UFO_ENV=production` he `config/variables/production
39
39
  ])
40
40
  ```
41
41
 
42
- When `ufo ship` is ran with `UFO_ENV=staging` he `config/variables/staging.rb` will be evaluated and layered on top of the variables defined in `base.rb:
42
+ When `ufo ship` is ran with `UFO_ENV=development` the `variables/development.rb` will be evaluated and layered on top of the variables defined in `base.rb:
43
43
 
44
44
 
45
- `ufo/variables/production.rb`:
45
+ `ufo/variables/development.rb`:
46
46
 
47
47
  ```ruby
48
48
  @environment = helper.env_vars(%Q[
49
- RAILS_ENV=staging
49
+ RAILS_ENV=development
50
50
  SECRET_KEY_BASE=secret
51
51
  ])
52
52
  ```
@@ -19,7 +19,7 @@ ufo destroy
19
19
  </div>
20
20
  </div>
21
21
  <div class="col-lg-6">
22
- <h3>ufo/variables/base.rb</h3>
22
+ <h3>variables/base.rb</h3>
23
23
  <div class="commands">
24
24
  {% highlight ruby %}
25
25
  @image = helper.full_image_name # includes the git sha tongueroo/hi:ufo-[sha].
@@ -35,7 +35,7 @@ ufo destroy
35
35
  </div>
36
36
  <div class="row">
37
37
  <div class="col-lg-6">
38
- <h3>ufo/templates/main.json.erb</h3>
38
+ <h3>templates/main.json.erb</h3>
39
39
  <div class="commands">
40
40
  {% highlight json %}
41
41
  {
@@ -59,7 +59,7 @@ ufo destroy
59
59
  </div>
60
60
  </div>
61
61
  <div class="col-lg-6">
62
- <h3>ufo/template_definitions.rb</h3>
62
+ <h3>template_definitions.rb</h3>
63
63
  <div class="commands">
64
64
  {% highlight ruby %}
65
65
  task_definition "example-web" do
@@ -67,7 +67,7 @@ task_definition "example-web" do
67
67
  variables(
68
68
  family: task_definition_name,
69
69
  name: "web",
70
- awslogs_group: "example-web",
70
+ awslogs_group: "ecs/example-web",
71
71
  awslogs_stream_prefix: "example",
72
72
  command: ["bin/web"]
73
73
  )
@@ -21,9 +21,11 @@
21
21
  <li><a href="{% link _docs/ufo-init.md %}">ufo init</a></li>
22
22
  <li><a href="{% link _docs/ufo-ship.md %}">ufo ship</a></li>
23
23
  <li><a href="{% link _docs/ufo-ships.md %}">ufo ships</a></li>
24
+ <li><a href="{% link _docs/ufo-deploy.md %}">ufo deploy</a></li>
24
25
  <li><a href="{% link _docs/ufo-scale.md %}">ufo scale</a></li>
25
26
  <li><a href="{% link _docs/ufo-destroy.md %}">ufo destroy</a></li>
26
27
  <li><a href="{% link _docs/ufo-docker-build.md %}">ufo docker build</a></li>
28
+ <li><a href="{% link _docs/ufo-docker-push.md %}">ufo docker push</a></li>
27
29
  <li><a href="{% link _docs/ufo-docker-base.md %}">ufo docker base</a></li>
28
30
  <li><a href="{% link _docs/ufo-docker-name.md %}">ufo docker name</a></li>
29
31
  <li><a href="{% link _docs/ufo-docker-clean.md %}">ufo docker clean</a></li>
@@ -37,6 +39,7 @@
37
39
  <li><a href="{% link _docs/variables.md %}">Shared Variables</a></li>
38
40
  <li><a href="{% link _docs/helpers.md %}">Helpers</a></li>
39
41
  <li><a href="{% link _docs/conventions.md %}">Conventions</a></li>
42
+ <li><a href="{% link _docs/auto-completion.md %}">Auto-Completion</a></li>
40
43
  <li><a href="{% link _docs/run-in-pieces.md %}">Run In Pieces</a></li>
41
44
  <li><a href="{% link _docs/single-task.md %}">Run Single Task</a></li>
42
45
  <li><a href="{% link _docs/migrations.md %}">Database Migrations</a></li>
@@ -12,8 +12,8 @@
12
12
 
13
13
  <ol class="landing-summary">
14
14
  <li>Builds a docker image.</li>
15
- <li>Generates and registers the ECS template definition.</li>
16
- <li>Deploys the ECS template definition to the ECS service.</li>
15
+ <li>Registers the ECS template definition.</li>
16
+ <li>Deploys to ECS.</li>
17
17
  </ol>
18
18
  </div>
19
19
  </div>
@@ -4,8 +4,6 @@ Option | Description
4
4
  `--task` | By convention ufo uses the same name for both the ECS service and task definition. You can override this convention with this option. The conventions are covered on the [Conventions]({% link _docs/conventions.md %}) page.
5
5
  `--target-group` | The ELB target group to use for the ECS service. This is respected if the ECS service is being created the first time. If the ECS service already exists, this option gets ignored.
6
6
  `--target-group-prompt` | This boolean option allows you to bypass setting the ELB target group if desired.
7
- `--docker` | This boolean option determines whether to build the docker image first as part of the ship process.
8
- `--tasks` | This boolean option determines where to build and register the task definitions.
9
7
  `--wait` | This boolean option determines if ufo blocks and waits until the service has been deployed before continuing.
10
8
  `--pretty` | This boolean option determines ufo generates the task definitions in output in a pretty human readable format.
11
9
  `--stop-old-tasks` | This boolean option determines if ufo will call ecs stop-task on the old tasks after deployment. Sometimes old tasks hang around for a little bit with ECS this forces them along a little quicker.
@@ -4,7 +4,11 @@ title: Docs
4
4
 
5
5
  ### Overview
6
6
 
7
- Ufo is a tool that makes building and shipping Docker containers to AWS ECS super easy. Essentially, ufo builds the docker container image, registers that image to ECS as a task definition, and then deploys that registered task definition to ECS by updating the service. Ufo provides a `ufo ship` command that does all of this.
7
+ Ufo is a tool that makes building and shipping Docker containers to AWS ECS super easy. Ufo provides a `ufo ship` command that does this. Essentially:
8
+
9
+ 1. ufo builds the docker container image
10
+ 2. registers that image to ECS as a task definition
11
+ 3. deploys that registered task definition to ECS by updating the service.
8
12
 
9
13
  Ufo was built directly from real life production use cases after seeing the same patterns repeated over and over. Ufo enables you to write the AWS task definition json format file in ERB, an easy templating language. This allows you to reuse the ufo tool with multiple applications and only put the truly application specific business logic in each app code base.
10
14
 
@@ -6,26 +6,35 @@ In a hurry? No sweat! Here's a quick start to using ufo that takes only a few mi
6
6
 
7
7
  ```sh
8
8
  gem install ufo
9
- git clone https:///github.com/tongueroo/hi.git
9
+ git clone https://github.com/tongueroo/hi.git
10
10
  cd hi
11
11
  ufo init --app=hi --image=tongueroo/hi
12
12
  ufo ship hi-web
13
13
  ```
14
14
 
15
+ ### What Happened
16
+
17
+ The `ufo ship hi-web` command does the following:
18
+
19
+ 1. Builds the Docker image and pushes it to a registry
20
+ 2. Builds the ECS task definitions and registry them to ECS
21
+ 3. Updates the ECS Service
22
+
15
23
  You should see something similar to this:
16
24
 
17
25
  ```
18
26
  $ ufo init --app=hi --image=tongueroo/hi
19
27
  Setting up ufo project...
20
- created: ./bin/deploy
21
- created: ./Dockerfile
22
- created: ./ufo/settings.yml
23
- created: ./ufo/task_definitions.rb
24
- created: ./ufo/templates/main.json.erb
25
- created: ./ufo/variables/base.rb
26
- created: ./ufo/variables/prod.rb
27
- created: ./ufo/variables/stag.rb
28
- created: ./.env
28
+ create .env
29
+ create .ufo/settings.yml
30
+ create .ufo/task_definitions.rb
31
+ create .ufo/templates/main.json.erb
32
+ create .ufo/variables/base.rb
33
+ create .ufo/variables/development.rb
34
+ create .ufo/variables/production.rb
35
+ create Dockerfile
36
+ create bin/deploy
37
+ append .gitignore
29
38
  Starter ufo files created.
30
39
  $ ufo ship hi-web
31
40
  Building docker image with:
File without changes
@@ -0,0 +1,27 @@
1
+ # More info: http://ufoships.com/docs/ufo-settings/
2
+ # The base config is treated special. It gets included the other environments automatically.
3
+ # Yaml also directly supports merging with & and <<* syntax but doing it automatically
4
+ # for a cleaner syntax.
5
+ base:
6
+ image: <%= @image %>
7
+ # clean_keep: 30
8
+ # ecr_keep: 30
9
+ # defaults when an new ECS service is created by ufo ship
10
+ new_service:
11
+ maximum_percent: 200
12
+ minimum_healthy_percent: 100
13
+ desired_count: 1
14
+
15
+ development:
16
+ # cluster: dev
17
+ # When you have AWS_PROFILE set to one of these values, ufo will switch to the desired
18
+ # environment. This prevents you from switching AWS_PROFILE, forgetting to
19
+ # also switch UFO_ENV, and accidentally deploying to production vs development.
20
+ # aws_profiles:
21
+ # - dev_profile1
22
+ # - dev_profile2
23
+
24
+ production:
25
+ # cluster: prod
26
+ # aws_profiles:
27
+ # - prod_profile
data/lib/ufo.rb CHANGED
@@ -4,14 +4,18 @@ require 'deep_merge'
4
4
  require 'colorize'
5
5
  require 'fileutils'
6
6
 
7
+ $:.unshift(File.expand_path("../../vendor/render_me_pretty/lib", __FILE__))
8
+ require "render_me_pretty"
9
+
7
10
  module Ufo
8
- autoload :Env, 'ufo/env'
11
+ autoload :Core, 'ufo/core'
9
12
  autoload :Default, 'ufo/default'
10
13
  autoload :AwsService, 'ufo/aws_service'
11
14
  autoload :Command, 'ufo/command'
12
15
  autoload :Setting, 'ufo/setting'
13
16
  autoload :Util, 'ufo/util'
14
17
  autoload :Init, 'ufo/init'
18
+ autoload :Sequence, 'ufo/sequence'
15
19
  autoload :CLI, 'ufo/cli'
16
20
  autoload :Help, 'ufo/help'
17
21
  autoload :Ship, 'ufo/ship'
@@ -20,12 +24,15 @@ module Ufo
20
24
  autoload :DSL, 'ufo/dsl'
21
25
  autoload :Scale, 'ufo/scale'
22
26
  autoload :LogGroup, 'ufo/log_group'
27
+ autoload :ECS, 'ufo/ecs'
23
28
 
24
29
  autoload :Docker, 'ufo/docker'
25
30
  autoload :Ecr, 'ufo/ecr'
26
31
  autoload :Tasks, 'ufo/tasks'
27
32
  autoload :Completion, "ufo/completion"
28
33
  autoload :Completer, "ufo/completer"
34
+ autoload :Upgrade3, "ufo/upgrade3"
35
+
36
+ extend Core
29
37
  end
30
38
 
31
- Ufo::Env.setup!
@@ -6,64 +6,67 @@ module Ufo
6
6
  class_option :verbose, type: :boolean
7
7
  class_option :mute, type: :boolean
8
8
  class_option :noop, type: :boolean
9
- class_option :project_root, type: :string, default: '.'
10
9
  class_option :cluster, desc: "Cluster. Overrides ufo/settings.yml."
11
10
 
12
- desc "docker [ACTION]", "docker related tasks"
11
+ desc "docker SUBCOMMAND", "docker related tasks"
13
12
  long_desc Help.text(:docker)
14
13
  subcommand "docker", Docker
15
14
 
16
- desc "tasks [ACTION]", "task definition related tasks"
15
+ desc "tasks SUBCOMMAND", "task definition related tasks"
17
16
  long_desc Help.text(:tasks)
18
17
  subcommand "tasks", Tasks
19
18
 
20
- desc "init", "setup initial ufo files"
21
- option :image, type: :string, required: true, desc: "Docker image name without the tag. Example: tongueroo/hi. Configures ufo/settings.yml"
22
- option :app, type: :string, required: true, desc: "App name. Preferably one word. Used in the generated ufo/task_definitions.rb."
23
19
  long_desc Help.text(:init)
24
- def init
25
- Init.new(options).setup
20
+ Init.cli_options.each do |args|
21
+ option *args
26
22
  end
23
+ register(Init, "init", "new", "setup initial ufo files")
27
24
 
28
- # common options to ship and ships command
25
+ # common options to deploy. ship, and ships command
29
26
  ship_options = Proc.new do
30
27
  option :task, desc: "ECS task name, to override the task name convention."
31
28
  option :target_group, desc: "ELB Target Group ARN."
32
29
  option :target_group_prompt, type: :boolean, desc: "Enable Target Group ARN prompt", default: true
33
- option :docker, type: :boolean, desc: "Enable docker build and push", default: true
34
- option :tasks, type: :boolean, desc: "Enable tasks build and register", default: true
35
30
  option :wait, type: :boolean, desc: "Wait for deployment to complete", default: false
36
31
  option :pretty, type: :boolean, default: true, desc: "Pretty format the json for the task definitions"
37
32
  option :stop_old_tasks, type: :boolean, default: false, desc: "Stop old tasks after waiting for deploying to complete"
38
33
  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."
39
34
  end
40
35
 
41
- desc "ship [SERVICE]", "builds and ships container image to the ECS service"
36
+ desc "deploy SERVICE", "deploys task definition to ECS service without re-building the definition"
37
+ long_desc Help.text(:deploy)
38
+ ship_options.call
39
+ def deploy(service)
40
+ task_definition = options[:task] || service # convention
41
+ Tasks::Register.register(task_definition, options)
42
+ ship = Ship.new(service, task_definition, options)
43
+ ship.deploy
44
+ end
45
+
46
+ desc "ship SERVICE", "builds and ships container image to the ECS service"
42
47
  long_desc Help.text(:ship)
43
48
  ship_options.call
44
49
  def ship(service)
45
50
  builder = build_docker
46
51
 
47
52
  task_definition = options[:task] || service # convention
48
- Tasks::Builder.register(task_definition, options) if options[:tasks]
49
- LogGroup.new(task_definition, options).create
53
+ Tasks::Builder.ship(task_definition, options)
50
54
  ship = Ship.new(service, task_definition, options)
51
55
  ship.deploy
52
56
 
53
57
  cleanup(builder.image_name)
54
58
  end
55
59
 
56
- desc "ships [LIST-OF-SERVICES]", "builds and ships same container image to multiple ECS services"
60
+ desc "ships [LIST_OF_SERVICES]", "builds and ships same container image to multiple ECS services"
57
61
  long_desc Help.text(:ships)
58
62
  ship_options.call
59
63
  def ships(*services)
60
64
  builder = build_docker
61
65
 
62
66
  services.each_with_index do |service|
63
- service_name, task_defintion_name = service.split(':')
64
- task_definition = task_defintion_name || service_name # convention
65
- Tasks::Builder.register(task_definition, options) if options[:tasks]
66
- LogGroup.new(task_definition, options).create
67
+ service_name, task_definition_name = service.split(':')
68
+ task_definition = task_definition_name || service_name # convention
69
+ Tasks::Builder.ship(task_definition, options)
67
70
  ship = Ship.new(service, task_definition, options)
68
71
  ship.deploy
69
72
  end
@@ -71,17 +74,17 @@ module Ufo
71
74
  cleanup(builder.image_name)
72
75
  end
73
76
 
74
- desc "task [TASK_DEFINITION]", "runs a one time task"
77
+ desc "task TASK_DEFINITION", "runs a one time task"
75
78
  long_desc Help.text(:task)
76
79
  option :docker, type: :boolean, desc: "Enable docker build and push", default: true
77
80
  option :command, type: :array, desc: "Override the command used for the container"
78
81
  def task(task_definition)
79
82
  Docker::Builder.build(options)
80
- Tasks::Builder.register(task_definition, options)
83
+ Tasks::Builder.ship(task_definition, options)
81
84
  Task.new(task_definition, options).run
82
85
  end
83
86
 
84
- desc "destroy [SERVICE]", "destroys the ECS service"
87
+ desc "destroy SERVICE", "destroys the ECS service"
85
88
  long_desc Help.text(:destroy)
86
89
  option :sure, type: :boolean, desc: "By pass are you sure prompt."
87
90
  def destroy(service)
@@ -89,7 +92,7 @@ module Ufo
89
92
  Destroy.new(service, options).bye
90
93
  end
91
94
 
92
- desc "scale [SERVICE] [COUNT]", "scale the ECS service"
95
+ desc "scale SERVICE COUNT", "scale the ECS service"
93
96
  long_desc Help.text(:scale)
94
97
  def scale(service, count)
95
98
  Scale.new(service, count, options).update
@@ -107,6 +110,12 @@ module Ufo
107
110
  Completer::Script.generate
108
111
  end
109
112
 
113
+ desc "upgrade3", "upgrades from version 2 and below to 3"
114
+ long_desc Help.text("upgrade3")
115
+ def upgrade3
116
+ Upgrade3.new(options).run
117
+ end
118
+
110
119
  desc "version", "Prints version number of installed ufo"
111
120
  def version
112
121
  puts VERSION
@@ -115,16 +124,12 @@ module Ufo
115
124
  no_tasks do
116
125
  def build_docker
117
126
  builder = Docker::Builder.new(options)
118
- if options[:docker]
119
- builder.build
120
- builder.push
121
- end
127
+ builder.build
128
+ builder.push
122
129
  builder
123
130
  end
124
131
 
125
132
  def cleanup(image_name)
126
- return unless options[:docker]
127
-
128
133
  Docker::Cleaner.new(image_name, options).cleanup
129
134
  Ecr::Cleaner.new(image_name, options).cleanup
130
135
  end