ufo 3.1.2 → 3.2.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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/bin/commit_docs.sh +26 -0
  3. data/.circleci/config.yml +13 -0
  4. data/CHANGELOG.md +6 -0
  5. data/Gemfile.lock +6 -4
  6. data/Rakefile +7 -0
  7. data/docs/_config.yml +3 -0
  8. data/docs/_docs/conventions.md +3 -3
  9. data/docs/_docs/install.md +5 -5
  10. data/docs/_docs/settings.md +3 -3
  11. data/docs/_docs/structure.md +2 -2
  12. data/docs/_docs/tutorial-ufo-docker-build.md +1 -1
  13. data/docs/_docs/tutorial-ufo-init.md +1 -1
  14. data/docs/_docs/tutorial-ufo-ship.md +3 -7
  15. data/docs/_docs/tutorial-ufo-ships.md +2 -2
  16. data/docs/_docs/tutorial-ufo-tasks-build.md +7 -7
  17. data/docs/_docs/tutorial.md +1 -1
  18. data/docs/_docs/ufo-env.md +5 -5
  19. data/docs/_docs/ufo-tasks-register.md +0 -4
  20. data/docs/_docs/variables.md +6 -7
  21. data/docs/_includes/content.html +5 -0
  22. data/docs/_includes/css/main.css +23 -4
  23. data/docs/_includes/css/ufo.css +9 -9
  24. data/docs/_includes/reference.md +5 -0
  25. data/docs/_includes/subnav.html +16 -33
  26. data/docs/_reference/ufo-completion.md +46 -0
  27. data/docs/_reference/ufo-completion_script.md +27 -0
  28. data/docs/_reference/ufo-deploy.md +51 -0
  29. data/docs/_reference/ufo-destroy.md +34 -0
  30. data/docs/{_docs → _reference}/ufo-docker-base.md +36 -17
  31. data/docs/_reference/ufo-docker-build.md +81 -0
  32. data/docs/_reference/ufo-docker-clean.md +44 -0
  33. data/docs/_reference/ufo-docker-help.md +15 -0
  34. data/docs/_reference/ufo-docker-name.md +37 -0
  35. data/docs/_reference/ufo-docker-push.md +49 -0
  36. data/docs/_reference/ufo-docker.md +35 -0
  37. data/docs/_reference/ufo-init.md +74 -0
  38. data/docs/_reference/ufo-scale.md +30 -0
  39. data/docs/_reference/ufo-ship.md +100 -0
  40. data/docs/_reference/ufo-ships.md +77 -0
  41. data/docs/_reference/ufo-task.md +37 -0
  42. data/docs/_reference/ufo-tasks-build.md +179 -0
  43. data/docs/_reference/ufo-tasks-help.md +15 -0
  44. data/docs/_reference/ufo-tasks-register.md +29 -0
  45. data/docs/_reference/ufo-tasks.md +35 -0
  46. data/docs/_reference/ufo-upgrade3.md +23 -0
  47. data/docs/_reference/ufo-version.md +23 -0
  48. data/docs/articles.md +2 -0
  49. data/docs/docs.md +3 -3
  50. data/docs/quick-start.md +2 -2
  51. data/docs/reference.md +18 -0
  52. data/lib/ufo/cli.rb +13 -13
  53. data/lib/ufo/docker.rb +5 -5
  54. data/lib/ufo/ecr/auth.rb +6 -1
  55. data/lib/ufo/ecr/cleaner.rb +1 -1
  56. data/lib/ufo/help/completion.md +1 -1
  57. data/lib/ufo/help/completions.md +1 -1
  58. data/lib/ufo/help/deploy.md +5 -1
  59. data/lib/ufo/help/destroy.md +7 -3
  60. data/lib/ufo/help/docker.md +1 -1
  61. data/lib/ufo/help/docker/base.md +34 -4
  62. data/lib/ufo/help/docker/build.md +59 -4
  63. data/lib/ufo/help/docker/clean.md +12 -6
  64. data/lib/ufo/help/docker/name.md +10 -10
  65. data/lib/ufo/help/docker/push.md +23 -6
  66. data/lib/ufo/help/hello.md +1 -1
  67. data/lib/ufo/help/init.md +43 -5
  68. data/lib/ufo/help/scale.md +4 -3
  69. data/lib/ufo/help/ship.md +59 -8
  70. data/lib/ufo/help/ships.md +35 -9
  71. data/lib/ufo/help/task.md +1 -1
  72. data/lib/ufo/help/tasks.md +1 -1
  73. data/lib/ufo/help/tasks/build.md +155 -4
  74. data/lib/ufo/help/tasks/register.md +12 -3
  75. data/lib/ufo/ship.rb +2 -4
  76. data/lib/ufo/tasks.rb +2 -2
  77. data/lib/ufo/version.rb +1 -1
  78. data/spec/lib/ship_spec.rb +2 -1
  79. data/ufo.gemspec +3 -3
  80. metadata +44 -21
  81. data/docs/_docs/commands.md +0 -10
  82. data/docs/_docs/ufo-deploy.md +0 -30
  83. data/docs/_docs/ufo-destroy.md +0 -19
  84. data/docs/_docs/ufo-docker-build.md +0 -79
  85. data/docs/_docs/ufo-docker-clean.md +0 -27
  86. data/docs/_docs/ufo-docker-name.md +0 -15
  87. data/docs/_docs/ufo-docker-push.md +0 -43
  88. data/docs/_docs/ufo-help.md +0 -22
  89. data/docs/_docs/ufo-init.md +0 -54
  90. data/docs/_docs/ufo-scale.md +0 -21
  91. data/docs/_docs/ufo-ship.md +0 -75
  92. data/docs/_docs/ufo-ships.md +0 -52
  93. data/docs/_docs/ufo-tasks-build.md +0 -166
  94. data/lib/ufo/completion.rb +0 -15
  95. data/lib/ufo/sub.rb +0 -12
