ufo 4.4.3 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +6 -0
  4. data/docs/_docs/conventions.md +1 -1
  5. data/docs/_docs/extras/codebuild-iam-role.md +1 -1
  6. data/docs/_docs/extras/dockerfile-erb.md +60 -0
  7. data/docs/_docs/extras/ecs-network-mode.md +1 -1
  8. data/docs/_docs/extras/load-balancer.md +1 -1
  9. data/docs/_docs/extras/minimal-deploy-iam.md +1 -1
  10. data/docs/_docs/extras/redirection-support.md +1 -1
  11. data/docs/_docs/extras/route53-support.md +1 -1
  12. data/docs/_docs/extras/security-groups.md +1 -1
  13. data/docs/_docs/extras/ssl-support.md +1 -1
  14. data/docs/_docs/faq.md +2 -2
  15. data/docs/_docs/helpers.md +1 -1
  16. data/docs/_docs/more/auto-completion.md +11 -15
  17. data/docs/_docs/more/automated-cleanup.md +1 -1
  18. data/docs/_docs/more/customize-cloudformation.md +5 -5
  19. data/docs/_docs/more/migrations.md +5 -11
  20. data/docs/_docs/more/run-in-pieces.md +6 -12
  21. data/docs/_docs/more/single-task.md +9 -14
  22. data/docs/_docs/more/stuck-cloudformation.md +1 -1
  23. data/docs/_docs/more/why-cloudformation.md +1 -1
  24. data/docs/_docs/next-steps.md +1 -1
  25. data/docs/_docs/settings.md +3 -60
  26. data/docs/_docs/settings/aws_profile.md +36 -0
  27. data/docs/_docs/{settings-cfn.md → settings/cfn.md} +2 -0
  28. data/docs/_docs/settings/cluster.md +72 -0
  29. data/docs/_docs/{settings-network.md → settings/network.md} +3 -1
  30. data/docs/_docs/structure.md +1 -1
  31. data/docs/_docs/ufo-current.md +1 -1
  32. data/docs/_docs/ufo-env-extra.md +1 -1
  33. data/docs/_docs/ufo-env.md +1 -1
  34. data/docs/_docs/{params.md → ufo-task-params.md} +13 -6
  35. data/docs/_docs/upgrading.md +1 -1
  36. data/docs/_docs/upgrading/upgrade4.5.md +54 -0
  37. data/docs/_docs/upgrading/upgrade4.md +1 -1
  38. data/docs/_docs/variables.md +1 -1
  39. data/docs/_includes/subnav.html +13 -4
  40. data/docs/_reference/ufo-apps.md +1 -0
  41. data/docs/_reference/ufo-docker-base.md +10 -0
  42. data/docs/_reference/ufo-network-init.md +6 -5
  43. data/docs/_reference/ufo-task.md +10 -0
  44. data/docs/_reference/ufo-upgrade-v43to45.md +15 -0
  45. data/docs/_reference/ufo-upgrade.md +1 -1
  46. data/docs/articles.md +1 -1
  47. data/lib/ufo.rb +3 -37
  48. data/lib/ufo/apps.rb +18 -11
  49. data/lib/ufo/apps/cfn_map.rb +1 -1
  50. data/lib/ufo/apps/cluster.rb +24 -0
  51. data/lib/ufo/autoloader.rb +21 -0
  52. data/lib/ufo/base.rb +3 -3
  53. data/lib/ufo/cli.rb +2 -1
  54. data/lib/ufo/completer.rb +0 -2
  55. data/lib/ufo/docker.rb +0 -5
  56. data/lib/ufo/docker/builder.rb +12 -4
  57. data/lib/ufo/docker/compiler.rb +21 -0
  58. data/lib/ufo/docker/dockerfile.rb +1 -2
  59. data/lib/ufo/docker/variables.rb +26 -0
  60. data/lib/ufo/dsl.rb +0 -4
  61. data/lib/ufo/help/docker/base.md +10 -0
  62. data/lib/ufo/help/task.md +10 -0
  63. data/lib/ufo/network.rb +0 -4
  64. data/lib/ufo/param.rb +1 -16
  65. data/lib/ufo/ps.rb +0 -2
  66. data/lib/ufo/setting.rb +0 -2
  67. data/lib/ufo/ship.rb +2 -3
  68. data/lib/ufo/stack.rb +1 -4
  69. data/lib/ufo/stack/context.rb +4 -4
  70. data/lib/ufo/stack/helper.rb +10 -4
  71. data/lib/ufo/task.rb +2 -1
  72. data/lib/ufo/tasks.rb +0 -3
  73. data/lib/ufo/upgrade.rb +3 -8
  74. data/lib/ufo/upgrade/{upgrade43to44.rb → upgrade43to45.rb} +5 -5
  75. data/lib/ufo/util.rb +5 -2
  76. data/lib/ufo/version.rb +1 -1
  77. data/spec/fixtures/settings.yml +1 -1
  78. data/ufo.gemspec +1 -0
  79. metadata +30 -13
  80. data/Gemfile.lock +0 -113
  81. data/docs/_docs/upgrading/upgrade4.4.md +0 -39
  82. data/docs/_reference/ufo-upgrade-v43to44.md +0 -15
  83. data/lib/ufo/ecr.rb +0 -6
  84. data/lib/ufo/ecs.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2f3d71a890dc7dac92751517b4aecc81cbaf37d8
