ufo 3.1.2 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/bin/commit_docs.sh +26 -0
- data/.circleci/config.yml +13 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +6 -4
- data/Rakefile +7 -0
- data/docs/_config.yml +3 -0
- data/docs/_docs/conventions.md +3 -3
- data/docs/_docs/install.md +5 -5
- data/docs/_docs/settings.md +3 -3
- data/docs/_docs/structure.md +2 -2
- data/docs/_docs/tutorial-ufo-docker-build.md +1 -1
- data/docs/_docs/tutorial-ufo-init.md +1 -1
- data/docs/_docs/tutorial-ufo-ship.md +3 -7
- data/docs/_docs/tutorial-ufo-ships.md +2 -2
- data/docs/_docs/tutorial-ufo-tasks-build.md +7 -7
- data/docs/_docs/tutorial.md +1 -1
- data/docs/_docs/ufo-env.md +5 -5
- data/docs/_docs/ufo-tasks-register.md +0 -4
- data/docs/_docs/variables.md +6 -7
- data/docs/_includes/content.html +5 -0
- data/docs/_includes/css/main.css +23 -4
- data/docs/_includes/css/ufo.css +9 -9
- data/docs/_includes/reference.md +5 -0
- data/docs/_includes/subnav.html +16 -33
- data/docs/_reference/ufo-completion.md +46 -0
- data/docs/_reference/ufo-completion_script.md +27 -0
- data/docs/_reference/ufo-deploy.md +51 -0
- data/docs/_reference/ufo-destroy.md +34 -0
- data/docs/{_docs → _reference}/ufo-docker-base.md +36 -17
- data/docs/_reference/ufo-docker-build.md +81 -0
- data/docs/_reference/ufo-docker-clean.md +44 -0
- data/docs/_reference/ufo-docker-help.md +15 -0
- data/docs/_reference/ufo-docker-name.md +37 -0
- data/docs/_reference/ufo-docker-push.md +49 -0
- data/docs/_reference/ufo-docker.md +35 -0
- data/docs/_reference/ufo-init.md +74 -0
- data/docs/_reference/ufo-scale.md +30 -0
- data/docs/_reference/ufo-ship.md +100 -0
- data/docs/_reference/ufo-ships.md +77 -0
- data/docs/_reference/ufo-task.md +37 -0
- data/docs/_reference/ufo-tasks-build.md +179 -0
- data/docs/_reference/ufo-tasks-help.md +15 -0
- data/docs/_reference/ufo-tasks-register.md +29 -0
- data/docs/_reference/ufo-tasks.md +35 -0
- data/docs/_reference/ufo-upgrade3.md +23 -0
- data/docs/_reference/ufo-version.md +23 -0
- data/docs/articles.md +2 -0
- data/docs/docs.md +3 -3
- data/docs/quick-start.md +2 -2
- data/docs/reference.md +18 -0
- data/lib/ufo/cli.rb +13 -13
- data/lib/ufo/docker.rb +5 -5
- data/lib/ufo/ecr/auth.rb +6 -1
- data/lib/ufo/ecr/cleaner.rb +1 -1
- data/lib/ufo/help/completion.md +1 -1
- data/lib/ufo/help/completions.md +1 -1
- data/lib/ufo/help/deploy.md +5 -1
- data/lib/ufo/help/destroy.md +7 -3
- data/lib/ufo/help/docker.md +1 -1
- data/lib/ufo/help/docker/base.md +34 -4
- data/lib/ufo/help/docker/build.md +59 -4
- data/lib/ufo/help/docker/clean.md +12 -6
- data/lib/ufo/help/docker/name.md +10 -10
- data/lib/ufo/help/docker/push.md +23 -6
- data/lib/ufo/help/hello.md +1 -1
- data/lib/ufo/help/init.md +43 -5
- data/lib/ufo/help/scale.md +4 -3
- data/lib/ufo/help/ship.md +59 -8
- data/lib/ufo/help/ships.md +35 -9
- data/lib/ufo/help/task.md +1 -1
- data/lib/ufo/help/tasks.md +1 -1
- data/lib/ufo/help/tasks/build.md +155 -4
- data/lib/ufo/help/tasks/register.md +12 -3
- data/lib/ufo/ship.rb +2 -4
- data/lib/ufo/tasks.rb +2 -2
- data/lib/ufo/version.rb +1 -1
- data/spec/lib/ship_spec.rb +2 -1
- data/ufo.gemspec +3 -3
- metadata +44 -21
- data/docs/_docs/commands.md +0 -10
- data/docs/_docs/ufo-deploy.md +0 -30
- data/docs/_docs/ufo-destroy.md +0 -19
- data/docs/_docs/ufo-docker-build.md +0 -79
- data/docs/_docs/ufo-docker-clean.md +0 -27
- data/docs/_docs/ufo-docker-name.md +0 -15
- data/docs/_docs/ufo-docker-push.md +0 -43
- data/docs/_docs/ufo-help.md +0 -22
- data/docs/_docs/ufo-init.md +0 -54
- data/docs/_docs/ufo-scale.md +0 -21
- data/docs/_docs/ufo-ship.md +0 -75
- data/docs/_docs/ufo-ships.md +0 -52
- data/docs/_docs/ufo-tasks-build.md +0 -166
- data/lib/ufo/completion.rb +0 -15
- data/lib/ufo/sub.rb +0 -12
@@ -1,166 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: ufo tasks build
|
3
|
-
---
|
4
|
-
|
5
|
-
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.
|
6
|
-
|
7
|
-
1. ufo/templates/main.json.erb
|
8
|
-
2. ufo/task_definitions.rb
|
9
|
-
|
10
|
-
Here's an example of each of them:
|
11
|
-
|
12
|
-
**main.json.erb**:
|
13
|
-
|
14
|
-
```json
|
15
|
-
{
|
16
|
-
"family": "<%= @family %>",
|
17
|
-
"containerDefinitions": [
|
18
|
-
{
|
19
|
-
"name": "<%= @name %>",
|
20
|
-
"image": "<%= @image %>",
|
21
|
-
"cpu": <%= @cpu %>,
|
22
|
-
<% if @memory %>
|
23
|
-
"memory": <%= @memory %>,
|
24
|
-
<% end %>
|
25
|
-
<% if @memory_reservation %>
|
26
|
-
"memoryReservation": <%= @memory_reservation %>,
|
27
|
-
<% end %>
|
28
|
-
<% if @container_port %>
|
29
|
-
"portMappings": [
|
30
|
-
{
|
31
|
-
"containerPort": "<%= @container_port %>",
|
32
|
-
"protocol": "tcp"
|
33
|
-
}
|
34
|
-
],
|
35
|
-
<% end %>
|
36
|
-
"command": <%= @command.to_json %>,
|
37
|
-
<% if @environment %>
|
38
|
-
"environment": <%= @environment.to_json %>,
|
39
|
-
<% end %>
|
40
|
-
<% if @awslogs_group %>
|
41
|
-
"logConfiguration": {
|
42
|
-
"logDriver": "awslogs",
|
43
|
-
"options": {
|
44
|
-
"awslogs-group": "<%= @awslogs_group %>",
|
45
|
-
"awslogs-region": "<%= @awslogs_region || 'us-east-1' %>",
|
46
|
-
"awslogs-stream-prefix": "<%= @awslogs_stream_prefix %>"
|
47
|
-
}
|
48
|
-
},
|
49
|
-
<% end %>
|
50
|
-
"essential": true
|
51
|
-
}
|
52
|
-
]
|
53
|
-
}
|
54
|
-
```
|
55
|
-
|
56
|
-
**task_definitions.rb**:
|
57
|
-
|
58
|
-
```
|
59
|
-
task_definition "hi-web" do
|
60
|
-
source "main" # will use ufo/templates/main.json.erb
|
61
|
-
variables(
|
62
|
-
family: task_definition_name,
|
63
|
-
name: "web",
|
64
|
-
container_port: helper.dockerfile_port,
|
65
|
-
command: ["bin/web"]
|
66
|
-
)
|
67
|
-
end
|
68
|
-
|
69
|
-
task_definition "hi-worker" do
|
70
|
-
source "main" # will use ufo/templates/main.json.erb
|
71
|
-
variables(
|
72
|
-
family: task_definition_name,
|
73
|
-
name: "worker",
|
74
|
-
command: ["bin/worker"]
|
75
|
-
)
|
76
|
-
end
|
77
|
-
|
78
|
-
task_definition "hi-clock" do
|
79
|
-
source "main" # will use ufo/templates/main.json.erb
|
80
|
-
variables(
|
81
|
-
family: task_definition_name,
|
82
|
-
name: "clock",
|
83
|
-
command: ["bin/clock"]
|
84
|
-
)
|
85
|
-
end
|
86
|
-
```
|
87
|
-
|
88
|
-
The shared variables are set in the variables folder:
|
89
|
-
|
90
|
-
**ufo/variables/base.rb**:
|
91
|
-
|
92
|
-
```ruby
|
93
|
-
@image = helper.full_image_name # includes the git sha tongueroo/hi:ufo-[sha].
|
94
|
-
@cpu = 128
|
95
|
-
@memory_reservation = 256
|
96
|
-
@environment = helper.env_file(".env")
|
97
|
-
```
|
98
|
-
|
99
|
-
**ufo/variables/production.rb**:
|
100
|
-
|
101
|
-
```ruby
|
102
|
-
@environment = helper.env_vars(%Q{
|
103
|
-
RAILS_ENV=production
|
104
|
-
SECRET_KEY_BASE=secret
|
105
|
-
})
|
106
|
-
```
|
107
|
-
|
108
|
-
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.
|
109
|
-
|
110
|
-
To build the task definitions:
|
111
|
-
|
112
|
-
```sh
|
113
|
-
ufo tasks build
|
114
|
-
```
|
115
|
-
|
116
|
-
You should see output similar to below:
|
117
|
-
|
118
|
-
```sh
|
119
|
-
$ ufo tasks build
|
120
|
-
Building Task Definitions...
|
121
|
-
Generating Task Definitions:
|
122
|
-
ufo/output/hi-web.json
|
123
|
-
ufo/output/hi-worker.json
|
124
|
-
ufo/output/hi-clock.json
|
125
|
-
Task Definitions built in ufo/output.
|
126
|
-
$
|
127
|
-
```
|
128
|
-
|
129
|
-
Let's take a look at one of the generated files: `ufo/output/hi-web.json`.
|
130
|
-
|
131
|
-
```json
|
132
|
-
{
|
133
|
-
"family": "hi-web",
|
134
|
-
"containerDefinitions": [
|
135
|
-
{
|
136
|
-
"name": "web",
|
137
|
-
"image": "tongueroo/hi:ufo-2017-06-11T22-22-32-a18aa30",
|
138
|
-
"cpu": 128,
|
139
|
-
"memoryReservation": 256,
|
140
|
-
"portMappings": [
|
141
|
-
{
|
142
|
-
"containerPort": "3000",
|
143
|
-
"protocol": "tcp"
|
144
|
-
}
|
145
|
-
],
|
146
|
-
"command": [
|
147
|
-
"bin/web"
|
148
|
-
],
|
149
|
-
"environment": [
|
150
|
-
{
|
151
|
-
"name": "RAILS_ENV",
|
152
|
-
"value": "staging"
|
153
|
-
}
|
154
|
-
],
|
155
|
-
"essential": true
|
156
|
-
}
|
157
|
-
]
|
158
|
-
}
|
159
|
-
```
|
160
|
-
|
161
|
-
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.
|
162
|
-
|
163
|
-
<a id="prev" class="btn btn-basic" href="{% link _docs/ufo-docker-clean.md %}">Back</a>
|
164
|
-
<a id="next" class="btn btn-primary" href="{% link _docs/ufo-tasks-register.md %}">Next Step</a>
|
165
|
-
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
166
|
-
|
data/lib/ufo/completion.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
module Ufo
|
2
|
-
class Completion < Command
|
3
|
-
desc "script", "generates script that can be eval to setup auto-completion"
|
4
|
-
long_desc Help.text("completion:script")
|
5
|
-
def script
|
6
|
-
Completer::Script.generate
|
7
|
-
end
|
8
|
-
|
9
|
-
desc "completions *PARAMS", "prints words for auto-completion"
|
10
|
-
long_desc Help.text("completion:list")
|
11
|
-
def list(*params)
|
12
|
-
Completer.new(*params).run
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/lib/ufo/sub.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
module Ufo
|
2
|
-
class Sub < Command
|
3
|
-
|
4
|
-
desc "goodbye NAME", "say goodbye to NAME"
|
5
|
-
long_desc Help.text("sub:goodbye")
|
6
|
-
option :from, desc: "from person"
|
7
|
-
def goodbye(name="you")
|
8
|
-
puts "from: #{options[:from]}" if options[:from]
|
9
|
-
puts "Goodbye #{name}"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|