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
@@ -0,0 +1,13 @@
|
|
1
|
+
## Examples
|
2
|
+
|
3
|
+
ufo network init # will use default vpc and subnets
|
4
|
+
ufo network init --vpc-id vpc-123
|
5
|
+
ufo network init --vpc-id vpc-123 --subnets subnet-aaa subnet-bbb
|
6
|
+
|
7
|
+
If the `--vpc-id` option is set and the `--subnets` is not, then ufo generates files with all the associated subnets from the specified vpc id.
|
8
|
+
|
9
|
+
You can also specify name of the settings file to create with the `--filename` option. Example.
|
10
|
+
|
11
|
+
ufo network init --vpc-id vpc-123 --filename dev
|
12
|
+
|
13
|
+
The above command creates a `.ufo/settings/network/dev.yml` file. You might want to then update your `.ufo/settings.yml` file and update the `network_profile` config to reference it.
|
data/lib/ufo/help/ps.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
## Examples
|
2
|
+
|
3
|
+
$ ufo ps
|
4
|
+
=> Service: demo-web
|
5
|
+
Service name: development-demo-web-Ecs-7GAUAXH5F56M
|
6
|
+
Status: ACTIVE
|
7
|
+
Running count: 2
|
8
|
+
Desired count: 2
|
9
|
+
Launch type: FARGATE
|
10
|
+
Task definition: demo-web:85
|
11
|
+
Elb: develop-Elb-1M74CLRS2G0Z4-686742146.us-east-1.elb.amazonaws.com
|
12
|
+
+----------+------+-------------+----------------+---------+-------+
|
13
|
+
| Id | Name | Release | Started | Status | Notes |
|
14
|
+
+----------+------+-------------+----------------+---------+-------+
|
15
|
+
| f590ee5e | web | demo-web:85 | 47 minutes ago | RUNNING | |
|
16
|
+
| fb60ba9f | web | demo-web:85 | 45 minutes ago | RUNNING | |
|
17
|
+
+----------+------+-------------+----------------+---------+-------+
|
18
|
+
|
19
|
+
Skip the summary info:
|
20
|
+
|
21
|
+
$ ufo ps --no-summary
|
22
|
+
+----------+------+-------------+----------------+---------+-------+
|
23
|
+
| Id | Name | Release | Started | Status | Notes |
|
24
|
+
+----------+------+-------------+----------------+---------+-------+
|
25
|
+
| f590ee5e | web | demo-web:85 | 48 minutes ago | RUNNING | |
|
26
|
+
| fb60ba9f | web | demo-web:85 | 45 minutes ago | RUNNING | |
|
27
|
+
+----------+------+-------------+----------------+---------+-------+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Displays information about the service.
|
2
|
+
|
3
|
+
## Examples
|
4
|
+
|
5
|
+
$ ufo resources demo-web
|
6
|
+
Resources:
|
7
|
+
Ecs - AWS::ECS::Service:
|
8
|
+
arn:aws:ecs:us-east-1:111111111111:service/dev-demo-web-Ecs-KN8OVQ7L2N40
|
9
|
+
EcsSecurityGroupRule - AWS::EC2::SecurityGroupIngress:
|
10
|
+
EcsSecurityGroupRule
|
11
|
+
EcsSecurityGroup - AWS::EC2::SecurityGroup:
|
12
|
+
sg-63c17228
|
13
|
+
Elb - AWS::ElasticLoadBalancingV2::LoadBalancer:
|
14
|
+
arn:aws:elasticloadbalancing:us-east-1:111111111111:loadbalancer/app/dev-hi-Elb-1KEVRDILLSUC9/0b9434b7a9a66fb7
|
15
|
+
ElbSecurityGroup - AWS::EC2::SecurityGroup:
|
16
|
+
sg-11b1025a
|
17
|
+
Listener - AWS::ElasticLoadBalancingV2::Listener:
|
18
|
+
arn:aws:elasticloadbalancing:us-east-1:111111111111:listener/app/dev-hi-Elb-1KEVRDILLSUC9/0b9434b7a9a66fb7/1996f1f252d7ba2e
|
19
|
+
TargetGroup - AWS::ElasticLoadBalancingV2::TargetGroup:
|
20
|
+
arn:aws:elasticloadbalancing:us-east-1:111111111111:targetgroup/dev-h-Targe-1VUFA8577XWT7/7e67276c182fdc87
|
@@ -0,0 +1,35 @@
|
|
1
|
+
## Examples
|
2
|
+
|
3
|
+
You only need to specific the task definition version number, though you can specify the name also
|
4
|
+
|
5
|
+
ufo rollback demo-web 1
|
6
|
+
ufo rollback demo-web demo-web:1
|
7
|
+
|
8
|
+
To see recent task definitions:
|
9
|
+
|
10
|
+
ufo releases
|
11
|
+
|
12
|
+
If you set a current service with `ufo current`, then the commands get shorten:
|
13
|
+
|
14
|
+
ufo rollback demo-web:1
|
15
|
+
ufo rollback 1
|
16
|
+
|
17
|
+
Note, task definitions get created by many ways with more than just `ufo ship`. So it the previous version might not be the latest version number minus one.
|
18
|
+
|
19
|
+
## Using image name
|
20
|
+
|
21
|
+
Another way to specify the version for rollback is with the container definition's image value. Here's the portion of the ecs task definition that you would look for:
|
22
|
+
|
23
|
+
...
|
24
|
+
"container_definitions": [
|
25
|
+
{
|
26
|
+
"name": "web",
|
27
|
+
"image": "tongueroo/demo-ufo:ufo-2018-06-21T15-03-52-ac60240",
|
28
|
+
"cpu": 256,
|
29
|
+
...
|
30
|
+
|
31
|
+
You only need to specify enough for a match to be found. Ufo searches the 30 most recent task definitions. So all of these would work:
|
32
|
+
|
33
|
+
ufo rollback tongueroo/demo-ufo:ufo-2018-06-21T15-03-52-ac60240
|
34
|
+
ufo rollback 2018-06-21T15-03-52
|
35
|
+
ufo rollback ac60240
|
data/lib/ufo/help/scale.md
CHANGED
@@ -1,6 +1,26 @@
|
|
1
1
|
Ufo provides a command to scale up and down an ECS service quickly. It is a simple wrapper for `aws ecs update-service --service xxx ----desired-count xxx`. Here's an example of how you use it:
|
2
2
|
|
3
|
-
$ ufo scale
|
4
|
-
Scale
|
3
|
+
$ ufo scale 3
|
4
|
+
Scale demo-web service in development cluster to 3
|
5
|
+
|
6
|
+
It is useful to use `ufo ps` to check the status.
|
7
|
+
|
8
|
+
$ ufo ps
|
9
|
+
=> Service: demo-web
|
10
|
+
Service name: development-demo-web-Ecs-7GAUAXH5F56M
|
11
|
+
Status: ACTIVE
|
12
|
+
Running count: 2
|
13
|
+
Desired count: 3
|
14
|
+
Launch type: FARGATE
|
15
|
+
Task definition: demo-web:85
|
16
|
+
Elb: develop-Elb-1M74CLRS2G0Z4-686742146.us-east-1.elb.amazonaws.com
|
17
|
+
+----------+------+-------------+----------------+--------------+-------+
|
18
|
+
| Id | Name | Release | Started | Status | Notes |
|
19
|
+
+----------+------+-------------+----------------+--------------+-------+
|
20
|
+
| 8f95ef9d | web | demo-web:85 | PENDING | PROVISIONING | |
|
21
|
+
| f590ee5e | web | demo-web:85 | 50 minutes ago | RUNNING | |
|
22
|
+
| fb60ba9f | web | demo-web:85 | 48 minutes ago | RUNNING | |
|
23
|
+
+----------+------+-------------+----------------+--------------+-------+
|
24
|
+
$
|
5
25
|
|
6
26
|
While scaling via this method is quick and convenient the [ECS Service AutoScaling](http://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-auto-scaling.html) that is built into ECS is a much more powerful way to manage scaling your ECS service.
|
data/lib/ufo/help/ship.md
CHANGED
@@ -6,15 +6,15 @@ The main command you use when using ufo is: `ufo ship`. This command:
|
|
6
6
|
|
7
7
|
Basic usage is:
|
8
8
|
|
9
|
-
ufo ship
|
9
|
+
ufo ship demo-web
|
10
10
|
|
11
11
|
The ECS service gets created if the service does not yet exist on the cluster.
|
12
12
|
|
13
13
|
### Conventions
|
14
14
|
|
15
|
-
By convention the task and service names match. If you need override to this convention then you can specific the task. For example if you want to ship to the `
|
15
|
+
By convention the task and service names match. If you need override to this convention then you can specific the task. For example if you want to ship to the `demo-web-1` service and use the `demo-web` task, run:
|
16
16
|
|
17
|
-
ufo ship
|
17
|
+
ufo ship demo-web-1 --task demo-web
|
18
18
|
|
19
19
|
## Options in Detail
|
20
20
|
|
@@ -24,15 +24,31 @@ The command has a decent amount of options, you can see the options available wi
|
|
24
24
|
|
25
25
|
As you can see there are plenty of options for `ufo ship`. Let's demonstrate usage of them in a few examples.
|
26
26
|
|
27
|
-
### Load Balancer
|
27
|
+
### Load Balancer
|
28
28
|
|
29
|
-
|
29
|
+
ECS services can be associated with a Load Balancer upon creation. Ufo can automatically create a load balancer. The options:
|
30
30
|
|
31
|
-
|
31
|
+
1. Automatically create the ELB.
|
32
|
+
2. Provide a target group from an existing ELB.
|
33
|
+
3. No ELB is created.
|
32
34
|
|
33
|
-
|
35
|
+
Here are examples for each of them:
|
34
36
|
|
35
|
-
ufo ship
|
37
|
+
ufo ship demo-web --elb=true
|
38
|
+
|
39
|
+
# Use existing target group from pre-created ELB:
|
40
|
+
ufo ship demo-web --elb=arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/target-name/2378947392743
|
41
|
+
|
42
|
+
# Disable creating elb and prompt:
|
43
|
+
ufo ship demo-web --elb=false
|
44
|
+
|
45
|
+
Note, if the docker container's name is web then the `--elb` flag defaults to true automatically.
|
46
|
+
|
47
|
+
If you need to create a network load balancer with pre-allocated EIPs, you can use `--elb-eip-ids`, example:
|
48
|
+
|
49
|
+
ufo deploy demo-web --elb-eip-ids eipalloc-a8de9ca1 eipalloc-a8de9ca2
|
50
|
+
|
51
|
+
More info available at the [load balancer docs](http://ufoships.com/docs/load-balancer/).
|
36
52
|
|
37
53
|
### Deploying Task Definition without Docker Build
|
38
54
|
|
@@ -42,27 +58,37 @@ Let's you want skip the docker build phase and only want use ufo to deploy a tas
|
|
42
58
|
|
43
59
|
By default when ufo updates the ECS service with the new task definition it does so asynchronuously. You then normally visit the ECS service console and then refresh until you see that the deployment is completed. You can also have ufo poll and wait for the deployment to be done with the `--wait` option
|
44
60
|
|
45
|
-
ufo ship
|
61
|
+
ufo ship demo-web --wait
|
46
62
|
|
47
63
|
You should see output similar to this:
|
48
64
|
|
49
|
-
Shipping
|
50
|
-
|
51
|
-
Waiting for deployment of task definition
|
65
|
+
Shipping demo-web...
|
66
|
+
demo-web service updated on cluster with task demo-web
|
67
|
+
Waiting for deployment of task definition demo-web:8 to complete
|
52
68
|
......
|
53
69
|
Time waiting for ECS deployment: 31s.
|
54
70
|
Software shipped!
|
55
71
|
|
72
|
+
### Route 53 DNS Support
|
73
|
+
|
74
|
+
Ufo can automatically create a "pretty" route53 record an set it to the created ELB dns name. This is done in by configuring the `.ufo/settings/network/[profile].yml` file. Example:
|
75
|
+
|
76
|
+
dns:
|
77
|
+
name: "{stack_name}.mydomain.com."
|
78
|
+
hosted_zone_name: mydomain.com. # dont forget the trailing period
|
79
|
+
|
80
|
+
Refer to [Route53 Support](http://ufoships.com/docs/route53-support/) for more info.
|
81
|
+
|
56
82
|
### Cleaning up Docker Images Automatically
|
57
83
|
|
58
84
|
Since ufo builds the Docker image every time there's a deployment you will end up with a long list of docker images. Ufo automatically cleans up older docker images at the end of the deploy process if you are using AWS ECR. By default ufo keeps the most recent 30 Docker images. This can be adjust with the `--ecr-keep` option.
|
59
85
|
|
60
|
-
docker ship
|
86
|
+
docker ship demo-web --ecr-keep 2
|
61
87
|
|
62
88
|
You should see something like this:
|
63
89
|
|
64
90
|
Cleaning up docker images...
|
65
|
-
Running: docker rmi tongueroo/
|
91
|
+
Running: docker rmi tongueroo/demo-ufo:ufo-2017-06-12T06-46-12-a18aa30
|
66
92
|
|
67
93
|
If you are using DockerHub or another registry, ufo does not automatically clean up images.
|
68
94
|
|
data/lib/ufo/help/ships.md
CHANGED
@@ -6,7 +6,7 @@ The `ufo ships` command allows you to deploy the *same* Docker image and task de
|
|
6
6
|
|
7
7
|
Instead of using the [ufo ship]({% link _reference/ufo-ship.md %}) and build and deploying the code 3 times you can instead use `ufo ships`. This will result in the *same* Docker image and *same* task definition being deployed to all 3 services. Example usage:
|
8
8
|
|
9
|
-
ufo ships
|
9
|
+
ufo ships demo-web demo-worker demo-clock
|
10
10
|
|
11
11
|
## Shell expansion
|
12
12
|
|
@@ -17,14 +17,14 @@ Since the ECS service names are provided as a list you can shorten the command b
|
|
17
17
|
If you're new to shell expansion, run this to understand why above works just as well:
|
18
18
|
|
19
19
|
$ echo hi-{web,worker,clock}
|
20
|
-
|
20
|
+
demo-web demo-worker demo-clock
|
21
21
|
|
22
22
|
## Overriding convention
|
23
23
|
|
24
24
|
As explained in detail in [Conventions]({% link _docs/conventions.md %}) the task definition and service name are the same by convention. This convention also applies for each of the services being shipped in the list. The task definition and service names match for each of the services in the list. If you would like to override the convention as part of the ships command then you use a special syntax. In the special syntax the service and task definition is separated by a colon. Examples:
|
25
25
|
|
26
|
-
ufo ships
|
27
|
-
ufo ships
|
26
|
+
ufo ships demo-web-1:demo-web demo-clock-1 demo-worker-1
|
27
|
+
ufo ships demo-web-1:my-task demo-clock-1:another-task demo-worker-1:third-task
|
28
28
|
|
29
29
|
## ufo ships Options
|
30
30
|
|
@@ -33,12 +33,3 @@ The `ufo ships`, `ufo ship`, `ufo deploy` command support the same options. The
|
|
33
33
|
{% include ufo-ship-options.md %}
|
34
34
|
|
35
35
|
Note: The `--task` option is not used with the `ufo ships` command.
|
36
|
-
|
37
|
-
## ELB Target Group
|
38
|
-
|
39
|
-
For each service being deployed to, ufo will create the ECS service if the service does not yet exist on the cluster. The deploy process will prompt you for the ELB `--target-group` if you are deploying to a 'web' service that does not yet exist. Ufo determines that it is a web service by the name of the service. If the service has 'web' in the name then it is considered a web service. If it is not a web service then the `--target-group` option gets ignored.
|
40
|
-
|
41
|
-
The prommt can be bypassed by specifying a valid `--target-group` option or specifying the `---no-target-group-prompt` option. ## Examples
|
42
|
-
|
43
|
-
ufo ships hi-web hi-clock hi-worker --target-group arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/hi-web/jsdlfjsdkd
|
44
|
-
ufo ships hi-web hi-clock hi-worker --no-target-group-prompt
|
@@ -0,0 +1,7 @@
|
|
1
|
+
ECS deployments can sometimes take a while. One reason could be because the old ECS tasks can take some time to drain and removed. The recommended way to speed this draining process up is configuring the `deregistration_delay.timeout_seconds` to a low value. You can configured this in `.ufo/settings/cfn/default.yml`. For more info refer to http://localhost:4000/docs/settings-cfn/ This setting works well for Application Load Balancers.
|
2
|
+
|
3
|
+
However, for Network Load Balancers, it seems like the deregistration_delay is not currently being respected. In this case, it take an annoying load time and this command can help speed up the process.
|
4
|
+
|
5
|
+
The command looks for any extra old ongoing deployments and stops the tasks associated with them. This can cause errors for any inflight requests.
|
6
|
+
|
7
|
+
ufo stop demo-web
|
data/lib/ufo/help/task.md
CHANGED
@@ -3,15 +3,15 @@
|
|
3
3
|
You can use the `--command` or `-c` option to override the Docker container command.
|
4
4
|
|
5
5
|
ufo task hi-migrate # default command
|
6
|
-
ufo task
|
7
|
-
ufo task
|
8
|
-
ufo task
|
9
|
-
ufo task
|
6
|
+
ufo task demo-web --command bin/migrate
|
7
|
+
ufo task demo-web --command bin/with_env bundle exec rake db:migrate:redo VERSION=xxx
|
8
|
+
ufo task demo-web -c uptime
|
9
|
+
ufo task demo-web -c pwd
|
10
10
|
|
11
|
-
## Skipping Docker
|
11
|
+
## Skipping Docker and Task Registration
|
12
12
|
|
13
|
-
The `--
|
13
|
+
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:
|
14
14
|
|
15
|
-
ufo task
|
16
|
-
ufo task
|
17
|
-
ufo task
|
15
|
+
ufo task demo-web -c uptime # build at least once
|
16
|
+
ufo task demo-web --task-only -c ls # skip docker for speed
|
17
|
+
ufo task demo-web --task-only -c pwd # skip docker for speed
|
data/lib/ufo/help/tasks/build.md
CHANGED
@@ -58,7 +58,7 @@ Here's an example of each of them:
|
|
58
58
|
**task_definitions.rb**:
|
59
59
|
|
60
60
|
```ruby
|
61
|
-
task_definition "
|
61
|
+
task_definition "demo-web" do
|
62
62
|
source "main" # will use ufo/templates/main.json.erb
|
63
63
|
variables(
|
64
64
|
family: task_definition_name,
|
@@ -68,7 +68,7 @@ task_definition "hi-web" do
|
|
68
68
|
)
|
69
69
|
end
|
70
70
|
|
71
|
-
task_definition "
|
71
|
+
task_definition "demo-worker" do
|
72
72
|
source "main" # will use ufo/templates/main.json.erb
|
73
73
|
variables(
|
74
74
|
family: task_definition_name,
|
@@ -77,7 +77,7 @@ task_definition "hi-worker" do
|
|
77
77
|
)
|
78
78
|
end
|
79
79
|
|
80
|
-
task_definition "
|
80
|
+
task_definition "demo-clock" do
|
81
81
|
source "main" # will use ufo/templates/main.json.erb
|
82
82
|
variables(
|
83
83
|
family: task_definition_name,
|
@@ -92,7 +92,7 @@ The shared variables are set in the variables folder:
|
|
92
92
|
**ufo/variables/base.rb**:
|
93
93
|
|
94
94
|
```ruby
|
95
|
-
@image = helper.full_image_name # includes the git sha tongueroo/
|
95
|
+
@image = helper.full_image_name # includes the git sha tongueroo/demo-ufo:ufo-[sha].
|
96
96
|
@cpu = 128
|
97
97
|
@memory_reservation = 256
|
98
98
|
@environment = helper.env_file(".env")
|
@@ -118,20 +118,20 @@ You should see output similar to below:
|
|
118
118
|
$ ufo tasks build
|
119
119
|
Building Task Definitions...
|
120
120
|
Generating Task Definitions:
|
121
|
-
ufo/output/
|
122
|
-
ufo/output/
|
123
|
-
ufo/output/
|
121
|
+
ufo/output/demo-web.json
|
122
|
+
ufo/output/demo-worker.json
|
123
|
+
ufo/output/demo-clock.json
|
124
124
|
Task Definitions built in ufo/output.
|
125
125
|
$
|
126
126
|
|
127
|
-
Let's take a look at one of the generated files: `.ufo/output/
|
127
|
+
Let's take a look at one of the generated files: `.ufo/output/demo-web.json`.
|
128
128
|
|
129
129
|
{
|
130
|
-
"family": "
|
130
|
+
"family": "demo-web",
|
131
131
|
"containerDefinitions": [
|
132
132
|
{
|
133
133
|
"name": "web",
|
134
|
-
"image": "tongueroo/
|
134
|
+
"image": "tongueroo/demo-ufo:ufo-2017-06-11T22-22-32-a18aa30",
|
135
135
|
"cpu": 128,
|
136
136
|
"memoryReservation": 256,
|
137
137
|
"portMappings": [
|
@@ -4,9 +4,9 @@ The `ufo tasks register` command registers all the generated task definitions in
|
|
4
4
|
|
5
5
|
You should see something similiar to this:
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
demo-clock task definition registered.
|
8
|
+
demo-web task definition registered.
|
9
|
+
demo-worker task definition registered.
|
10
10
|
|
11
11
|
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:
|
12
12
|
|
data/lib/ufo/info.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
module Ufo
|
2
|
+
class Info < Base
|
3
|
+
def run
|
4
|
+
unless service
|
5
|
+
puts no_service_message
|
6
|
+
return
|
7
|
+
end
|
8
|
+
puts "Resources:"
|
9
|
+
stack_resources.each do |r|
|
10
|
+
# pp r
|
11
|
+
puts "#{r.logical_resource_id} - #{r.resource_type}:".colorize(:green)
|
12
|
+
puts " #{r.physical_resource_id}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Passing in service so method can be used else where.
|
17
|
+
def load_balancer(service)
|
18
|
+
load_balancer = service.load_balancers.first
|
19
|
+
return unless load_balancer
|
20
|
+
|
21
|
+
resp = elb.describe_target_groups(
|
22
|
+
target_group_arns: [load_balancer.target_group_arn]
|
23
|
+
)
|
24
|
+
target_group = resp.target_groups.first
|
25
|
+
load_balancer_arn = target_group.load_balancer_arns.first # assume first only
|
26
|
+
|
27
|
+
resp = elb.describe_load_balancers(load_balancer_arns: [load_balancer_arn])
|
28
|
+
resp.load_balancers.first
|
29
|
+
end
|
30
|
+
memoize :load_balancer
|
31
|
+
|
32
|
+
def service
|
33
|
+
return unless stack
|
34
|
+
|
35
|
+
service = stack_resources.find { |r| r.resource_type == "AWS::ECS::Service" }
|
36
|
+
arn = service.physical_resource_id
|
37
|
+
resp = ecs.describe_services(services: [arn], cluster: @cluster)
|
38
|
+
resp.services.first
|
39
|
+
end
|
40
|
+
memoize :service
|
41
|
+
|
42
|
+
def stack
|
43
|
+
find_stack(@stack_name)
|
44
|
+
end
|
45
|
+
memoize :stack
|
46
|
+
|
47
|
+
def route53_dns
|
48
|
+
return unless stack
|
49
|
+
|
50
|
+
output = stack.outputs.find do |o|
|
51
|
+
o.output_key == "Route53Dns"
|
52
|
+
end
|
53
|
+
output.output_value if output
|
54
|
+
end
|
55
|
+
|
56
|
+
def stack_resources
|
57
|
+
resp = cloudformation.describe_stack_resources(stack_name: @stack_name)
|
58
|
+
resp.stack_resources
|
59
|
+
end
|
60
|
+
memoize :stack_resources
|
61
|
+
end
|
62
|
+
end
|