4
- data.tar.gz: 00b13ce41a1175c882fef6fbc0d3df52ac0b5636
2
+ SHA256:
3
+ metadata.gz: 4df81518380cf8da66e2b72a1ff6fd5a95e900d79d87c419a1517b2cd3386df8
4
+ data.tar.gz: a69061cdbb294e3d2a63a171f40d6b5f9ee2a28be1a3b18e54425c53b590d010
5
5
  SHA512:
6
- metadata.gz: 70244a2dcc77c9bee7b1586745490fcff58cc7056be81597dfb3434c09caad7831909927419bd4920b490adb57ede2e1335f7ba6c5c8a2444fe14aab07ce5da4
7
- data.tar.gz: ec407342a7d7c7520d6c33d99d1df53731a06692f238f5dacde6c774b4bac0a50737f7b16a0e25ed4d3445f6f0148738f584f8c230db66f6a2ca8f3ad95fe5f3
6
+ metadata.gz: 946b3c2c6cdbe86d537627741beeb0edbb17981c7b0553c7d9e148da9caff60ea85893579f17bf7e3e180321f7a1004825464b11305d2cf5e456adc324c3d566
7
+ data.tar.gz: 49c8121c9340643c0e3fdc34e56fd4912638c87a41b8f53523d2562c498f7b971a5f0e042e98ef82f53a08db7967f946b92b3213cf2113b3b94952cbfaf81e98
data/.gitignore CHANGED
@@ -18,3 +18,4 @@ test/version_tmp
18
18
  tmp
19
19
 
20
20
  .ruby-version
21
+ Gemfile.lock
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [4.5.0]
7
+ - #78 append_ufo_env to stack name, new default
8
+ - #79 service_cluster map setting
9
+ - #80 introduce Docckerfile.erb and dockerfile_variables.yml
10
+ - #81 update to zeitwerk for autoloading
11
+
6
12
  ## [4.4.3]
7
13
  - fix edge case when target group name is too long: only occurs with UFO\_FORCE\_TARGET_GROUP mode
8
14
  - stdout sync true for improved codebuild status
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Conventions
3
- nav_order: 18
3
+ nav_order: 19
4
4
  ---
5
5
 
6
6
  Ufo uses a set of naming conventions. This helps enforce some best practices and also allows the ufo commands to be concise. You can override or bypass the conventions easily.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: CodeBuild IAM Role
3
- nav_order: 29
3
+ nav_order: 31
4
4
  ---
5
5
 
6
6
  Note, the `/tmp/ecs-deploy-policy.json` policy is available at [Minimal Deploy IAM]({% link _docs/extras/minimal-deploy-iam.md %}).
