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/_docs/migrations.md
CHANGED
@@ -5,13 +5,13 @@ title: Database Migrations
|
|
5
5
|
A common task is to run database migrations with newer code before deploying the code. This is easily achieved with the `ufo task` command. Here's an example:
|
6
6
|
|
7
7
|
```sh
|
8
|
-
ufo task
|
8
|
+
ufo task demo-web -c bundle exec rake db:migrate
|
9
9
|
```
|
10
10
|
|
11
11
|
It is nice to wrap the commands in a wrapper script in case you have to do things like to load the environment.
|
12
12
|
|
13
13
|
```sh
|
14
|
-
ufo task
|
14
|
+
ufo task demo-web -c bin/migrate
|
15
15
|
```
|
16
16
|
|
17
17
|
The `bin/migrate` script can look like this:
|
data/docs/_docs/next-steps.md
CHANGED
@@ -12,7 +12,7 @@ From here, there are a few resources that can help you continue along:
|
|
12
12
|
|
13
13
|
Everyone can contribute to make ufo better, including the documentation. These docs are of the same ufo repo in the [docs folder](https://github.com/tongueroo/ufo/tree/master/docs). Please fork the project and open a pull request! We love your pull requests. Contributions are encouraged and welcomed!
|
14
14
|
|
15
|
-
<a id="prev" class="btn btn-basic" href="{% link
|
16
|
-
<a id="next" class="btn btn-primary" href="{% link
|
15
|
+
<a id="prev" class="btn btn-basic" href="{% link articles.md %}">Back</a>
|
16
|
+
<a id="next" class="btn btn-primary" href="{% link reference.md %}">Next Step</a>
|
17
17
|
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
18
18
|
|
data/docs/_docs/params.md
CHANGED
@@ -7,61 +7,32 @@ Additionally, the params that ufo sends to the [ruby aws-sdk](https://docs.aws.a
|
|
7
7
|
A starter project `.ufo/params.yml` file is generated as part of the `ufo init` command. Let's take a look at an example `params.yml`:
|
8
8
|
|
9
9
|
```yaml
|
10
|
-
<%
|
11
|
-
# replace with actual values:
|
12
|
-
@subnets = ["subnet-111","subnet-222"]
|
13
|
-
@security_groups = ["sg-111"]
|
14
|
-
%>
|
15
10
|
# These params are passsed to the corresponding aws-sdk ecs client methods.
|
16
11
|
# AWS Docs example: https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/ECS/Client.html#run_task-instance_method
|
17
12
|
#
|
18
|
-
#
|
19
|
-
# Uncomment launch_type and network_configuration sections to enable fargate.
|
13
|
+
# The network helper provides access to the .ufo/settings/network/[PROFILE].yml
|
20
14
|
#
|
21
|
-
|
22
|
-
# ufo ship calls create_service when service doesnt exist
|
23
|
-
create_service:
|
24
|
-
deployment_configuration:
|
25
|
-
maximum_percent: 200
|
26
|
-
minimum_healthy_percent: 100
|
27
|
-
desired_count: 1
|
28
|
-
# launch_type: "FARGATE"
|
29
|
-
# network_configuration:
|
30
|
-
# awsvpc_configuration:
|
31
|
-
# subnets: <%= @subnets.inspect %> # required
|
32
|
-
# security_groups: <%= @security_groups.inspect %>
|
33
|
-
# assign_public_ip: "ENABLED" # accepts ENABLED, DISABLED
|
34
|
-
|
35
|
-
|
36
|
-
# ufo ship calls update_service when service already exists
|
37
|
-
# update service is provide as an example below. Though it is probably better
|
38
|
-
# to not add any options to update_service if you are using the ECS console
|
39
|
-
# to update these settings often.
|
40
|
-
update_service:
|
15
|
+
# More docs: http://ufoships.com/docs/params/
|
41
16
|
|
42
17
|
# ufo task calls run_tasks
|
43
18
|
run_task:
|
44
|
-
#
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
19
|
+
# network_configuration is required for FARGATE
|
20
|
+
network_configuration:
|
21
|
+
awsvpc_configuration:
|
22
|
+
subnets: <%= network[:ecs_subnets].inspect %> # required
|
23
|
+
security_groups: <%= network[:ecs_security_groups].inspect %>
|
24
|
+
assign_public_ip: "ENABLED" # accepts ENABLED, DISABLED
|
50
25
|
```
|
51
26
|
|
52
27
|
Ufo provides 1st class citizen access to adjust the params sent to the aws-sdk calls:
|
53
28
|
|
54
|
-
|
55
|
-
* update_service - `ufo ship` calls this when the ECS service already exists.
|
56
|
-
* run_task - `ufo task` calls this.
|
57
|
-
|
58
|
-
The parameters from this `params.yml` file get merged with params ufo generates internally. Here's an example of where the merging happens in the source code for the run task command [task.rb](https://github.com/tongueroo/ufo/blob/90f12df035843528770122deb328d150249a25e2/lib/ufo/task.rb#L20). Also, here's the starter [params.yml source code](https://github.com/tongueroo/ufo/blob/master/lib/template/.ufo/params.yml) for reference.
|
29
|
+
The parameters from this `params.yml` file get merged with params ufo generates internally. Here's an example of where the merging happens in the source code for the run task command [task.rb](https://github.com/tongueroo/ufo/blob/master/lib/ufo/task.rb). Also, here's the starter [params.yml source code](https://github.com/tongueroo/ufo/blob/master/lib/template/.ufo/params.yml.tt) for reference.
|
59
30
|
|
60
|
-
ERB and [shared variables]({% link _docs/variables.md %}) are available in the params file.
|
31
|
+
ERB and [shared variables]({% link _docs/variables.md %}) are available in the params file. You can also define the subnets in your config/variables and use them in them in the params.yml file.
|
61
32
|
|
62
33
|
NOTE: The params.yml file does not have access to the `task_definition_name` helper method. That is only available in the `task_definitions.rb` template_definition code blocks.
|
63
34
|
|
64
|
-
<a id="prev" class="btn btn-basic" href="{% link _docs/settings.md %}">Back</a>
|
65
|
-
<a id="next" class="btn btn-primary" href="{% link _docs/
|
35
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/settings-cfn.md %}">Back</a>
|
36
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/variables.md %}">Next Step</a>
|
66
37
|
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
67
38
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
title: Route53 Support
|
3
|
+
---
|
4
|
+
|
5
|
+
Ufo can create a "pretty" route53 record and set it's value to the created ELB DNS name. This is done by configuring the `.ufo/settings/cfn/default.yml` file. Example:
|
6
|
+
|
7
|
+
```yaml
|
8
|
+
dns:
|
9
|
+
name: "{stack_name}.mydomain.com."
|
10
|
+
hosted_zone_name: mydomain.com. # dont forget the trailing period
|
11
|
+
```
|
12
|
+
|
13
|
+
The `{stack_name}` variable gets substituted with the CloudFormation stack name launched by ufo. So for example:
|
14
|
+
|
15
|
+
ufo ship demo-web
|
16
|
+
|
17
|
+
Results in:
|
18
|
+
|
19
|
+
"{stack_name}.mydomain.com." => "development-demo-web.mydomain.com."
|
20
|
+
|
21
|
+
**IMPORTANT**: The route53 host zone must already exist. You can create route53 hosted zone with the cli like so:
|
22
|
+
|
23
|
+
aws route53 create-hosted-zone --name mydomain.com --caller-reference $(date +%s)
|
24
|
+
aws route53 list-hosted-zones
|
25
|
+
|
26
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/ssl-support.md %}">Back</a>
|
27
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/faq.md %}">Next Step</a>
|
28
|
+
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
data/docs/_docs/run-in-pieces.md
CHANGED
@@ -27,11 +27,11 @@ ufo tasks register # registers all genreated task definitions .ufo/output to ECS
|
|
27
27
|
Update the service with the task definitions in `.ufo/output` untouched.
|
28
28
|
|
29
29
|
```bash
|
30
|
-
ufo deploy
|
30
|
+
ufo deploy demo-web
|
31
31
|
```
|
32
32
|
|
33
33
|
Note if you use the `ufo deploy` you should ensure that you have already pushed the docker image to your docker registry. Or else the task will not be able to spin up because the docker image does not exist. This is one of the reasons it is recommended that you use `ufo ship`.
|
34
34
|
|
35
|
-
<a id="prev" class="btn btn-basic" href="{% link _docs/
|
35
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/upgrade4.md %}">Back</a>
|
36
36
|
<a id="next" class="btn btn-primary" href="{% link _docs/single-task.md %}">Next Step</a>
|
37
37
|
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
title: Security Groups
|
3
|
+
---
|
4
|
+
|
5
|
+
Ufo creates and manages two security groups. One for the ELB and one for the ECS tasks.
|
6
|
+
|
7
|
+
Some consideration for these security groups:
|
8
|
+
|
9
|
+
* Network load balancers do not support security groups. So an ELB security group is only created if the load balancer is an Application load balancer.
|
10
|
+
* The ECS security group for tasks currently always gets created, but is only used if network_mode is awsvpc. This is because in bridge network mode the EC2 container instance’s Ethernet card and its security group is used. The EC2 containers group security group is outside the control of ufo. You’ll need to configure the security group appropriately yourself. Ufo will only assign the ECS security group when awsvpc node mode is used and ufo has control of the security group.
|
11
|
+
|
12
|
+
## EC2 Instance Security Group Help
|
13
|
+
|
14
|
+
If you are seeing that the Targets in the ELB Target Group are reporting unhealthy, it is usually a security group issue. You might see this out with `ufo ps`:
|
15
|
+
|
16
|
+
$ ufo ps --no-summary
|
17
|
+
+----------+------+--------------+----------------+---------+-------------------------+
|
18
|
+
| Id | Name | Release | Started | Status | Notes |
|
19
|
+
+----------+------+--------------+----------------+---------+-------------------------+
|
20
|
+
| 070a9c0a | web | demo-web:169 | 6 minutes ago | STOPPED | Failed ELB health check |
|
21
|
+
| d02728ba | web | demo-web:169 | 3 minutes ago | STOPPED | Failed ELB health check |
|
22
|
+
| 8dcf81ae | web | demo-web:169 | 13 seconds ago | RUNNING | |
|
23
|
+
+----------+------+--------------+----------------+---------+-------------------------+
|
24
|
+
There are targets the target group reporting unhealthy. This can cause containers to cycle. Here's the error:
|
25
|
+
(service development-demo-web-Ecs-13D2BFA4ULNC9) (instance i-0812a3bcd94babf12) (port 32779) is unhealthy in (target-group arn:aws:elasticloadbalancing:us-east-1:111111111111:targetgroup/devel-Targe-1MJR8V6VOWBGI/3f44f85710fe0297) due to (reason Request timed out)
|
26
|
+
Check out the ECS console events tab for more info.
|
27
|
+
$
|
28
|
+
|
29
|
+
If you are using network mode bridge, then you'll need to need to configure the container instance's security group to allow traffic to the Docker ephemeral port range. For details on the Docker ephemeral port range on AWS, you search for "ephemeral" on the [ECS Port Mapping Docs](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_PortMapping.html).
|
30
|
+
|
31
|
+
In general, ports below 32768 are outside of the ephemeral port range. So an easy way to configure the container instance's security group is to whitelist ports 32768 to 65535 to your VPC's CIDR block. An example of a CIDR block range could be `10.0.0.0/16`. The CIDR block is being suggested because the Application load balancer and security group created by ufo can change if you change the load balancer settings.
|
32
|
+
|
33
|
+
If you are using a network load balancer and are running bridge network mode, then you need to whitelist ports 32768 to 65535 to `0.0.0.0/0`. This is because network load balancers operate at layer 4 of the OSI model and cannot be assigned security groups, so they use the security group of the instance. If you feel this is too loose of permissions, you can use awsvpc mode. There are some considerations for awsvpc mode though which is discussed next.
|
34
|
+
|
35
|
+
## Pros and Cons: awsvpc vs bridge network mode
|
36
|
+
|
37
|
+
With network bridge mode, the Docker containers of multiple services share the EC2 container instance's security group. So you have less granular control over opening ports for specific services only. For example, let’s say service A and B both are configured use bridge network mode. If you open up port 3000 for service A, it will also open up port 3000 for service B because they use the same security group at the EC2 instance level.
|
38
|
+
|
39
|
+
One advantage of bridge mode is you can use dynamic port mapping and do not have to worry about network card limits.
|
40
|
+
|
41
|
+
With awsvpc network mode, you must consider the limit of ethernet cards for the instance type. The table that lists the limits are under section the aws EC2 docs under [IP Addresses Per Network Interface Per Instance Type](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html) For example, a t2 large instance has a limit of 3 Ethernet cards. This means, at most, you can run 3 ECS tasks on that instance in awsvpc network mode.
|
42
|
+
|
43
|
+
The advantage of awsvpc mode is that since the ECS task has its own network card and security group, there’s more granular control of the permissions per ECS service. For example, when service A and B are using awsvpc mode, they can have different security groups associated with them. In this mode, ufo creates a security group and sets up the permissions so the load balancer can talk to the containers. You can also add additional security group to the `.ufo/settings/network/default.yml` config.
|
44
|
+
|
45
|
+
The following table summarizes the pros and cons:
|
46
|
+
|
47
|
+
Network mode | Pros | Cons
|
48
|
+
--- | ---
|
49
|
+
bridge | The numbers of containers you can run will not be limited due to EC2 instance network cards limits. | Less fine grain security control over security group permissions with multiple ECS services.
|
50
|
+
awsvpc | Fine grain security group permissions for each ECS service. | The number of containers can be limited by the number of network cards the EC2 instance type supports.
|
51
|
+
|
52
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/load-balancer.md %}">Back</a>
|
53
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/ssl-support.md %}">Next Step</a>
|
54
|
+
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
title: Settings Cfn
|
3
|
+
---
|
4
|
+
|
5
|
+
## Customizing Resources
|
6
|
+
|
7
|
+
{% include cfn-customize.md %}
|
8
|
+
|
9
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/settings-network.md %}">Back</a>
|
10
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/params.md %}">Next Step</a>
|
11
|
+
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
title: Settings Network
|
3
|
+
---
|
4
|
+
|
5
|
+
The settings.yml file references a network settings file with the `network_profile` option. This file has configurations that are related to the network. The source code for the starter template file is at [network/default.yml.tt](https://github.com/tongueroo/ufo/blob/master/lib/template/.ufo/settings/network/default.yml.tt) Here's an example network settings file.
|
6
|
+
|
7
|
+
```
|
8
|
+
---
|
9
|
+
vpc: vpc-11111111
|
10
|
+
ecs_subnets: # at least 2 subnets required
|
11
|
+
- subnet-11111111
|
12
|
+
- subnet-22222222
|
13
|
+
elb_subnets: # defaults to same subnets as ecs_subnets when not set
|
14
|
+
- subnet-33333333
|
15
|
+
- subnet-44444444
|
16
|
+
|
17
|
+
# Optional existing security group ids to add in addition to the ones created by ufo.
|
18
|
+
# elb_security_groups:
|
19
|
+
# - sg-aaa
|
20
|
+
# ecs_security_groups:
|
21
|
+
# - sg-bbb
|
22
|
+
```
|
23
|
+
|
24
|
+
Option | Description
|
25
|
+
--- | ---
|
26
|
+
vpc | Used to create ecs and elb security groups, target group in the CloudFormation template.
|
27
|
+
ecs_subnets | Used to assign a subnet mapping to the ECS service created in CloudFormation when the network mode is awsvpc. Also used to in .ufo/params.yml as part of the run_task api call that is made by `ufo task`.
|
28
|
+
elb_subnets | Used to create elb load balancer.
|
29
|
+
ecs_security_groups | Additional security groups to associate with the ECS tasks.
|
30
|
+
elb_security_groups | Additional security groups to associate with the ELB.
|
31
|
+
|
32
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/settings.md %}">Back</a>
|
33
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/settings-cfn.md %}">Next Step</a>
|
34
|
+
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
data/docs/_docs/settings.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
title: Settings
|
3
3
|
---
|
4
4
|
|
5
|
-
The behavior of ufo can be configured with a `settings.yml` file. A starter project `.ufo/settings.yml` file is generated as part of the `ufo init` command.
|
5
|
+
The behavior of ufo can be configured with a `settings.yml` file. A starter project `.ufo/settings.yml` file is generated as part of the `ufo init` command. There are can be multiple settings files. The options from the files get merged and respected in the following precedence:
|
6
6
|
|
7
7
|
1. current folder - The current folder's `.ufo/settings.yml` values take the highest precedence.
|
8
8
|
2. user - The user's `~/.ufo/settings.yml` values take the second highest precedence.
|
@@ -12,9 +12,11 @@ Let's take a look at an example `settings.yml`:
|
|
12
12
|
|
13
13
|
```yaml
|
14
14
|
base:
|
15
|
-
image: tongueroo/
|
15
|
+
image: tongueroo/demo-ufo
|
16
16
|
# clean_keep: 30 # cleans up docker images on your docker server.
|
17
17
|
# ecr_keep: 30 # cleans up images on ECR and keeps this remaining amount. Defaults to keep all.
|
18
|
+
network_profile: default # .ufo/settings/network/default.yml file
|
19
|
+
cfn_profile: default # .ufo/settings/cfn/default.yml file
|
18
20
|
|
19
21
|
development:
|
20
22
|
# cluster: dev # uncomment if you want the cluster name be other than the default
|
@@ -37,11 +39,13 @@ The table below covers each setting:
|
|
37
39
|
|
38
40
|
Setting | Description
|
39
41
|
------------- | -------------
|
40
|
-
`
|
42
|
+
`aws_profiles` | If you have the `AWS_PROFILE` environment variable set, this will ensure that you are deploying the right `UFO_ENV` to the right AWS environment. It is explained below.
|
43
|
+
`cfn_profile` | The name of the cfn profile settings file to use. Maps to .ufo/settings/cfn/NAME.yml file
|
41
44
|
`clean_keep` | Docker images generated from ufo are cleaned up automatically for you at the end of `ufo ship`. This controls how many docker images to keep around. The default is 3.
|
42
|
-
`ecr_keep` | If you are using AWS ECR, then the ECR images can also be automatically cleaned up at the end of `ufo ship`. By default this is set to `nil` and all AWS ECR are kept.
|
43
45
|
`cluster` | By convention, the ECS cluster that ufo deploys to matches the `UFO_ENV`. If `UFO=development`, then `ufo ship` deploys to the `development` ECS cluster. This is option overrides this convention.
|
44
|
-
`
|
46
|
+
`ecr_keep` | If you are using AWS ECR, then the ECR images can also be automatically cleaned up at the end of `ufo ship`. By default this is set to `nil` and all AWS ECR are kept.
|
47
|
+
`image` | The `image` value is the name that ufo will use for the Docker image name to be built. Only provide the basename part of the image name without the tag because ufo automatically generates the tag for you. For example, `tongueroo/demo-ufo` is correct and `tongueroo/demo-ufo:my-tag` is incorrect.
|
48
|
+
`network_profile` | The name of the network profile settings file to use. Maps to .ufo/settings/network/NAME.yml file
|
45
49
|
|
46
50
|
## ECS Cluster Convention
|
47
51
|
|
@@ -50,23 +54,23 @@ Normally, the ECS cluster defaults to whatever UFO_ENV is set to by [convention]
|
|
50
54
|
By default, these are all the same:
|
51
55
|
|
52
56
|
```sh
|
53
|
-
ufo ship
|
54
|
-
UFO_ENV=development ufo ship
|
55
|
-
UFO_ENV=development ufo ship
|
57
|
+
ufo ship demo-web
|
58
|
+
UFO_ENV=development ufo ship demo-web # same
|
59
|
+
UFO_ENV=development ufo ship demo-web --cluster development # same
|
56
60
|
```
|
57
61
|
|
58
62
|
If you use a specific `UFO_ENV=production`, these are the same
|
59
63
|
|
60
64
|
```
|
61
|
-
UFO_ENV=production ufo ship
|
62
|
-
UFO_ENV=production ufo ship
|
65
|
+
UFO_ENV=production ufo ship demo-web
|
66
|
+
UFO_ENV=production ufo ship demo-web --cluster production # same
|
63
67
|
```
|
64
68
|
|
65
69
|
Override the convention by explicitly specifying the `--cluster` option in the CLI.
|
66
70
|
|
67
71
|
```sh
|
68
|
-
ufo ship
|
69
|
-
UFO_ENV=production ufo ship
|
72
|
+
ufo ship demo-web --cluster custom-cluster # override the cluster
|
73
|
+
UFO_ENV=production ufo ship demo-web --cluster production-cluster # override the cluster
|
70
74
|
```
|
71
75
|
|
72
76
|
Override the convention by setting the cluster option in the `settings.yml` file, so you won't have to specify the `--cluster` option in the command repeatedly.
|
@@ -103,9 +107,8 @@ AWS_PROFILE=dev-profile2 => UFO_ENV=development
|
|
103
107
|
AWS_PROFILE=prod-profile => UFO_ENV=production
|
104
108
|
```
|
105
109
|
|
106
|
-
This behavior prevents you from switching `AWS_PROFILE`s and then accidentally deploying a production based docker image to development and vice versa because you forgot to also switch `UFO_ENV` to its respective environment.
|
110
|
+
This behavior prevents you from switching `AWS_PROFILE`s, forgetting to switch `UFO_ENV` and then accidentally deploying a production based docker image to development and vice versa because you forgot to also switch `UFO_ENV` to its respective environment.
|
107
111
|
|
108
112
|
<a id="prev" class="btn btn-basic" href="{% link _docs/structure.md %}">Back</a>
|
109
|
-
<a id="next" class="btn btn-primary" href="{% link _docs/
|
113
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/settings-network.md %}">Next Step</a>
|
110
114
|
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
111
|
-
|
data/docs/_docs/single-task.md
CHANGED
@@ -5,15 +5,15 @@ title: Run Single Task
|
|
5
5
|
Sometimes you do not want to run a long running `service` but a one time task. Running Rails migrations are an example of a one off task. Here is an example of how you would run a one time task.
|
6
6
|
|
7
7
|
```
|
8
|
-
ufo task
|
8
|
+
ufo task demo-web -c bundle exec rake db:migrate
|
9
9
|
```
|
10
10
|
|
11
11
|
At the end of the output you should see you the task ARN:
|
12
12
|
|
13
13
|
```sh
|
14
|
-
$ ufo task
|
14
|
+
$ ufo task demo-web -c bundle exec rake db:migrate
|
15
15
|
...
|
16
|
-
Running task_definition:
|
16
|
+
Running task_definition: demo-web
|
17
17
|
Task ARN: arn:aws:ecs:us-west-2:994926937775:task/a0e4229d-3d39-4b26-9151-6ab6869b84d4
|
18
18
|
$
|
19
19
|
```
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
title: SSL Support
|
3
|
+
---
|
4
|
+
|
5
|
+
## Application Load Balancers
|
6
|
+
|
7
|
+
If you are using an Application Load Balancer you can configure SSL support by adjusting the listener in `.ufo/settings/cfn/default.yml`. Here's an example:
|
8
|
+
|
9
|
+
```
|
10
|
+
listener:
|
11
|
+
port: 443
|
12
|
+
protocol: HTTPS
|
13
|
+
certificates:
|
14
|
+
- certificate: arn:aws:acm:us-east-1:111111111111:certificate/11111111-2222-3333-4444-555555555555
|
15
|
+
```
|
16
|
+
|
17
|
+
For the certificate arn, you will need to create a certificate with AWS ACM. To do so, you can follow these instructions: [Request a Public Certificate
|
18
|
+
](https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html)
|
19
|
+
|
20
|
+
Once this is configured, you deploy the app again:
|
21
|
+
|
22
|
+
ufo ship
|
23
|
+
|
24
|
+
## Network Load Balancers
|
25
|
+
|
26
|
+
Network Load Balancers work at layer 4, so they do not support SSL termination because SSL happens higher up in the OSI model layers. With Network Load Balancers you handle SSL termination within your app with the app server you are using. For example, it could be apache, nginx or tomcat.
|
27
|
+
|
28
|
+
You also will need to also configure the target group to check the port that your app server is listening to and configure the health_check_protocol to HTTPS. Here's an example:
|
29
|
+
|
30
|
+
```
|
31
|
+
listener:
|
32
|
+
port: 443
|
33
|
+
target_group:
|
34
|
+
port: 443
|
35
|
+
health_check_protocol: HTTPS
|
36
|
+
```
|
37
|
+
|
38
|
+
The protocol in the case of the network load balancer is TCP and is configured to TCP by default by ufo for Network Load Balancers, so you don't have to configure it.
|
39
|
+
|
40
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/security-groups.md %}">Back</a>
|
41
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/route53-support.md %}">Next Step</a>
|
42
|
+
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
data/docs/_docs/structure.md
CHANGED
@@ -9,6 +9,8 @@ Ufo creates a `.ufo` folder within your project which contains the required file
|
|
9
9
|
├── output
|
10
10
|
├── params.yml
|
11
11
|
├── settings.yml
|
12
|
+
├── settings/cfn/default.yml
|
13
|
+
├── settings/network/default.yml
|
12
14
|
├── task_definitions.rb
|
13
15
|
├── templates
|
14
16
|
| └── main.json.erb
|
@@ -24,7 +26,9 @@ File / Directory | Description
|
|
24
26
|
------------- | -------------
|
25
27
|
<code>output/</code> | The folder where the generated task definitions are written to. The way the task definitions are generated is covered in [ufo tasks build]({% link _docs/tutorial-ufo-tasks-build.md %}).
|
26
28
|
<code>params</code> | This is where you can adjust the params that get send to the aws-sdk api calls. More info at [Params]({% link _docs/params.md %}).
|
27
|
-
<code>settings.yml</code> | Ufo's settings file, where you adjust the default [settings]({% link _docs/settings.md %}).
|
29
|
+
<code>settings.yml</code> | Ufo's general settings file, where you adjust the default [settings]({% link _docs/settings.md %}).
|
30
|
+
<code>settings/cfn/default.yml</code> | Ufo's cfn settings. You can customize the CloudFormation resource properties here.
|
31
|
+
<code>settings/network/default.yml</code> | Ufo's network settings. You can customize the vpc and subnets to used here.
|
28
32
|
<code>task_definitions.rb</code> | This is where you define the task definitions and specify the variables to be used by the ERB templates.
|
29
33
|
<code>templates/</code> | The ERB templates with the task definition json code. The templates are covered in more detail in [ufo tasks build]({% link _docs/tutorial-ufo-tasks-build.md %}).
|
30
34
|
<code>templates/main.json.erb</code> | This is the main and starter template task definition json file that ufo initially generates.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
title: Stuck CloudFormation
|
3
|
+
---
|
4
|
+
|
5
|
+
The CloudFormation stack update or creation can get stuck in a `*_IN_PROGRESS` state for a very long time, like more than an hour. This happens when you deploy an ECS service that fails to stabilize. Usually, this is an error with the Docker container failing to start up successfully.
|
6
|
+
There can be many reasons for this, here are some examples:
|
7
|
+
|
8
|
+
* Bug in the startup script in the Dockerfile.
|
9
|
+
* There are no container instances available to place the docker ECS task.
|
10
|
+
* You have a rails app and it is failing to connect to the database upon startup, maybe due to a security group setting.
|
11
|
+
|
12
|
+
To resolve this, you can:
|
13
|
+
|
14
|
+
1. cancel the current deploy
|
15
|
+
2. fix the underlying issue
|
16
|
+
3. deploy again
|
17
|
+
|
18
|
+
## Canceling Deployment
|
19
|
+
|
20
|
+
If an ECS deployment does not finish within 10 minutes because the ECS service is not stabilizing, it is usually due one of the reasons above. In these cases, it is safe to cancel and try again.
|
21
|
+
|
22
|
+
To cancel a current deploy, run:
|
23
|
+
|
24
|
+
ufo cancel
|
25
|
+
|
26
|
+
This is the same thing as canceling the stack update in the CloudFormation console.
|
27
|
+
|
28
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/customize-cloudformation.md %}">Back</a>
|
29
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/upgrade4.md %}">Next Step</a>
|
30
|
+
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
@@ -4,7 +4,7 @@ title: Build Docker
|
|
4
4
|
|
5
5
|
## Build the Docker Image
|
6
6
|
|
7
|
-
Let's use the `ufo docker build` command to build the docker image. The command uses the `Dockerfile` in the current project to build the docker image. You use your own Dockerfile so you have fully control over how you would like the image to be built. For this tutorial we will continue to use the [tongueroo/
|
7
|
+
Let's use the `ufo docker build` command to build the docker image. The command uses the `Dockerfile` in the current project to build the docker image. You use your own Dockerfile so you have fully control over how you would like the image to be built. For this tutorial we will continue to use the [tongueroo/demo-ufo](https://github.com/tongueroo/demo-ufo) app and it's Dockerfile. Let's run the command:
|
8
8
|
|
9
9
|
```sh
|
10
10
|
ufo docker build
|
@@ -15,38 +15,25 @@ You should see similar output (some of the output has been truncated for concise
|
|
15
15
|
```sh
|
16
16
|
$ ufo docker build
|
17
17
|
Building docker image with:
|
18
|
-
docker build -t tongueroo/
|
19
|
-
Sending build context to Docker daemon
|
20
|
-
Step 1 : FROM ruby:2.
|
21
|
-
--->
|
22
|
-
Step 2 :
|
18
|
+
docker build -t tongueroo/demo-ufo:ufo-2018-06-28T16-33-57-7e0af94 -f Dockerfile .
|
19
|
+
Sending build context to Docker daemon 128kB
|
20
|
+
Step 1/10 : FROM ruby:2.5.1
|
21
|
+
---> 857bc7ff918f
|
22
|
+
Step 2/10 : WORKDIR /app
|
23
23
|
---> Using cache
|
24
|
-
--->
|
24
|
+
---> 4e93fbb496c9
|
25
25
|
...
|
26
|
-
Step
|
27
|
-
--->
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
Using web-console 2.3.0
|
35
|
-
Bundle complete! 12 Gemfile dependencies, 56 gems now installed.
|
36
|
-
Bundled gems are installed into /usr/local/bundle.
|
37
|
-
---> 194830c5c1a8
|
38
|
-
...
|
39
|
-
Removing intermediate container 67545cd4cd09
|
40
|
-
Step 11 : CMD bin/web
|
41
|
-
---> Running in b1b26e68d957
|
42
|
-
---> 8547bb48b21f
|
43
|
-
Removing intermediate container b1b26e68d957
|
44
|
-
Successfully built 8547bb48b21f
|
45
|
-
Docker image tongueroo/hi:ufo-2017-06-11T22-18-03-a18aa30 built. Took 33s.
|
46
|
-
$
|
26
|
+
Step 10/10 : CMD bin/web
|
27
|
+
---> Running in cd63ebaec8aa
|
28
|
+
---> 14852737c639
|
29
|
+
Removing intermediate container cd63ebaec8aa
|
30
|
+
Successfully built 14852737c639
|
31
|
+
Successfully tagged tongueroo/demo-ufo:ufo-2018-06-28T16-33-57-7e0af94
|
32
|
+
Docker image tongueroo/demo-ufo:ufo-2018-06-28T16-33-57-7e0af94 built.
|
33
|
+
Docker build took 2s.
|
47
34
|
```
|
48
35
|
|
49
|
-
As you can see `ufo docker build`
|
36
|
+
As you can see `ufo docker build` shells out and calls `docker build -t tongueroo/demo-ufo:ufo-2017-06-11T22-18-03-a18aa30 -f Dockerfile .`. The docker image tag that is generated contains a useful timestamp and the current HEAD git sha of the project that you are on.
|
50
37
|
|
51
38
|
By default when you are running `ufo docker build` directly it does not push the docker image to the registry. If you would like it to push the built image to a registry at the end of the build use the `--push` flag.
|
52
39
|
|
@@ -63,11 +50,12 @@ ufo docker push
|
|
63
50
|
You should see the image being pushed with a message that looks something like this:
|
64
51
|
|
65
52
|
```sh
|
66
|
-
Pushed tongueroo/
|
53
|
+
Pushed tongueroo/demo-ufo:ufo-2018-06-28T16-33-57-7e0af94 docker image.
|
54
|
+
Docker push took 12s.
|
67
55
|
```
|
68
56
|
|
69
57
|
|
70
|
-
Note in order to push the image to a registry you will need to login into the registry. If you are using DockerHub use the `docker login` command. If you are using AWS ECR then
|
58
|
+
Note in order to push the image to a registry you will need to login into the registry. If you are using DockerHub use the `docker login` command. If you are using AWS ECR then ufo automatically calls the `aws ecr get-login` command and authenticates for you.
|
71
59
|
|
72
60
|
<a id="prev" class="btn btn-basic" href="{% link _docs/tutorial-ufo-init.md %}">Back</a>
|
73
61
|
<a id="next" class="btn btn-primary" href="{% link _docs/tutorial-ufo-tasks-build.md %}">Next Step</a>
|