ufo 3.5.7 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/Gemfile.lock +16 -10
- data/README.md +12 -13
- data/docs/_config.yml +1 -1
- data/docs/_docs/auto-completion.md +4 -4
- data/docs/_docs/automated-cleanup.md +1 -1
- data/docs/_docs/conventions.md +7 -7
- data/docs/_docs/customize-cloudformation.md +36 -0
- data/docs/_docs/faq.md +9 -7
- data/docs/_docs/fargate.md +102 -0
- data/docs/_docs/helpers.md +3 -3
- data/docs/_docs/load-balancer.md +72 -0
- data/docs/_docs/migrations.md +2 -2
- data/docs/_docs/next-steps.md +2 -2
- data/docs/_docs/params.md +12 -41
- data/docs/_docs/route53-support.md +28 -0
- data/docs/_docs/run-in-pieces.md +2 -2
- data/docs/_docs/security-groups.md +54 -0
- data/docs/_docs/settings-cfn.md +11 -0
- data/docs/_docs/settings-network.md +34 -0
- data/docs/_docs/settings.md +18 -15
- data/docs/_docs/single-task.md +3 -3
- data/docs/_docs/ssl-support.md +42 -0
- data/docs/_docs/structure.md +5 -1
- data/docs/_docs/stuck-cloudformation.md +30 -0
- data/docs/_docs/tutorial-ufo-docker-build.md +19 -31
- data/docs/_docs/tutorial-ufo-init.md +16 -12
- data/docs/_docs/tutorial-ufo-ship.md +50 -54
- data/docs/_docs/tutorial-ufo-ships.md +9 -7
- data/docs/_docs/tutorial-ufo-tasks-build.md +26 -17
- data/docs/_docs/ufo-current.md +50 -0
- data/docs/_docs/ufo-env-extra.md +21 -0
- data/docs/_docs/ufo-env.md +6 -13
- data/docs/_docs/ufo-tasks-register.md +3 -3
- data/docs/_docs/upgrade4.md +49 -0
- data/docs/_docs/variables.md +5 -5
- data/docs/_docs/why-cloudformation.md +22 -0
- data/docs/_includes/about.html +1 -1
- data/docs/_includes/cfn-customize.md +39 -0
- data/docs/_includes/commands.html +6 -6
- data/docs/_includes/css/ufo.css +1 -0
- data/docs/_includes/example.html +13 -13
- data/docs/_includes/reference.md +1 -1
- data/docs/_includes/subnav.html +22 -5
- data/docs/_includes/ufo-ship-options.md +7 -6
- data/docs/_reference/ufo-apps.md +36 -0
- data/docs/_reference/ufo-cancel.md +24 -0
- data/docs/_reference/ufo-completion.md +1 -1
- data/docs/_reference/ufo-completion_script.md +1 -1
- data/docs/_reference/ufo-current.md +93 -0
- data/docs/_reference/ufo-deploy.md +18 -17
- data/docs/_reference/ufo-destroy.md +6 -4
- data/docs/_reference/ufo-docker-base.md +7 -7
- data/docs/_reference/ufo-docker-build.md +9 -9
- data/docs/_reference/ufo-docker-clean.md +8 -8
- data/docs/_reference/ufo-docker-name.md +4 -4
- data/docs/_reference/ufo-docker.md +4 -2
- data/docs/_reference/ufo-init.md +31 -20
- data/docs/_reference/ufo-network-help.md +15 -0
- data/docs/_reference/ufo-network-init.md +38 -0
- data/docs/_reference/ufo-network.md +26 -0
- data/docs/_reference/ufo-ps.md +53 -0
- data/docs/_reference/ufo-releases.md +40 -0
- data/docs/_reference/ufo-resources.md +44 -0
- data/docs/_reference/ufo-rollback.md +59 -0
- data/docs/_reference/ufo-scale.md +23 -3
- data/docs/_reference/ufo-ship.md +54 -27
- data/docs/_reference/ufo-ships.md +17 -26
- data/docs/_reference/ufo-stop.md +31 -0
- data/docs/_reference/ufo-task.md +15 -16
- data/docs/_reference/ufo-tasks-build.md +10 -10
- data/docs/_reference/ufo-tasks-register.md +3 -3
- data/docs/_reference/ufo-tasks.md +1 -1
- data/docs/_reference/ufo-upgrade-help.md +15 -0
- data/docs/_reference/ufo-upgrade-v2to3.md +15 -0
- data/docs/_reference/ufo-upgrade-v3_3to3_4.md +15 -0
- data/docs/_reference/ufo-upgrade-v3to4.md +27 -0
- data/docs/_reference/ufo-upgrade.md +28 -0
- data/docs/_reference/ufo-version.md +1 -1
- data/docs/articles.md +2 -2
- data/docs/docs.md +1 -1
- data/docs/img/docs/cloudformation-resources.png +0 -0
- data/docs/img/tutorials/ecs-console-task-definitions.png +0 -0
- data/docs/img/tutorials/ecs-console-ufo-ship.png +0 -0
- data/docs/img/tutorials/ecs-console-ufo-ships.png +0 -0
- data/docs/quick-start.md +21 -9
- data/docs/reference.md +10 -2
- data/exe/ufo +1 -1
- data/lib/cfn/stack.yml +259 -0
- data/lib/template/.ufo/params.yml.tt +21 -60
- data/lib/template/.ufo/settings.yml.tt +6 -1
- data/lib/template/.ufo/settings/cfn/default.yml.tt +55 -0
- data/lib/template/.ufo/settings/network/default.yml.tt +18 -0
- data/lib/template/.ufo/task_definitions.rb.tt +7 -6
- data/lib/template/.ufo/templates/fargate.json.erb +1 -1
- data/lib/template/.ufo/templates/main.json.erb +1 -0
- data/lib/template/.ufo/variables/base.rb.tt +5 -2
- data/lib/template/Dockerfile +10 -15
- data/lib/template/bin/deploy.tt +2 -2
- data/lib/ufo.rb +29 -20
- data/lib/ufo/apps.rb +49 -0
- data/lib/ufo/apps/cfn_map.rb +70 -0
- data/lib/ufo/apps/service.rb +56 -0
- data/lib/ufo/aws_service.rb +15 -6
- data/lib/ufo/base.rb +32 -0
- data/lib/ufo/cancel.rb +23 -0
- data/lib/ufo/cli.rb +91 -27
- data/lib/ufo/core.rb +35 -3
- data/lib/ufo/current.rb +104 -0
- data/lib/ufo/destroy.rb +10 -41
- data/lib/ufo/docker/builder.rb +5 -4
- data/lib/ufo/docker/cleaner.rb +1 -1
- data/lib/ufo/docker/pusher.rb +2 -2
- data/lib/ufo/ecr/cleaner.rb +1 -1
- data/lib/ufo/help/apps.md +12 -0
- data/lib/ufo/help/balancer.md +3 -0
- data/lib/ufo/help/current.md +65 -0
- data/lib/ufo/help/deploy.md +4 -4
- data/lib/ufo/help/destroy.md +3 -3
- data/lib/ufo/help/docker.md +3 -1
- data/lib/ufo/help/docker/base.md +7 -7
- data/lib/ufo/help/docker/build.md +9 -9
- data/lib/ufo/help/docker/clean.md +8 -8
- data/lib/ufo/help/docker/name.md +4 -4
- data/lib/ufo/help/help.md +5 -0
- data/lib/ufo/help/init.md +24 -16
- data/lib/ufo/help/network/init.md +13 -0
- data/lib/ufo/help/ps.md +27 -0
- data/lib/ufo/help/releases.md +16 -0
- data/lib/ufo/help/resources.md +20 -0
- data/lib/ufo/help/rollback.md +35 -0
- data/lib/ufo/help/scale.md +22 -2
- data/lib/ufo/help/ship.md +40 -14
- data/lib/ufo/help/ships.md +4 -13
- data/lib/ufo/help/stop.md +7 -0
- data/lib/ufo/help/task.md +9 -9
- data/lib/ufo/help/tasks/build.md +10 -10
- data/lib/ufo/help/tasks/register.md +3 -3
- data/lib/ufo/help/upgrade/v3to4.md +3 -0
- data/lib/ufo/info.rb +62 -0
- data/lib/ufo/init.rb +36 -23
- data/lib/ufo/log_group.rb +2 -1
- data/lib/ufo/network.rb +24 -0
- data/lib/ufo/network/fetch.rb +41 -0
- data/lib/ufo/network/helper.rb +23 -0
- data/lib/ufo/network/init.rb +26 -0
- data/lib/ufo/param.rb +5 -5
- data/lib/ufo/ps.rb +102 -0
- data/lib/ufo/ps/task.rb +78 -0
- data/lib/ufo/releases.rb +14 -0
- data/lib/ufo/rollback.rb +53 -0
- data/lib/ufo/scale.rb +6 -12
- data/lib/ufo/sequence.rb +7 -0
- data/lib/ufo/setting.rb +7 -6
- data/lib/ufo/setting/profile.rb +24 -0
- data/lib/ufo/ship.rb +35 -326
- data/lib/ufo/stack.rb +203 -0
- data/lib/ufo/stack/context.rb +242 -0
- data/lib/ufo/stack/helper.rb +28 -0
- data/lib/ufo/stack/status.rb +195 -0
- data/lib/ufo/stop.rb +47 -0
- data/lib/ufo/task.rb +96 -15
- data/lib/ufo/tasks/register.rb +1 -1
- data/lib/ufo/template_scope.rb +81 -7
- data/lib/ufo/upgrade.rb +32 -0
- data/lib/ufo/{upgrade3.rb → upgrade/upgrade3.rb} +1 -1
- data/lib/ufo/{upgrade33_to_34.rb → upgrade/upgrade33to34.rb} +2 -2
- data/lib/ufo/upgrade/upgrade4.rb +161 -0
- data/lib/ufo/util.rb +19 -6
- data/lib/ufo/version.rb +1 -1
- data/spec/fixtures/apps/describe_services.json +96 -0
- data/spec/fixtures/cfn/stack-events-complete.json +1080 -0
- data/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
- data/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
- data/spec/fixtures/deployments.json +50 -0
- data/spec/fixtures/ps/describe_tasks.json +58 -0
- data/spec/fixtures/settings.yml +2 -0
- data/spec/lib/apps_spec.rb +20 -0
- data/spec/lib/cli_spec.rb +4 -4
- data/spec/lib/ps_spec.rb +14 -0
- data/spec/lib/setting_spec.rb +2 -1
- data/spec/lib/ship_spec.rb +6 -30
- data/spec/lib/stack/status_spec.rb +76 -0
- data/spec/lib/stop_spec.rb +13 -0
- data/spec/lib/task_spec.rb +5 -2
- data/spec/spec_helper.rb +1 -1
- data/ufo.gemspec +2 -0
- metadata +120 -6
- data/docs/_reference/ufo-upgrade3.md +0 -23
- data/docs/_reference/ufo-upgrade3_3_to_3_4.md +0 -23
data/docs/_reference/ufo-task.md
CHANGED
@@ -16,29 +16,28 @@ Run a one-time task.
|
|
16
16
|
You can use the `--command` or `-c` option to override the Docker container command.
|
17
17
|
|
18
18
|
ufo task hi-migrate # default command
|
19
|
-
ufo task
|
20
|
-
ufo task
|
21
|
-
ufo task
|
22
|
-
ufo task
|
19
|
+
ufo task demo-web --command bin/migrate
|
20
|
+
ufo task demo-web --command bin/with_env bundle exec rake db:migrate:redo VERSION=xxx
|
21
|
+
ufo task demo-web -c uptime
|
22
|
+
ufo task demo-web -c pwd
|
23
23
|
|
24
|
-
## Skipping Docker
|
24
|
+
## Skipping Docker and Task Registration
|
25
25
|
|
26
|
-
The `--
|
26
|
+
The `--task-only` option is useful. By default, the `ufo task` command will build the docker image and then register a new task definition. The docker build process usually is the part that takes the most time. You can skip the docker build process after building it at least once. This is a faster way to run a bunch of commands with the same Docker image. Example:
|
27
27
|
|
28
|
-
ufo task
|
29
|
-
ufo task
|
30
|
-
ufo task
|
28
|
+
ufo task demo-web -c uptime # build at least once
|
29
|
+
ufo task demo-web --task-only -c ls # skip docker for speed
|
30
|
+
ufo task demo-web --task-only -c pwd # skip docker for speed
|
31
31
|
|
32
32
|
|
33
33
|
## Options
|
34
34
|
|
35
35
|
```
|
36
|
-
[--
|
37
|
-
|
38
|
-
|
39
|
-
[--
|
40
|
-
[--
|
41
|
-
[--
|
42
|
-
[--cluster=CLUSTER] # Cluster. Overrides ufo/settings.yml.
|
36
|
+
[--task-only], [--no-task-only] # Skip docker and task register steps. Only run the task.
|
37
|
+
c, [--command=one two three] # Override the command used for the container
|
38
|
+
[--verbose], [--no-verbose]
|
39
|
+
[--mute], [--no-mute]
|
40
|
+
[--noop], [--no-noop]
|
41
|
+
[--cluster=CLUSTER] # Cluster. Overrides .ufo/settings.yml.
|
43
42
|
```
|
44
43
|
|
@@ -71,7 +71,7 @@ Here's an example of each of them:
|
|
71
71
|
**task_definitions.rb**:
|
72
72
|
|
73
73
|
```ruby
|
74
|
-
task_definition "
|
74
|
+
task_definition "demo-web" do
|
75
75
|
source "main" # will use ufo/templates/main.json.erb
|
76
76
|
variables(
|
77
77
|
family: task_definition_name,
|
@@ -81,7 +81,7 @@ task_definition "hi-web" do
|
|
81
81
|
)
|
82
82
|
end
|
83
83
|
|
84
|
-
task_definition "
|
84
|
+
task_definition "demo-worker" do
|
85
85
|
source "main" # will use ufo/templates/main.json.erb
|
86
86
|
variables(
|
87
87
|
family: task_definition_name,
|
@@ -90,7 +90,7 @@ task_definition "hi-worker" do
|
|
90
90
|
)
|
91
91
|
end
|
92
92
|
|
93
|
-
task_definition "
|
93
|
+
task_definition "demo-clock" do
|
94
94
|
source "main" # will use ufo/templates/main.json.erb
|
95
95
|
variables(
|
96
96
|
family: task_definition_name,
|
@@ -105,7 +105,7 @@ The shared variables are set in the variables folder:
|
|
105
105
|
**ufo/variables/base.rb**:
|
106
106
|
|
107
107
|
```ruby
|
108
|
-
@image = helper.full_image_name # includes the git sha tongueroo/
|
108
|
+
@image = helper.full_image_name # includes the git sha tongueroo/demo-ufo:ufo-[sha].
|
109
109
|
@cpu = 128
|
110
110
|
@memory_reservation = 256
|
111
111
|
@environment = helper.env_file(".env")
|
@@ -131,20 +131,20 @@ You should see output similar to below:
|
|
131
131
|
$ ufo tasks build
|
132
132
|
Building Task Definitions...
|
133
133
|
Generating Task Definitions:
|
134
|
-
ufo/output/
|
135
|
-
ufo/output/
|
136
|
-
ufo/output/
|
134
|
+
ufo/output/demo-web.json
|
135
|
+
ufo/output/demo-worker.json
|
136
|
+
ufo/output/demo-clock.json
|
137
137
|
Task Definitions built in ufo/output.
|
138
138
|
$
|
139
139
|
|
140
|
-
Let's take a look at one of the generated files: `.ufo/output/
|
140
|
+
Let's take a look at one of the generated files: `.ufo/output/demo-web.json`.
|
141
141
|
|
142
142
|
{
|
143
|
-
"family": "
|
143
|
+
"family": "demo-web",
|
144
144
|
"containerDefinitions": [
|
145
145
|
{
|
146
146
|
"name": "web",
|
147
|
-
"image": "tongueroo/
|
147
|
+
"image": "tongueroo/demo-ufo:ufo-2017-06-11T22-22-32-a18aa30",
|
148
148
|
"cpu": 128,
|
149
149
|
"memoryReservation": 256,
|
150
150
|
"portMappings": [
|
@@ -17,9 +17,9 @@ The `ufo tasks register` command registers all the generated task definitions in
|
|
17
17
|
|
18
18
|
You should see something similiar to this:
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
demo-clock task definition registered.
|
21
|
+
demo-web task definition registered.
|
22
|
+
demo-worker task definition registered.
|
23
23
|
|
24
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
25
|
|
@@ -30,6 +30,6 @@ Note all the existing ufo/output generated task defintions are wiped out.
|
|
30
30
|
[--verbose], [--no-verbose]
|
31
31
|
[--mute], [--no-mute]
|
32
32
|
[--noop], [--no-noop]
|
33
|
-
[--cluster=CLUSTER] # Cluster. Overrides ufo/settings.yml.
|
33
|
+
[--cluster=CLUSTER] # Cluster. Overrides .ufo/settings.yml.
|
34
34
|
```
|
35
35
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
title: ufo upgrade v3to4
|
3
|
+
reference: true
|
4
|
+
---
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
ufo upgrade v3to4
|
9
|
+
|
10
|
+
## Description
|
11
|
+
|
12
|
+
Upgrade from version 3 to 4.
|
13
|
+
|
14
|
+
## Examples
|
15
|
+
|
16
|
+
ufo upgrade v3to4 --vpc-id vpc-123 --ecs-subnets subnet-111 subnet-222 --elb-subnets subnet-111 subnet-222
|
17
|
+
|
18
|
+
|
19
|
+
## Options
|
20
|
+
|
21
|
+
```
|
22
|
+
[--force] # Bypass overwrite are you sure prompt for existing files.
|
23
|
+
[--vpc-id=VPC_ID] # Vpc id
|
24
|
+
[--ecs-subnets=one two three] # Subnets for ECS tasks, defaults to --elb-subnets set to
|
25
|
+
[--elb-subnets=one two three] # Subnets for ELB
|
26
|
+
```
|
27
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
title: ufo upgrade
|
3
|
+
reference: true
|
4
|
+
---
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
ufo upgrade SUBCOMMAND
|
9
|
+
|
10
|
+
## Description
|
11
|
+
|
12
|
+
upgrade subcommands
|
13
|
+
|
14
|
+
## Subcommands
|
15
|
+
|
16
|
+
* [ufo upgrade v2to3]({% link _reference/ufo-upgrade-v2to3.md %}) - Upgrade from version 2 to 3.
|
17
|
+
* [ufo upgrade v3_3to3_4]({% link _reference/ufo-upgrade-v3_3to3_4.md %}) - Upgrade from version 3.3 to 3.4
|
18
|
+
* [ufo upgrade v3to4]({% link _reference/ufo-upgrade-v3to4.md %}) - Upgrade from version 3 to 4.
|
19
|
+
|
20
|
+
## Options
|
21
|
+
|
22
|
+
```
|
23
|
+
[--verbose], [--no-verbose]
|
24
|
+
[--mute], [--no-mute]
|
25
|
+
[--noop], [--no-noop]
|
26
|
+
[--cluster=CLUSTER] # Cluster. Overrides .ufo/settings.yml.
|
27
|
+
```
|
28
|
+
|
data/docs/articles.md
CHANGED
@@ -5,6 +5,6 @@ title: Articles
|
|
5
5
|
* This blog post provides an introduction to the tool: [Ufo - Build Docker Containers and Ship Them to AWS ECS](https://medium.com/@tongueroo/ufo-easily-build-docker-containers-and-ship-them-to-aws-ecs-15556a2b39f#.qqu8o4wal)
|
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
|
-
<a id="prev" class="btn btn-basic" href="{% link _docs/
|
9
|
-
<a id="next" class="btn btn-primary" href="{% link
|
8
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/auto-completion.md %}">Back</a>
|
9
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/next-steps.md %}">Next Step</a>
|
10
10
|
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
data/docs/docs.md
CHANGED
@@ -4,7 +4,7 @@ title: Docs
|
|
4
4
|
|
5
5
|
## Overview
|
6
6
|
|
7
|
-
Ufo is a tool that makes
|
7
|
+
Ufo is a tool that makes deploying to AWS ECS easy. Ufo provides a `ufo ship` command that does this. It essentially:
|
8
8
|
|
9
9
|
1. ufo builds the docker container image
|
10
10
|
2. registers that image to ECS as a task definition
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/docs/quick-start.md
CHANGED
@@ -2,19 +2,22 @@
|
|
2
2
|
title: Quick Start
|
3
3
|
---
|
4
4
|
|
5
|
-
In a hurry? No sweat! Here's a quick start to using ufo that takes only a few minutes. For this example, we will use a sinatra app from [tongueroo/
|
5
|
+
In a hurry? No sweat! Here's a quick start to using ufo that takes only a few minutes. For this example, we will use a sinatra app from [tongueroo/demo-ufo](https://github.com/tongueroo/demo-ufo). The `ufo init` command sets up the ufo directory structure in your project. The `ufo ship` command deploys your code to an AWS ECS service. The `ufo ps` and `ufo scale` command shows you how to verify and scale additional containers.
|
6
6
|
|
7
7
|
```sh
|
8
8
|
gem install ufo
|
9
|
-
git clone https://github.com/tongueroo/
|
10
|
-
cd
|
11
|
-
ufo init --app=
|
12
|
-
ufo
|
9
|
+
git clone https://github.com/tongueroo/demo-ufo.git
|
10
|
+
cd demo-ufo
|
11
|
+
ufo init --app=demo --image=tongueroo/demo-ufo
|
12
|
+
ufo current demo-web
|
13
|
+
ufo ship
|
14
|
+
ufo ps
|
15
|
+
ufo scale 2
|
13
16
|
```
|
14
17
|
|
15
18
|
## What Happened
|
16
19
|
|
17
|
-
The `ufo ship
|
20
|
+
The `ufo ship demo-web` command does the following:
|
18
21
|
|
19
22
|
1. Builds the Docker image and pushes it to a registry
|
20
23
|
2. Builds the ECS task definitions and registry them to ECS
|
@@ -23,7 +26,7 @@ The `ufo ship hi-web` command does the following:
|
|
23
26
|
You should see something similar to this:
|
24
27
|
|
25
28
|
```
|
26
|
-
$ ufo init --app=
|
29
|
+
$ ufo init --app=demo --image=tongueroo/demo-ufo
|
27
30
|
Setting up ufo project...
|
28
31
|
create .env
|
29
32
|
create .ufo/settings.yml
|
@@ -36,13 +39,22 @@ Setting up ufo project...
|
|
36
39
|
create bin/deploy
|
37
40
|
append .gitignore
|
38
41
|
Starter ufo files created.
|
39
|
-
$ ufo ship
|
42
|
+
$ ufo ship demo-web
|
40
43
|
Building docker image with:
|
41
|
-
docker build -t tongueroo/
|
44
|
+
docker build -t tongueroo/demo-ufo:ufo-2017-09-10T15-00-19-c781aaf -f Dockerfile .
|
42
45
|
....
|
43
46
|
Software shipped!
|
47
|
+
$ ufo ps
|
48
|
+
+----------+------+-------------+---------------+---------+-------+
|
49
|
+
| Id | Name | Release | Started | Status | Notes |
|
50
|
+
+----------+------+-------------+---------------+---------+-------+
|
51
|
+
| f590ee5e | web | demo-web:85 | 1 minutes ago | RUNNING | |
|
52
|
+
+----------+------+-------------+---------------+---------+-------+
|
53
|
+
$ ufo scale 2
|
54
|
+
Scale demo-web service in development cluster to 2
|
44
55
|
$
|
45
56
|
```
|
57
|
+
|
46
58
|
Congratulations! You have successfully deployed code to AWS ECS with ufo. It was really that simple 😁
|
47
59
|
|
48
60
|
Note: This quick start does require that you have a docker working on your environment. For docker installation instructions refer to to the official [docker installation guide](https://docs.docker.com/engine/installation/).
|
data/docs/reference.md
CHANGED
@@ -3,17 +3,25 @@ title: CLI Reference
|
|
3
3
|
---
|
4
4
|
{% include reference.md %}
|
5
5
|
|
6
|
+
* [ufo apps]({% link _reference/ufo-apps.md %})
|
7
|
+
* [ufo cancel]({% link _reference/ufo-cancel.md %})
|
6
8
|
* [ufo completion]({% link _reference/ufo-completion.md %})
|
7
9
|
* [ufo completion_script]({% link _reference/ufo-completion_script.md %})
|
10
|
+
* [ufo current]({% link _reference/ufo-current.md %})
|
8
11
|
* [ufo deploy]({% link _reference/ufo-deploy.md %})
|
9
12
|
* [ufo destroy]({% link _reference/ufo-destroy.md %})
|
10
13
|
* [ufo docker]({% link _reference/ufo-docker.md %})
|
11
14
|
* [ufo init]({% link _reference/ufo-init.md %})
|
15
|
+
* [ufo network]({% link _reference/ufo-network.md %})
|
16
|
+
* [ufo ps]({% link _reference/ufo-ps.md %})
|
17
|
+
* [ufo releases]({% link _reference/ufo-releases.md %})
|
18
|
+
* [ufo resources]({% link _reference/ufo-resources.md %})
|
19
|
+
* [ufo rollback]({% link _reference/ufo-rollback.md %})
|
12
20
|
* [ufo scale]({% link _reference/ufo-scale.md %})
|
13
21
|
* [ufo ship]({% link _reference/ufo-ship.md %})
|
14
22
|
* [ufo ships]({% link _reference/ufo-ships.md %})
|
23
|
+
* [ufo stop]({% link _reference/ufo-stop.md %})
|
15
24
|
* [ufo task]({% link _reference/ufo-task.md %})
|
16
25
|
* [ufo tasks]({% link _reference/ufo-tasks.md %})
|
17
|
-
* [ufo
|
18
|
-
* [ufo upgrade3_3_to_3_4]({% link _reference/ufo-upgrade3_3_to_3_4.md %})
|
26
|
+
* [ufo upgrade]({% link _reference/ufo-upgrade.md %})
|
19
27
|
* [ufo version]({% link _reference/ufo-version.md %})
|
data/exe/ufo
CHANGED
data/lib/cfn/stack.yml
ADDED
@@ -0,0 +1,259 @@
|
|
1
|
+
Description: "Ufo ECS stack <%= @pretty_service_name %>"
|
2
|
+
Parameters:
|
3
|
+
# required
|
4
|
+
Vpc:
|
5
|
+
Description: Existing vpc id
|
6
|
+
Type: AWS::EC2::VPC::Id
|
7
|
+
ElbSubnets:
|
8
|
+
Description: Existing subnet ids for ELB
|
9
|
+
Type: List<AWS::EC2::Subnet::Id>
|
10
|
+
EcsSubnets:
|
11
|
+
Description: Existing subnet ids for ECS
|
12
|
+
Type: List<AWS::EC2::Subnet::Id>
|
13
|
+
EcsSecurityGroups:
|
14
|
+
Description: Existing ecs security group ids
|
15
|
+
Type: String
|
16
|
+
Default: ''
|
17
|
+
ElbSecurityGroups:
|
18
|
+
Description: Existing elb security group ids. List with commas.
|
19
|
+
Type: String
|
20
|
+
Default: ''
|
21
|
+
|
22
|
+
ElbTargetGroup:
|
23
|
+
Description: Existing target group
|
24
|
+
Type: String
|
25
|
+
Default: '' # when blank the automatically created TargetGroup is used
|
26
|
+
CreateElb:
|
27
|
+
Description: Create elb
|
28
|
+
Type: String
|
29
|
+
Default: true
|
30
|
+
EcsDesiredCount:
|
31
|
+
Description: Ecs desired count
|
32
|
+
Type: String
|
33
|
+
Default: 1
|
34
|
+
EcsTaskDefinition:
|
35
|
+
Description: Ecs task definition arn
|
36
|
+
Type: String
|
37
|
+
|
38
|
+
# Using to keep state
|
39
|
+
ElbEipIds:
|
40
|
+
Description: ELB EIP Allocation ids to use for network load balancer
|
41
|
+
Type: String
|
42
|
+
Default: ''
|
43
|
+
Conditions:
|
44
|
+
CreateElbIsTrue: !Equals [ !Ref CreateElb, true ]
|
45
|
+
ElbTargetGroupIsBlank: !Equals [ !Ref ElbTargetGroup, '' ]
|
46
|
+
CreateTargetGroupIsTrue: !And
|
47
|
+
- !Condition CreateElbIsTrue
|
48
|
+
- !Condition ElbTargetGroupIsBlank
|
49
|
+
ElbSecurityGroupsIsBlank: !Equals [ !Ref ElbSecurityGroups, '' ]
|
50
|
+
EcsSecurityGroupsIsBlank: !Equals [ !Ref EcsSecurityGroups, '' ]
|
51
|
+
EcsDesiredCountIsBlank: !Equals [ !Ref EcsDesiredCount, '' ]
|
52
|
+
Resources:
|
53
|
+
Elb:
|
54
|
+
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
|
55
|
+
Condition: CreateElbIsTrue
|
56
|
+
Properties:
|
57
|
+
<% if ENV['UFO_FORCE_ELB'] -%>
|
58
|
+
# Error: SetSubnets is not supported for load balancers of type 'network'
|
59
|
+
# Happens: When changing subnets for an ELB
|
60
|
+
# Solution: Rename the ELB to force a replacement of it
|
61
|
+
<% random = (0...3).map { (65 + rand(26)).chr }.join.downcase %>
|
62
|
+
Name: <%= "#{@pretty_service_name}-#{random}" %>
|
63
|
+
<% end -%>
|
64
|
+
Type: <%= @elb_type %>
|
65
|
+
Tags:
|
66
|
+
- Key: Name
|
67
|
+
Value: <%= @pretty_service_name %>
|
68
|
+
<% if @elb_type == "application" -%>
|
69
|
+
# Add additional extra security groups if parameters set
|
70
|
+
SecurityGroups: !Split
|
71
|
+
- ','
|
72
|
+
- !If
|
73
|
+
- ElbSecurityGroupsIsBlank
|
74
|
+
- !Ref ElbSecurityGroup
|
75
|
+
- !Join [',', [!Ref ElbSecurityGroups, !Ref ElbSecurityGroup]]
|
76
|
+
<% end -%>
|
77
|
+
<% if @elb_type == "network" && @subnet_mappings && !@subnet_mappings.empty? -%>
|
78
|
+
SubnetMappings:
|
79
|
+
<% @subnet_mappings.each do |allocation_id, subnet_id| -%>
|
80
|
+
- AllocationId: <%= allocation_id %>
|
81
|
+
SubnetId: <%= subnet_id %>
|
82
|
+
<% end -%>
|
83
|
+
<% else -%>
|
84
|
+
Subnets: !Ref ElbSubnets
|
85
|
+
<% end -%>
|
86
|
+
<%= custom_properties(:Elb) %>
|
87
|
+
|
88
|
+
TargetGroup:
|
89
|
+
Type: AWS::ElasticLoadBalancingV2::TargetGroup
|
90
|
+
Condition: CreateTargetGroupIsTrue
|
91
|
+
Properties:
|
92
|
+
VpcId: !Ref Vpc
|
93
|
+
Tags:
|
94
|
+
- Key: Name
|
95
|
+
Value: <%= @pretty_service_name %>
|
96
|
+
<% if ENV['UFO_FORCE_TARGET_GROUP'] -%>
|
97
|
+
# When adding and removing EIPs
|
98
|
+
# Error: TargetGroup cannot be associated with more than one load balancer
|
99
|
+
# Solution: https://forums.aws.amazon.com/thread.jspa?threadID=254544
|
100
|
+
Name: !Join
|
101
|
+
- '-'
|
102
|
+
- - <%= @pretty_service_name %>
|
103
|
+
- !Select [ 2, !Split [ '-', !GetAtt Elb.LoadBalancerName]]
|
104
|
+
<% end -%>
|
105
|
+
Protocol: <%= @default_target_group_protocol %>
|
106
|
+
<% if @container[:network_mode] == "awsvpc" -%>
|
107
|
+
TargetType: ip
|
108
|
+
<% end -%>
|
109
|
+
<% if @elb_type == "network" && @network_mode == "awsvpc" -%>
|
110
|
+
# target groups with network load balancers need to check the container
|
111
|
+
# port dirtectly and will be using
|
112
|
+
HealthCheckPort: <%= @container[:port] %>
|
113
|
+
<% end -%>
|
114
|
+
<%= custom_properties(:TargetGroup) %>
|
115
|
+
|
116
|
+
Listener:
|
117
|
+
Type: AWS::ElasticLoadBalancingV2::Listener
|
118
|
+
Condition: CreateElbIsTrue
|
119
|
+
Properties:
|
120
|
+
DefaultActions:
|
121
|
+
- Type: forward
|
122
|
+
TargetGroupArn:
|
123
|
+
!If [ElbTargetGroupIsBlank, !Ref TargetGroup, !Ref ElbTargetGroup]
|
124
|
+
LoadBalancerArn: !Ref Elb
|
125
|
+
Protocol: <%= @default_listener_protocol %>
|
126
|
+
<%= custom_properties(:Listener) %>
|
127
|
+
|
128
|
+
<% if @elb_type == "application" -%>
|
129
|
+
ElbSecurityGroup:
|
130
|
+
Type: AWS::EC2::SecurityGroup
|
131
|
+
Condition: CreateElbIsTrue
|
132
|
+
Properties:
|
133
|
+
GroupDescription: Allow http to client host
|
134
|
+
VpcId: !Ref Vpc
|
135
|
+
SecurityGroupIngress:
|
136
|
+
- IpProtocol: tcp
|
137
|
+
FromPort: '<%= cfn[:listener][:port] %>'
|
138
|
+
ToPort: '<%= cfn[:listener][:port] %>'
|
139
|
+
CidrIp: 0.0.0.0/0
|
140
|
+
SecurityGroupEgress:
|
141
|
+
- IpProtocol: tcp
|
142
|
+
FromPort: '0'
|
143
|
+
ToPort: '65535'
|
144
|
+
CidrIp: 0.0.0.0/0
|
145
|
+
Tags:
|
146
|
+
- Key: Name
|
147
|
+
Value: <%= @pretty_service_name %>-elb
|
148
|
+
<%= custom_properties(:ElbSecurityGroup) %>
|
149
|
+
<% end -%>
|
150
|
+
|
151
|
+
Ecs:
|
152
|
+
Type: AWS::ECS::Service
|
153
|
+
<% if @create_elb -%>
|
154
|
+
DependsOn: Listener
|
155
|
+
<% end -%>
|
156
|
+
Properties:
|
157
|
+
Cluster: <%= @cluster %>
|
158
|
+
DesiredCount: !If
|
159
|
+
- EcsDesiredCountIsBlank
|
160
|
+
- !Ref AWS::NoValue
|
161
|
+
- !Ref EcsDesiredCount
|
162
|
+
TaskDefinition: !Ref EcsTaskDefinition
|
163
|
+
<% if pretty_name? -%>
|
164
|
+
ServiceName: <%= @pretty_service_name %>
|
165
|
+
<% end -%>
|
166
|
+
<% if @container[:fargate] -%>
|
167
|
+
LaunchType: FARGATE
|
168
|
+
<% end -%>
|
169
|
+
<% if @container[:network_mode] == "awsvpc" -%>
|
170
|
+
NetworkConfiguration:
|
171
|
+
AwsvpcConfiguration:
|
172
|
+
Subnets: !Ref EcsSubnets # required
|
173
|
+
SecurityGroups: !Split
|
174
|
+
- ','
|
175
|
+
- !If
|
176
|
+
- EcsSecurityGroupsIsBlank
|
177
|
+
- !Ref EcsSecurityGroup
|
178
|
+
- !Join [',', [!Ref EcsSecurityGroups, !Ref EcsSecurityGroup]]
|
179
|
+
<% if @container[:fargate] -%>
|
180
|
+
AssignPublicIp: ENABLED # Works with fargate but doesnt seem to work with non-fargate
|
181
|
+
<% end -%>
|
182
|
+
<% end -%>
|
183
|
+
# Default to port 80 to get template to validate. For worker processes
|
184
|
+
# there is no actual port used.
|
185
|
+
LoadBalancers: !If
|
186
|
+
- CreateTargetGroupIsTrue
|
187
|
+
- - ContainerName: <%= @container[:name] %>
|
188
|
+
ContainerPort: <%= @container[:port] || 80 %>
|
189
|
+
TargetGroupArn: !Ref TargetGroup
|
190
|
+
- !If
|
191
|
+
- ElbTargetGroupIsBlank
|
192
|
+
- []
|
193
|
+
- - ContainerName: <%= @container[:name] %>
|
194
|
+
ContainerPort: <%= @container[:port] || 80 %>
|
195
|
+
TargetGroupArn: !Ref ElbTargetGroup
|
196
|
+
<%= custom_properties(:Ecs) %>
|
197
|
+
|
198
|
+
EcsSecurityGroup:
|
199
|
+
Type: AWS::EC2::SecurityGroup
|
200
|
+
Properties:
|
201
|
+
GroupDescription: Allow http to client host
|
202
|
+
VpcId: !Ref Vpc
|
203
|
+
<% if @elb_type == "network" -%>
|
204
|
+
SecurityGroupIngress:
|
205
|
+
- IpProtocol: tcp
|
206
|
+
FromPort: '<%= @container[:port] %>'
|
207
|
+
ToPort: '<%= @container[:port] %>'
|
208
|
+
CidrIp: 0.0.0.0/0
|
209
|
+
Description: docker ephemeral port range for network elb
|
210
|
+
<% end -%>
|
211
|
+
# Outbound access: instance needs access to internet to pull down image
|
212
|
+
# or else get CannotPullContainerError
|
213
|
+
SecurityGroupEgress:
|
214
|
+
- IpProtocol: tcp
|
215
|
+
FromPort: '0'
|
216
|
+
ToPort: '65535'
|
217
|
+
CidrIp: 0.0.0.0/0
|
218
|
+
Description: outbound traffic
|
219
|
+
Tags:
|
220
|
+
- Key: Name
|
221
|
+
Value: <%= @pretty_service_name %>
|
222
|
+
<%= custom_properties(:EcsSecurityGroup) %>
|
223
|
+
|
224
|
+
<% if @elb_type == "application" -%>
|
225
|
+
# Allow all traffic from ELB SG to ECS SG
|
226
|
+
EcsSecurityGroupRule:
|
227
|
+
Type: AWS::EC2::SecurityGroupIngress
|
228
|
+
Condition: CreateElbIsTrue
|
229
|
+
Properties:
|
230
|
+
IpProtocol: tcp
|
231
|
+
FromPort: '0'
|
232
|
+
ToPort: '65535'
|
233
|
+
SourceSecurityGroupId: !GetAtt ElbSecurityGroup.GroupId
|
234
|
+
GroupId: !GetAtt EcsSecurityGroup.GroupId
|
235
|
+
Description: application elb access to ecs
|
236
|
+
<%= custom_properties(:EcsSecurityGroupRule) %>
|
237
|
+
<% end -%>
|
238
|
+
<% if @create_route53 -%>
|
239
|
+
Dns:
|
240
|
+
Type: AWS::Route53::RecordSet
|
241
|
+
Properties:
|
242
|
+
Comment: cname to load balancer
|
243
|
+
Type: CNAME
|
244
|
+
TTL: '60' # ttl has special casing
|
245
|
+
ResourceRecords:
|
246
|
+
- !GetAtt Elb.DNSName
|
247
|
+
<%= custom_properties(:Dns) %>
|
248
|
+
<% end -%>
|
249
|
+
|
250
|
+
Outputs:
|
251
|
+
ElbDns:
|
252
|
+
Description: Elb Dns
|
253
|
+
Condition: CreateElbIsTrue
|
254
|
+
Value: !GetAtt Elb.DNSName
|
255
|
+
<% if @create_route53 -%>
|
256
|
+
Route53Dns:
|
257
|
+
Description: Route53 Dns
|
258
|
+
Value: !Ref Dns
|
259
|
+
<% end -%>
|