@@ -0,0 +1,60 @@
1
+ ---
2
+ title: Dynamic Dockerfile.erb
3
+ nav_order: 32
4
+ ---
5
+
6
+ Sometimes you may need a little more dynamic control of your Dockerfile. For these cases, ufo supports dynamically creating a Dockerfile from a Dockerfile.erb. If Dockerfile.erb exists, ufo uses it to generate a Dockerfile as a part of the build process. These means that you should update the source Dockerfile.erb instead, as the Dockerfile will be overwritten. If Dockerfile.erb does not exist, then ufo will use the Dockerfile as-is.
7
+
8
+ ## Example
9
+
10
+ The Dockerfile.erb has access to variables defined in `dockerfile_variables.yml`. The variables should defined underneath an `UFO_ENV` key. Examples:
11
+
12
+ .ufo/settings/dockerfile_variables.yml:
13
+
14
+ ```yaml
15
+ ---
16
+ development:
17
+ base_image: 112233445566.dkr.ecr.us-west-1.amazonaws.com/demo/sinatr:base-2019-06-10T03-22-34-f91cdd350
18
+ production:
19
+ base_image: 778899001122.dkr.ecr.us-west-1.amazonaws.com/demo/sinatr:base-2019-06-10T03-23-34-abccddxzy
20
+ ```
21
+
22
+ Note, the `base_image` key is automatically updated by [ufo docker base](http://ufoships.com/reference/ufo-docker-base/) when Dockerfile.erb exists.
23
+
24
+ Here's what the `Dockerfile.erb` looks like:
25
+
26
+ ```Dockerfile
27
+ FROM <%= @base_image %>
28
+ # ...
29
+ CMD ["bin/web"]
30
+ ```
31
+
32
+ When `UFO_ENV=production`, it'll produced the following.
33
+
34
+ Dockerfile:
35
+
36
+ ```Dockerfile
37
+ FROM 778899001122.dkr.ecr.us-west-1.amazonaws.com/demo/sinatr:base-2019-06-10T03-23-34-abccddxzy
38
+ # ...
39
+ CMD ["bin/web"]
40
+ ```
41
+
42
+ The above example is demonstrates a good use-case. You may want a different FROM statement in your Dockerfile on a per-environment basis. In this case, we're using different ECR repositories from different AWS accounts for development vs production. The FROM statement changes based on which AWS account you're using.
43
+
44
+ ## General Steps
45
+
46
+ The generl steps are:
47
+
48
+ 1. Create a Dockerfile.erb with `<%= @base_image %>`
49
+ 2. Run: `ufo docker base` to generate `dockerfile_variables.yml`
50
+ 3. Run: `ufo docker build` to build a Dockerfile. Note, the `ufo ship` command also builds the Dockerfile.
51
+
52
+ Remember when using the Dockerfile.erb, the Dockerfile is generated and overwritten. So you should update the Dockerfile.erb.
53
+
54
+ ## Build Args
55
+
56
+ Why not use [build args](https://www.jeffgeerling.com/blog/2017/use-arg-dockerfile-dynamic-image-specification)?
57
+
58
+ Ufo uses a yaml file so users will not have to remember to provide the build arg. It is also easy to update the `dockerfile_variables.yml` with the `ufo docker base` command.
59
+
60
+ {% include prev_next.md %}
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: ECS Network Mode
3
- nav_order: 24
3
+ nav_order: 26
4
4
  ---
5
5
 
6
6
  ## Pros and Cons: awsvpc vs bridge network mode
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Load Balancer Support
3
- nav_order: 22
3
+ nav_order: 24
4
4
  ---
5
5
 
6
6
  Ufo can automatically create a load balancer and associate it with an ECS service. The options:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Minimal Deploy IAM Policy
3
- nav_order: 28
3
+ nav_order: 30
4
4
  ---
5
5
 
6
6
  The IAM user you use to run the `ufo ship` command needs a minimal set of IAM policies in order to deploy to ECS. Here is a table of the baseline services needed:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Redirection Support
3
- nav_order: 27
3
+ nav_order: 29
4
4
  ---
5
5
 
6
6
  ## Application Load Balancers
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Route53 Support
3
- nav_order: 26
3
+ nav_order: 28
4
4
  ---
5
5
 
6
6
  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:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Security Groups
3
- nav_order: 23
3
+ nav_order: 25
4
4
  ---
5
5
 
6
6
  Ufo creates and manages two security groups. One for the ELB and one for the ECS tasks.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: SSL Support
3
- nav_order: 25
3
+ nav_order: 27
4
4
  ---
5
5
 
6
6
  You can configure SSL support by uncomment the `listener_ssl` option in `.ufo/settings/cfn/default.yml`. Here's an example:
data/docs/_docs/faq.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: FAQ
3
- nav_order: 41
3
+ nav_order: 44
4
4
  ---
5
5
 
6
6
  **Q: Is AWS ECS Fargate supported?**
@@ -8,7 +8,7 @@ nav_order: 41
8
8
  Yes, Fargate is supported. To use ufo with Fargate, you will need to adjust the template in `.ufo/templates` to a structure supported by Fargate. There are 2 key items to adjust:
9
9
 
10
10
  1. The task definition JSON. Notably, the JSON structure has the `requiresCompatibilities`, `networkMode`, and `executionRoleArn` attributes. The `cpu` and `memory` attributes also move outside of the `containerDefinitions` level to the top-level attributes. For details on how to adjust the task definition refer to [Task Definitions]({% link _docs/tutorial-ufo-tasks-build.md %}).
11
- 2. The params that get sent to the `run_task` API methods. For details on how to adjust the params refer to [Params]({% link _docs/params.md %})
11
+ 2. The params that get sent to the `run_task` API methods. For details on how to adjust the params refer to [Params]({% link _docs/ufo-task-params.md %})
12
12
 
13
13
  If it's a brand new project, you can use `ufo init` with the `--launch-type fargate` option and it will generate a starter task definition JSON file that has the right Fargate structure. More info is available at [ufo init reference](/reference/ufo-init/#fargate-support).
14
14
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Helpers
3
- nav_order: 17
3
+ nav_order: 18
4
4
  ---
5
5
 
6
6
  The `task_definitions.rb` file has access to helper methods. These helper methods provide useful contextual information about the project.
@@ -1,28 +1,24 @@
1
1
  ---
2
2
  title: Auto Completion
3
- nav_order: 40
3
+ nav_order: 43
4
4
  ---
5
5
 
6
6
  Ufo supports bash auto-completion. To set it up add the following to your `~/.profile` or `.bashrc`:
7
7
 
8
- ```
9
- eval $(ufo completion_script)
10
- ```
8
+ eval $(ufo completion_script)
11
9
 
12
10
  Remember to restart your shell or source your profile file.
13
11
 
14
12
  Auto Completion examples:
15
13
 
16
- ```
17
- ufo [TAB]
18
- ufo ship [TAB]
19
- ufo ship demo-web [TAB]
20
- ufo ship demo-web --[TAB]
21
- ufo ship --[TAB]
22
- ufo docker [TAB]
23
- ufo docker build [TAB]
24
- ufo tasks [TAB]
25
- ufo tasks build [TAB]
26
- ```
14
+ ufo [TAB]
15
+ ufo ship [TAB]
16
+ ufo ship demo-web [TAB]
17
+ ufo ship demo-web --[TAB]
18
+ ufo ship --[TAB]
19
+ ufo docker [TAB]
20
+ ufo docker build [TAB]
21
+ ufo tasks [TAB]
22
+ ufo tasks build [TAB]
27
23
 
28
24
  {% include prev_next.md %}
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Automated Clean Up
3
- nav_order: 39
3
+ nav_order: 42
4
4
  ---
5
5
 
6
6
  Ufo can be configured to automatically clean old images from the ECR registry after the deploy completes by configuring your [settings.yml]({% link _docs/settings.md %}) file like so:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Customize CloudFormation
3
- nav_order: 34
3
+ nav_order: 37
4
4
  ---
5
5
 
6
6
  Under the hood, ufo creates most of the required resources with a CloudFormation stack. This includes the ELB, Target Group, Listener, Security Groups, ECS Service, and Route 53 records. You might need to customize these resources. Here are the ways to customize the resources that ufo creates.
@@ -20,13 +20,13 @@ You can override the source template that ufo uses by creating your own and savi
20
20
 
21
21
  ## CloudFormation Stack Name
22
22
 
23
- The CloudFormation stack name is based on the cluster, service name and UFO_ENV_EXTRA. A few examples help demonstrate:
23
+ The CloudFormation stack name is based on the service name, UFO_ENV and UFO_ENV_EXTRA. A few examples help demonstrate:
24
24
 
25
25
  Command | Stack Name
26
26
  --- | ---
27
- ufo ship demo-web | development-demo-web
28
- ufo ship demo-web -\-cluster dev | dev-demo-web
29
- UFO_ENV_EXTRA=2 ufo ship demo-web -\-cluster dev | development-demo-web-2
27
+ ufo ship demo-web | demo-web-development
28
+ ufo ship demo-web -\-cluster dev | demo-web-development
29
+ UFO_ENV_EXTRA=2 ufo ship demo-web -\-cluster dev | demo-web-development-2
30
30
 
31
31
  ## CloudFormation Stack Source Code
32
32
 
@@ -1,26 +1,20 @@
1
1
  ---
2
2
  title: Database Migrations
3
- nav_order: 38
3
+ nav_order: 41
4
4
  ---
5
5
 
6
6
  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:
7
7
 
8
- ```sh
9
- ufo task demo-web -c bundle exec rake db:migrate
10
- ```
8
+ ufo task demo-web -c bundle exec rake db:migrate
11
9
 
12
10
  It is nice to wrap the commands in a wrapper script in case you have to do things like to load the environment.
13
11
 
14
- ```sh
15
- ufo task demo-web -c bin/migrate
16
- ```
12
+ ufo task demo-web -c bin/migrate
17
13
 
18
14
  The `bin/migrate` script can look like this:
19
15
 
20
- ```bash
21
- #!/bin/bash
22
- bundle exec rake db:migrate
23
- ```
16
+ #!/bin/bash
17
+ bundle exec rake db:migrate
24
18
 
25
19
  The `ufo task` command is generalized so you can run any one-off task. It is not just limited to running migrations. The `ufo task` command performs the following:
26
20
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Run in Pieces
3
- nav_order: 36
3
+ nav_order: 39
4
4
  ---
5
5
 
6
6
  The `ufo ship` command goes through a few stages:
@@ -13,23 +13,17 @@ The CLI exposes many of these steps as separate commands. Here is now you would
13
13
 
14
14
  Build the docker image first.
15
15
 
16
- ```bash
17
- ufo docker build
18
- ufo docker push # pushes last built image to a registry
19
- ```
16
+ ufo docker build
17
+ ufo docker push # pushes last built image to a registry
20
18
 
21
19
  Build the task definitions.
22
20
 
23
- ```bash
24
- ufo tasks build # generates task definition json files to .ufo/output
25
- ufo tasks register # registers all genreated task definitions .ufo/output to ECS
26
- ```
21
+ ufo tasks build # generates task definition json files to .ufo/output
22
+ ufo tasks register # registers all genreated task definitions .ufo/output to ECS
27
23
 
28
24
  Update the service with the task definitions in `.ufo/output` untouched.
29
25
 
30
- ```bash
31
- ufo deploy demo-web
32
- ```
26
+ ufo deploy demo-web
33
27
 
34
28
  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`.
35
29
 
@@ -1,29 +1,24 @@
1
1
  ---
2
2
  title: Run Single Task
3
- nav_order: 37
3
+ nav_order: 40
4
4
  ---
5
5
 
6
6
  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.
7
7
 
8
- ```
9
- ufo task demo-web -c bundle exec rake db:migrate
10
- ```
8
+ ufo task demo-web -c bundle exec rake db:migrate
11
9
 
12
10
  At the end of the output you should see you the task ARN:
13
11
 
14
- ```sh
15
- $ ufo task demo-web -c bundle exec rake db:migrate
16
- ...
17
- Running task_definition: demo-web
18
- Task ARN: arn:aws:ecs:us-west-2:994926937775:task/a0e4229d-3d39-4b26-9151-6ab6869b84d4
19
- $
20
- ```
12
+
13
+ $ ufo task demo-web -c bundle exec rake db:migrate
14
+ ...
15
+ Running task_definition: demo-web
16
+ Task ARN: arn:aws:ecs:us-west-2:994926937775:task/a0e4229d-3d39-4b26-9151-6ab6869b84d4
17
+ $
21
18
 
22
19
  You can describe that task for more details:
23
20
 
24
- ```sh
25
- aws ecs describe-tasks --tasks arn:aws:ecs:us-west-2:994926937775:task/a0e4229d-3d39-4b26-9151-6ab6869b84d4
26
- ```
21
+ aws ecs describe-tasks --tasks arn:aws:ecs:us-west-2:994926937775:task/a0e4229d-3d39-4b26-9151-6ab6869b84d4
27
22
 
28
23
  You can check out the [ufo task](http://ufoships.com/reference/ufo-task/) reference for more details.
29
24
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Stuck CloudFormation
3
- nav_order: 35
3
+ nav_order: 38
4
4
  ---
5
5
 
6
6
  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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Why CloudFormation
3
- nav_order: 33
3
+ nav_order: 36
4
4
  ---
5
5
 
6
6
  Version 3 of ufo was a simpler implementation and did not make use of CloudFormation to create the ECS service. In version 4, ufo uses CloudFormation to create the ECS Service. This is because ufo became more powerful. Notably, support for Load Balancers was added. With this power, also came added complexity. So the complexity was push onto CloudFormation. Hence, ECS service is implemented as CloudFormation resource in version 4.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Next Steps
3
- nav_order: 43
3
+ nav_order: 46
4
4
  ---
5
5
 
6
6
  This concludes the tutorial guide for ufo. Hopefully you are now more comfortable with ufo's basic usage, concepts, and have a feel for the workflow.
@@ -43,69 +43,12 @@ Setting | Description
43
43
  `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.
44
44
  `network_profile` | The name of the network profile settings file to use. Maps to .ufo/settings/network/NAME.yml file
45
45
 
46
- ## ECS Cluster Convention
47
-
48
- Normally, the ECS cluster defaults to whatever UFO_ENV is set to by [convention]({% link _docs/conventions.md %}). For example, when `UFO_ENV=production` the ECS Cluster is `production` and when `UFO_ENV=development` the ECS Cluster is `development`. There are several ways to override this behavior. Let's go through an example:
49
-
50
- By default, these are all the same:
51
-
52
- ```sh
53
- ufo ship demo-web
54
- UFO_ENV=development ufo ship demo-web # same
55
- UFO_ENV=development ufo ship demo-web --cluster development # same
56
- ```
57
-
58
- If you use a specific `UFO_ENV=production`, these are the same
59
-
60
- ```
61
- UFO_ENV=production ufo ship demo-web
62
- UFO_ENV=production ufo ship demo-web --cluster production # same
63
- ```
64
-
65
- Override the convention by explicitly specifying the `--cluster` option in the CLI.
66
-
67
- ```sh
68
- ufo ship demo-web --cluster custom-cluster # override the cluster
69
- UFO_ENV=production ufo ship demo-web --cluster production-cluster # override the cluster
70
- ```
71
-
72
- 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.
73
-
74
- ```yaml
75
- development:
76
- cluster: dev
77
-
78
- production:
79
- cluster: prod
80
- ```
81
-
82
-
83
46
  ## AWS_PROFILE support
84
47
 
85
- An interesting option is `aws_profile`. Here's an example:
86
-
87
- ```yaml
88
- development:
89
- aws_profile: dev_profile
90
-
91
- production:
92
- aws_profile: prod_profile
93
- ```
94
-
95
- This provides a way to tightly bind `UFO_ENV` to `AWS_PROFILE`. This prevents you from forgetting to switch your `UFO_ENV` when switching your `AWS_PROFILE` thereby accidentally launching a stack in the wrong environment.
48
+ An interesting option is `aws_profile`. This allows you to tightly connect an AWS_PROFILE to a UFO_ENV. The details are in the [Settings AWS_PROFILE docs]({% link _docs/settings/aws_profile.md %}).
96
49
 
50
+ ## ECS Cluster Convention
97
51
 
98
- AWS_PROFILE | UFO_ENV | Notes
99
- --- | --- | ---
100
- dev_profile | development
101
- prod_profile | production
102
- whatever | development | default since whatever is not found in settings.yml
103
-
104
- The binding is two-way. So:
105
-
106
- UFO_ENV=production ufo ship # will deploy to the AWS_PROFILE=prod_profile
107
- AWS_PROFILE=prod_profile ufo ship # will deploy to the UFO_ENV=production
108
-
109
- 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.
52
+ Normally, the ECS cluster defaults to whatever UFO_ENV is set to by [convention]({% link _docs/conventions.md %}). For example, when `UFO_ENV=production` the ECS Cluster is `production` and when `UFO_ENV=development` the ECS Cluster is `development`. There are several ways to override this behavior. This is detailed in the [Settings Cluster docs]({% link _docs/settings/cluster.md %}).
110
53
 
111
54
  {% include prev_next.md %}