@@ -0,0 +1,37 @@
1
+ ---
2
+ title: ufo task
3
+ reference: true
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ ufo task TASK_DEFINITION
9
+
10
+ ## Description
11
+
12
+ Run a one-time task.
13
+
14
+ ## Examples
15
+
16
+ To run a one time task with ECS:
17
+
18
+ ufo task hi-migrate
19
+
20
+ You can also override the command used by the Docker container in the task definitions via command.
21
+
22
+ ufo task hi-web --command bin/migrate
23
+ ufo task hi-web --command bin/with_env bundle exec rake db:migrate:redo VERSION=xxx
24
+
25
+
26
+ ## Options
27
+
28
+ ```
29
+ [--docker], [--no-docker] # Enable docker build and push
30
+ # Default: true
31
+ [--command=one two three] # Override the command used for the container
32
+ [--verbose], [--no-verbose]
33
+ [--mute], [--no-mute]
34
+ [--noop], [--no-noop]
35
+ [--cluster=CLUSTER] # Cluster. Overrides ufo/settings.yml.
36
+ ```
37
+
@@ -0,0 +1,179 @@
1
+ ---
2
+ title: ufo tasks build
3
+ reference: true
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ ufo tasks build
9
+
10
+ ## Description
11
+
12
+ Build task definitions.
13
+
14
+ ## Summarized Example
15
+
16
+ ufo tasks build
17
+
18
+ Builds all the task defintiions. Note all the existing ufo/output generated task defintions are wiped out.
19
+
20
+ ## Explanation
21
+
22
+ The command `ufo tasks build` generates the task definitions locally and writes them to the `output/` folder. There are 2 files that it uses in order to produce the raw AWS task definitions files.
23
+
24
+ 1. ufo/templates/main.json.erb
25
+ 2. ufo/task_definitions.rb
26
+
27
+ Here's an example of each of them:
28
+
29
+ **main.json.erb**:
30
+
31
+ {
32
+ "family": "<%= @family %>",
33
+ "containerDefinitions": [
34
+ {
35
+ "name": "<%= @name %>",
36
+ "image": "<%= @image %>",
37
+ "cpu": <%= @cpu %>,
38
+ <% if @memory %>
39
+ "memory": <%= @memory %>,
40
+ <% end %>
41
+ <% if @memory_reservation %>
42
+ "memoryReservation": <%= @memory_reservation %>,
43
+ <% end %>
44
+ <% if @container_port %>
45
+ "portMappings": [
46
+ {
47
+ "containerPort": "<%= @container_port %>",
48
+ "protocol": "tcp"
49
+ }
50
+ ],
51
+ <% end %>
52
+ "command": <%= @command.to_json %>,
53
+ <% if @environment %>
54
+ "environment": <%= @environment.to_json %>,
55
+ <% end %>
56
+ <% if @awslogs_group %>
57
+ "logConfiguration": {
58
+ "logDriver": "awslogs",
59
+ "options": {
60
+ "awslogs-group": "<%= @awslogs_group %>",
61
+ "awslogs-region": "<%= @awslogs_region || 'us-east-1' %>",
62
+ "awslogs-stream-prefix": "<%= @awslogs_stream_prefix %>"
63
+ }
64
+ },
65
+ <% end %>
66
+ "essential": true
67
+ }
68
+ ]
69
+ }
70
+
71
+ **task_definitions.rb**:
72
+
73
+ ```ruby
74
+ task_definition "hi-web" do
75
+ source "main" # will use ufo/templates/main.json.erb
76
+ variables(
77
+ family: task_definition_name,
78
+ name: "web",
79
+ container_port: helper.dockerfile_port,
80
+ command: ["bin/web"]
81
+ )
82
+ end
83
+
84
+ task_definition "hi-worker" do
85
+ source "main" # will use ufo/templates/main.json.erb
86
+ variables(
87
+ family: task_definition_name,
88
+ name: "worker",
89
+ command: ["bin/worker"]
90
+ )
91
+ end
92
+
93
+ task_definition "hi-clock" do
94
+ source "main" # will use ufo/templates/main.json.erb
95
+ variables(
96
+ family: task_definition_name,
97
+ name: "clock",
98
+ command: ["bin/clock"]
99
+ )
100
+ end
101
+ ```
102
+
103
+ The shared variables are set in the variables folder:
104
+
105
+ **ufo/variables/base.rb**:
106
+
107
+ ```ruby
108
+ @image = helper.full_image_name # includes the git sha tongueroo/hi:ufo-[sha].
109
+ @cpu = 128
110
+ @memory_reservation = 256
111
+ @environment = helper.env_file(".env")
112
+ ```
113
+
114
+ **ufo/variables/production.rb**:
115
+
116
+ ```ruby
117
+ @environment = helper.env_vars(%Q{
118
+ RAILS_ENV=production
119
+ SECRET_KEY_BASE=secret
120
+ })
121
+ ```
122
+
123
+ Ufo combines the `main.json.erb` template, `task_definitions.rb` definitions, and variables in the `.ufo/variables` folder. It then generates the raw AWS formatted task definition in the `output` folder.
124
+
125
+ To build the task definitions:
126
+
127
+ ufo tasks build
128
+
129
+ You should see output similar to below:
130
+
131
+ $ ufo tasks build
132
+ Building Task Definitions...
133
+ Generating Task Definitions:
134
+ ufo/output/hi-web.json
135
+ ufo/output/hi-worker.json
136
+ ufo/output/hi-clock.json
137
+ Task Definitions built in ufo/output.
138
+ $
139
+
140
+ Let's take a look at one of the generated files: `.ufo/output/hi-web.json`.
141
+
142
+ {
143
+ "family": "hi-web",
144
+ "containerDefinitions": [
145
+ {
146
+ "name": "web",
147
+ "image": "tongueroo/hi:ufo-2017-06-11T22-22-32-a18aa30",
148
+ "cpu": 128,
149
+ "memoryReservation": 256,
150
+ "portMappings": [
151
+ {
152
+ "containerPort": "3000",
153
+ "protocol": "tcp"
154
+ }
155
+ ],
156
+ "command": [
157
+ "bin/web"
158
+ ],
159
+ "environment": [
160
+ {
161
+ "name": "RAILS_ENV",
162
+ "value": "staging"
163
+ }
164
+ ],
165
+ "essential": true
166
+ }
167
+ ]
168
+ }
169
+
170
+ If you need to modify the task definition template to suite your own needs it is super simple, just edit `main.json.erb`. No need to dive deep into internal code that builds up the task definition with some internal structure. It is all there for you to fully control.
171
+
172
+
173
+ ## Options
174
+
175
+ ```
176
+ [--pretty], [--no-pretty] # Pretty format the json for the task definitions
177
+ # Default: true
178
+ ```
179
+
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: ufo tasks help
3
+ reference: true
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ ufo tasks help [COMMAND]
9
+
10
+ ## Description
11
+
12
+ Describe subcommands or one specific subcommand
13
+
14
+
15
+
@@ -0,0 +1,29 @@
1
+ ---
2
+ title: ufo tasks register
3
+ reference: true
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ ufo tasks register
9
+
10
+ ## Description
11
+
12
+ Register all built task definitions in `ufo/output` folder.
13
+
14
+ The `ufo tasks register` command registers all the generated task definitions in `output/` to AWS ECS. Let's run it:
15
+
16
+ ufo tasks register
17
+
18
+ You should see something similiar to this:
19
+
20
+ hi-clock task definition registered.
21
+ hi-web task definition registered.
22
+ hi-worker task definition registered.
23
+
24
+ You can verify that the task definitions have been registered properly by viewing the AWS ECS Console Task Definitions page. You should see something similar to this:
25
+
26
+ <img src="/img/tutorials/ecs-console-task-definitions.png" class="doc-photo" />
27
+
28
+
29
+
@@ -0,0 +1,35 @@
1
+ ---
2
+ title: ufo tasks
3
+ reference: true
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ ufo tasks SUBCOMMAND
9
+
10
+ ## Description
11
+
12
+ task definition subcommands
13
+
14
+ ## Examples
15
+
16
+ ufo tasks build
17
+
18
+ Builds all the task defintiions.
19
+
20
+ Note all the existing ufo/output generated task defintions are wiped out.
21
+
22
+ ## Subcommands
23
+
24
+ * [ufo tasks build]({% link _reference/ufo-tasks-build.md %}) - Build task definitions.
25
+ * [ufo tasks register]({% link _reference/ufo-tasks-register.md %}) - Register all built task definitions in `ufo/output` folder.
26
+
27
+ ## Options
28
+
29
+ ```
30
+ [--verbose], [--no-verbose]
31
+ [--mute], [--no-mute]
32
+ [--noop], [--no-noop]
33
+ [--cluster=CLUSTER] # Cluster. Overrides ufo/settings.yml.
34
+ ```
35
+
@@ -0,0 +1,23 @@
1
+ ---
2
+ title: ufo upgrade3
3
+ reference: true
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ ufo upgrade3
9
+
10
+ ## Description
11
+
12
+ Upgrade from version 2 to 3.
13
+
14
+
15
+ ## Options
16
+
17
+ ```
18
+ [--verbose], [--no-verbose]
19
+ [--mute], [--no-mute]
20
+ [--noop], [--no-noop]
21
+ [--cluster=CLUSTER] # Cluster. Overrides ufo/settings.yml.
22
+ ```
23
+
@@ -0,0 +1,23 @@
1
+ ---
2
+ title: ufo version
3
+ reference: true
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ ufo version
9
+
10
+ ## Description
11
+
12
+ Prints version number of installed ufo.
13
+
14
+
15
+ ## Options
16
+
17
+ ```
18
+ [--verbose], [--no-verbose]
19
+ [--mute], [--no-mute]
20
+ [--noop], [--no-noop]
21
+ [--cluster=CLUSTER] # Cluster. Overrides ufo/settings.yml.
22
+ ```
23
+
@@ -6,3 +6,5 @@ title: Articles
6
6
  * This presentation covers ufo also: [Ufo Ship on AWS ECS](http://www.slideshare.net/tongueroo/ufo-ship-for-aws-ecs-70885296)
7
7
 
8
8
  <a id="prev" class="btn btn-basic" href="{% link _docs/next-steps.md %}">Back</a>
9
+ <a id="next" class="btn btn-primary" href="{% link reference.md %}">Next Step</a>
10
+ <p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
@@ -2,7 +2,7 @@
2
2
  title: Docs
3
3
  ---
4
4
 
5
- ### Overview
5
+ ## Overview
6
6
 
7
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
8
 
@@ -14,7 +14,7 @@ Ufo was built directly from real life production use cases after seeing the same
14
14
 
15
15
  Next we'll cover different ways to install ufo.
16
16
 
17
- <a id="prev" class="btn btn-basic" href="{% link quick-start.md %}">Back</a>
18
- <a id="next" class="btn btn-primary" href="{% link _docs/install.md %}">Next Step</a>
17
+ <a id="prev" class="btn btn-basic" href="{% link _docs/tutorial-ufo-ships.md %}">Back</a>
18
+ <a id="next" class="btn btn-primary" href="{% link _docs/structure.md %}">Next Step</a>
19
19
  <p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
20
20
 
@@ -12,7 +12,7 @@ ufo init --app=hi --image=tongueroo/hi
12
12
  ufo ship hi-web
13
13
  ```
14
14
 
15
- ### What Happened
15
+ ## What Happened
16
16
 
17
17
  The `ufo ship hi-web` command does the following:
18
18
 
@@ -49,6 +49,6 @@ Note: This quick start does require that you have a docker working on your envir
49
49
 
50
50
  Learn more in the next sections.
51
51
 
52
- <a id="next" class="btn btn-primary" href="{% link docs.md %}">Next Step</a>
52
+ <a id="next" class="btn btn-primary" href="{% link _docs/install.md %}">Next Step</a>
53
53
  <p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
54
54
 
@@ -0,0 +1,18 @@
1
+ ---
2
+ title: CLI Reference
3
+ ---
4
+ {% include reference.md %}
5
+
6
+ * [ufo completion]({% link _reference/ufo-completion.md %})
7
+ * [ufo completion_script]({% link _reference/ufo-completion_script.md %})
8
+ * [ufo deploy]({% link _reference/ufo-deploy.md %})
9
+ * [ufo destroy]({% link _reference/ufo-destroy.md %})
10
+ * [ufo docker]({% link _reference/ufo-docker.md %})
11
+ * [ufo init]({% link _reference/ufo-init.md %})
12
+ * [ufo scale]({% link _reference/ufo-scale.md %})
13
+ * [ufo ship]({% link _reference/ufo-ship.md %})
14
+ * [ufo ships]({% link _reference/ufo-ships.md %})
15
+ * [ufo task]({% link _reference/ufo-task.md %})
16
+ * [ufo tasks]({% link _reference/ufo-tasks.md %})
17
+ * [ufo upgrade3]({% link _reference/ufo-upgrade3.md %})
18
+ * [ufo version]({% link _reference/ufo-version.md %})
@@ -8,11 +8,11 @@ module Ufo
8
8
  class_option :noop, type: :boolean
9
9
  class_option :cluster, desc: "Cluster. Overrides ufo/settings.yml."
10
10
 
11
- desc "docker SUBCOMMAND", "docker related tasks"
11
+ desc "docker SUBCOMMAND", "docker subcommands"
12
12
  long_desc Help.text(:docker)
13
13
  subcommand "docker", Docker
14
14
 
15
- desc "tasks SUBCOMMAND", "task definition related tasks"
15
+ desc "tasks SUBCOMMAND", "task definition subcommands"
16
16
  long_desc Help.text(:tasks)
17
17
  subcommand "tasks", Tasks
18
18
 
@@ -20,7 +20,7 @@ module Ufo
20
20
  Init.cli_options.each do |args|
21
21
  option *args
22
22
  end
23
- register(Init, "init", "new", "setup initial ufo files")
23
+ register(Init, "init", "new", "Set up initial ufo files.")
24
24
 
25
25
  # common options to deploy. ship, and ships command
26
26
  ship_options = Proc.new do
@@ -33,7 +33,7 @@ module Ufo
33
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."
34
34
  end
35
35
 
36
- desc "deploy SERVICE", "deploys task definition to ECS service without re-building the definition"
36
+ desc "deploy SERVICE", "Deploy task definition to ECS service without re-building the definition."
37
37
  long_desc Help.text(:deploy)
38
38
  ship_options.call
39
39
  def deploy(service)
@@ -43,7 +43,7 @@ module Ufo
43
43
  ship.deploy
44
44
  end
45
45
 
46
- desc "ship SERVICE", "builds and ships container image to the ECS service"
46
+ desc "ship SERVICE", "Builds and ships container image to the ECS service."
47
47
  long_desc Help.text(:ship)
48
48
  ship_options.call
49
49
  def ship(service)
@@ -57,7 +57,7 @@ module Ufo
57
57
  cleanup(builder.image_name)
58
58
  end
59
59
 
60
- 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."
61
61
  long_desc Help.text(:ships)
62
62
  ship_options.call
63
63
  def ships(*services)
@@ -74,7 +74,7 @@ module Ufo
74
74
  cleanup(builder.image_name)
75
75
  end
76
76
 
77
- desc "task TASK_DEFINITION", "runs a one time task"
77
+ desc "task TASK_DEFINITION", "Run a one-time task."
78
78
  long_desc Help.text(:task)
79
79
  option :docker, type: :boolean, desc: "Enable docker build and push", default: true
80
80
  option :command, type: :array, desc: "Override the command used for the container"
@@ -84,7 +84,7 @@ module Ufo
84
84
  Task.new(task_definition, options).run
85
85
  end
86
86
 
87
- desc "destroy SERVICE", "destroys the ECS service"
87
+ desc "destroy SERVICE", "Destroy the ECS service."
88
88
  long_desc Help.text(:destroy)
89
89
  option :sure, type: :boolean, desc: "By pass are you sure prompt."
90
90
  def destroy(service)
@@ -92,31 +92,31 @@ module Ufo
92
92
  Destroy.new(service, options).bye
93
93
  end
94
94
 
95
- desc "scale SERVICE COUNT", "scale the ECS service"
95
+ desc "scale SERVICE COUNT", "Scale the ECS service."
96
96
  long_desc Help.text(:scale)
97
97
  def scale(service, count)
98
98
  Scale.new(service, count, options).update
99
99
  end
100
100
 
101
- desc "completion *PARAMS", "prints words for auto-completion"
101
+ desc "completion *PARAMS", "Prints words for auto-completion."
102
102
  long_desc Help.text("completion")
103
103
  def completion(*params)
104
104
  Completer.new(CLI, *params).run
105
105
  end
106
106
 
107
- desc "completion_script", "generates script that can be eval to setup auto-completion", hide: true
107
+ desc "completion_script", "Generates a script that can be eval to setup auto-completion.", hide: true
108
108
  long_desc Help.text("completion_script")
109
109
  def completion_script
110
110
  Completer::Script.generate
111
111
  end
112
112
 
113
- desc "upgrade3", "upgrade from version 2 to 3"
113
+ desc "upgrade3", "Upgrade from version 2 to 3."
114
114
  long_desc Help.text("upgrade3")
115
115
  def upgrade3
116
116
  Upgrade3.new(options).run
117
117
  end
118
118
 
119
- desc "version", "Prints version number of installed ufo"
119
+ desc "version", "Prints version number of installed ufo."
120
120
  def version
121
121
  puts VERSION
122
122
  end