ufo 2.3.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +57 -0
- data/.gitmodules +3 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +16 -1
- data/Gemfile.lock +16 -3
- data/README.md +5 -1
- data/docs/_docs/auto-completion.md +27 -0
- data/docs/_docs/automated-cleanup.md +1 -1
- data/docs/_docs/conventions.md +2 -2
- data/docs/_docs/helpers.md +6 -6
- data/docs/_docs/run-in-pieces.md +15 -8
- data/docs/_docs/settings.md +61 -49
- data/docs/_docs/structure.md +2 -2
- data/docs/_docs/tutorial-ufo-docker-build.md +10 -3
- data/docs/_docs/tutorial-ufo-init.md +48 -16
- data/docs/_docs/tutorial-ufo-ship.md +14 -7
- data/docs/_docs/tutorial-ufo-ships.md +1 -1
- data/docs/_docs/tutorial-ufo-tasks-build.md +23 -14
- data/docs/_docs/ufo-deploy.md +30 -0
- data/docs/_docs/ufo-docker-base.md +3 -3
- data/docs/_docs/ufo-docker-build.md +3 -3
- data/docs/_docs/ufo-docker-push.md +43 -0
- data/docs/_docs/ufo-env.md +17 -15
- data/docs/_docs/ufo-init.md +14 -1
- data/docs/_docs/ufo-scale.md +2 -4
- data/docs/_docs/ufo-ships.md +2 -2
- data/docs/_docs/variables.md +6 -6
- data/docs/_includes/commands.html +4 -4
- data/docs/_includes/subnav.html +3 -0
- data/docs/_includes/summary.html +2 -2
- data/docs/_includes/ufo-ship-options.md +0 -2
- data/docs/docs.md +5 -1
- data/docs/quick-start.md +19 -10
- data/lib/{starter_project → template}/.env +0 -0
- data/lib/template/.ufo/settings.yml.tt +27 -0
- data/lib/{starter_project/ufo/task_definitions.rb → template/.ufo/task_definitions.rb.tt} +0 -0
- data/lib/{starter_project/ufo → template/.ufo}/templates/main.json.erb +0 -0
- data/lib/{starter_project/ufo → template/.ufo}/variables/base.rb +0 -0
- data/lib/{starter_project/ufo → template/.ufo}/variables/development.rb +0 -0
- data/lib/{starter_project/ufo → template/.ufo}/variables/production.rb +0 -0
- data/lib/{starter_project → template}/Dockerfile +0 -0
- data/lib/{starter_project/bin/deploy → template/bin/deploy.tt} +0 -0
- data/lib/ufo.rb +9 -2
- data/lib/ufo/cli.rb +34 -29
- data/lib/ufo/completer.rb +86 -64
- data/lib/ufo/core.rb +42 -0
- data/lib/ufo/default.rb +4 -6
- data/lib/ufo/default/settings.yml +24 -22
- data/lib/ufo/deploy.rb +0 -0
- data/lib/ufo/docker.rb +12 -2
- data/lib/ufo/docker/builder.rb +19 -49
- data/lib/ufo/docker/cleaner.rb +4 -2
- data/lib/ufo/docker/dockerfile.rb +1 -2
- data/lib/ufo/docker/pusher.rb +53 -0
- data/lib/ufo/dsl.rb +1 -2
- data/lib/ufo/dsl/helper.rb +3 -4
- data/lib/ufo/dsl/outputter.rb +1 -1
- data/lib/ufo/dsl/task_definition.rb +17 -37
- data/lib/ufo/ecr/auth.rb +22 -2
- data/lib/ufo/ecs.rb +5 -0
- data/lib/ufo/ecs/service.rb +21 -0
- data/lib/ufo/help/completion.md +1 -1
- data/lib/ufo/help/completion_script.md +1 -1
- data/lib/ufo/help/deploy.md +14 -0
- data/lib/ufo/help/docker/name.md +13 -2
- data/lib/ufo/help/docker/push.md +11 -0
- data/lib/ufo/init.rb +48 -65
- data/lib/ufo/log_group.rb +5 -2
- data/lib/ufo/sequence.rb +27 -0
- data/lib/ufo/setting.rb +18 -8
- data/lib/ufo/ship.rb +23 -46
- data/lib/ufo/tasks/builder.rb +8 -11
- data/lib/ufo/tasks/register.rb +2 -3
- data/lib/ufo/upgrade3.rb +64 -0
- data/lib/ufo/util.rb +0 -2
- data/lib/ufo/version.rb +1 -1
- data/spec/fixtures/home_existing/.docker/config.json +1 -1
- data/spec/fixtures/settings.yml +23 -0
- data/spec/lib/cli_spec.rb +1 -9
- data/spec/lib/completion_spec.rb +18 -0
- data/spec/lib/core_spec.rb +16 -0
- data/spec/lib/ecr_auth_spec.rb +1 -3
- data/spec/lib/ecr_cleaner_spec.rb +1 -3
- data/spec/lib/setting_spec.rb +12 -0
- data/spec/lib/ship_spec.rb +2 -4
- data/spec/lib/task_spec.rb +0 -2
- data/spec/spec_helper.rb +12 -2
- data/ufo.gemspec +2 -0
- metadata +47 -13
- data/lib/starter_project/ufo/settings.yml +0 -18
- data/lib/ufo/env.rb +0 -18
- data/lib/ufo/help/sub/goodbye.md +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c909def5e8c50d44c06b4fb96dbe5c56d1fa534fe919e01a9ec206ae95246dfd
|
4
|
+
data.tar.gz: cfc0ec639cc48c7cbb2ab9ba3fdaa29fe3337ae0ef95d7eca92c7f77c65e65ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6a1ce7a570829d4201c978dfe6e0d4cf6c5b3c0e172e0cce9df9cac0573d16a42fa90328843381f42e144da58b9ae816c15393ae12bc590c53557041e2a6227
|
7
|
+
data.tar.gz: 138a530c4e23df2b55c83477a9dc183b6cd7191fb3c231dabfbdc4053088b5006394cbc54e517fdbf831f915d9e9ce67146468fc5729a5737c175b319406b8c8
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
version: 2
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
docker:
|
9
|
+
# specify the version you desire here
|
10
|
+
- image: circleci/ruby:2.5.0-node-browsers
|
11
|
+
|
12
|
+
# Specify service dependencies here if necessary
|
13
|
+
# CircleCI maintains a library of pre-built images
|
14
|
+
# documented at https://circleci.com/docs/2.0/circleci-images/
|
15
|
+
# - image: circleci/postgres:9.4
|
16
|
+
|
17
|
+
working_directory: ~/repo
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- checkout
|
21
|
+
|
22
|
+
- run:
|
23
|
+
name: submodule sync
|
24
|
+
command: |
|
25
|
+
git submodule sync
|
26
|
+
git submodule update --init
|
27
|
+
|
28
|
+
# Download and cache dependencies
|
29
|
+
- restore_cache:
|
30
|
+
keys:
|
31
|
+
- v1-dependencies-{{ checksum "Gemfile" }}
|
32
|
+
# fallback to using the latest cache if no exact match is found
|
33
|
+
- v1-dependencies-
|
34
|
+
|
35
|
+
- run:
|
36
|
+
name: install dependencies
|
37
|
+
command: |
|
38
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
39
|
+
|
40
|
+
- save_cache:
|
41
|
+
paths:
|
42
|
+
- ./vendor/bundle
|
43
|
+
key: v1-dependencies-{{ checksum "Gemfile" }}
|
44
|
+
|
45
|
+
# run tests!
|
46
|
+
- run:
|
47
|
+
name: run tests
|
48
|
+
command: |
|
49
|
+
mkdir /tmp/test-results
|
50
|
+
bundle exec rspec
|
51
|
+
|
52
|
+
# collect reports
|
53
|
+
- store_test_results:
|
54
|
+
path: /tmp/test-results
|
55
|
+
- store_artifacts:
|
56
|
+
path: /tmp/test-results
|
57
|
+
destination: test-results
|
data/.gitmodules
ADDED
data/.rspec
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,9 +3,24 @@
|
|
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
|
+
## [3.0.0]
|
7
|
+
- dotufo: rename ufo folder to .ufo. Use ufo upgrade3 command to upgrade.
|
8
|
+
- new settings.yml format to account for multiple AWS accounts and environments.
|
9
|
+
- allows for environment specific setting file
|
10
|
+
- add auto-completion, to setup: eval $(ufo completion_script)
|
11
|
+
- ufo upgrade3 command
|
12
|
+
- ufo init: Use Thor::Group as generator
|
13
|
+
- default UFO_ENV is now development, not production
|
14
|
+
- Merge pull request #9 from jlchenwenbo/master
|
15
|
+
- Merge branch 'patch-1' of https://github.com/breezeight/ufo into breezeight-patch-1
|
16
|
+
- Bug: Update ship.rb: list all ecs services instead of just the first page
|
17
|
+
- replace project_root with Ufo.root internally
|
18
|
+
- update docs
|
19
|
+
- use vendorized render_me_pretty for erb rendering
|
20
|
+
|
6
21
|
## [2.2.3]
|
7
22
|
- eval $(ufo completion_script) for tab auto-completion
|
8
|
-
- default
|
23
|
+
- default task_definition template fixes: add ecs/ to awslogs_group, add helper.current_region
|
9
24
|
- move bin/ufo to exe/ufo
|
10
25
|
- rename: AwsServices to AwsService, Defaults to Default, Settings to Setting
|
11
26
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ufo (2.
|
4
|
+
ufo (2.3.0)
|
5
|
+
activesupport
|
5
6
|
aws-sdk-cloudwatchlogs
|
6
7
|
aws-sdk-ec2
|
7
8
|
aws-sdk-ecr
|
@@ -15,7 +16,12 @@ PATH
|
|
15
16
|
GEM
|
16
17
|
remote: https://rubygems.org/
|
17
18
|
specs:
|
18
|
-
|
19
|
+
activesupport (5.1.4)
|
20
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
21
|
+
i18n (~> 0.7)
|
22
|
+
minitest (~> 5.1)
|
23
|
+
tzinfo (~> 1.1)
|
24
|
+
aws-partitions (1.60.0)
|
19
25
|
aws-sdk-cloudwatchlogs (1.2.0)
|
20
26
|
aws-sdk-core (~> 3)
|
21
27
|
aws-sigv4 (~> 1.0)
|
@@ -23,7 +29,7 @@ GEM
|
|
23
29
|
aws-partitions (~> 1.0)
|
24
30
|
aws-sigv4 (~> 1.0)
|
25
31
|
jmespath (~> 1.0)
|
26
|
-
aws-sdk-ec2 (1.
|
32
|
+
aws-sdk-ec2 (1.27.0)
|
27
33
|
aws-sdk-core (~> 3)
|
28
34
|
aws-sigv4 (~> 1.0)
|
29
35
|
aws-sdk-ecr (1.2.0)
|
@@ -40,11 +46,15 @@ GEM
|
|
40
46
|
codeclimate-test-reporter (1.0.8)
|
41
47
|
simplecov (<= 0.13)
|
42
48
|
colorize (0.8.1)
|
49
|
+
concurrent-ruby (1.0.5)
|
43
50
|
deep_merge (1.2.1)
|
44
51
|
diff-lcs (1.3)
|
45
52
|
docile (1.1.5)
|
53
|
+
i18n (0.9.4)
|
54
|
+
concurrent-ruby (~> 1.0)
|
46
55
|
jmespath (1.3.1)
|
47
56
|
json (2.1.0)
|
57
|
+
minitest (5.11.3)
|
48
58
|
plissken (1.2.0)
|
49
59
|
rake (12.3.0)
|
50
60
|
rspec (3.7.0)
|
@@ -66,6 +76,9 @@ GEM
|
|
66
76
|
simplecov-html (~> 0.10.0)
|
67
77
|
simplecov-html (0.10.2)
|
68
78
|
thor (0.20.0)
|
79
|
+
thread_safe (0.3.6)
|
80
|
+
tzinfo (1.2.5)
|
81
|
+
thread_safe (~> 0.1)
|
69
82
|
|
70
83
|
PLATFORMS
|
71
84
|
ruby
|
data/README.md
CHANGED
@@ -20,6 +20,10 @@ Ufo deploys a task definition that is written in a templating language that is e
|
|
20
20
|
|
21
21
|
See [ufoships.com](http://ufoships.com) for full documentation.
|
22
22
|
|
23
|
+
## Important
|
24
|
+
|
25
|
+
If you are on version 2, you can run `ufo upgrade3` within your project to upgrade it to version 3. Refer to the [CHANGELOG](CHANGELOG.md).
|
26
|
+
|
23
27
|
## Installation
|
24
28
|
|
25
29
|
```sh
|
@@ -33,7 +37,7 @@ Full installation instructions are at [Install Ufo](http://ufoships.com/docs/ins
|
|
33
37
|
To quickly demonstrate how simple it is to use ufo we will use an example app from [tongueroo/hi](https://github.com/tongueroo/ufo). The app is a barebones sinatra app. Here are the steps:
|
34
38
|
|
35
39
|
```sh
|
36
|
-
|
40
|
+
gem install ufo
|
37
41
|
git clone https:///github.com/tongueroo/hi.git
|
38
42
|
cd hi
|
39
43
|
ufo init --app=hi --image=tongueroo/hi
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
title: Auto Completion
|
3
|
+
---
|
4
|
+
|
5
|
+
Ufo supports bash auto-completion. To set it up add this to your `~/.profile` or `.bashrc`:
|
6
|
+
|
7
|
+
```
|
8
|
+
eval $(ufo completion_script)
|
9
|
+
```
|
10
|
+
|
11
|
+
Auto Completion examples:
|
12
|
+
|
13
|
+
```
|
14
|
+
ufo [TAB]
|
15
|
+
ufo ship [TAB]
|
16
|
+
ufo ship hi-web [TAB]
|
17
|
+
ufo ship hi-web --[TAB]
|
18
|
+
ufo ship --[TAB]
|
19
|
+
ufo docker [TAB]
|
20
|
+
ufo docker build [TAB]
|
21
|
+
ufo tasks [TAB]
|
22
|
+
ufo tasks build [TAB]
|
23
|
+
```
|
24
|
+
|
25
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/conventions.md %}">Back</a>
|
26
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/run-in-pieces.md %}">Next Step</a>
|
27
|
+
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
title: Automated Clean Up
|
3
3
|
---
|
4
4
|
|
5
|
-
Ufo can be configured to automatically clean old images from the ECR registry after the deploy completes by configuring the your [settings.yml] file like so:
|
5
|
+
Ufo can be configured to automatically clean old images from the ECR registry after the deploy completes by configuring the your [settings.yml]({% link _docs/settings.md %}) file like so:
|
6
6
|
|
7
7
|
```yaml
|
8
8
|
ecr_keep: 30
|
data/docs/_docs/conventions.md
CHANGED
@@ -6,7 +6,7 @@ Ufo uses a set of naming conventions. This helps enforce some best practices an
|
|
6
6
|
|
7
7
|
### UFO_ENV to ECS Cluster Convention
|
8
8
|
|
9
|
-
By default, the ECS cluster value is the same as UFO_ENV's value. So if `UFO_ENV=production` then the ECS Cluster is production and if `UFO_ENV=
|
9
|
+
By default, the ECS cluster value is the same as UFO_ENV's value. So if `UFO_ENV=production` then the ECS Cluster is `production` and if `UFO_ENV=development` then the ECS Cluster is `development`. You can easily override this convention by specifying the `--cluster` CLI option. You can also override this behavior with [settings.yml]({% link _docs/settings.md %}) to spare you from having to type `--cluster` over and over.
|
10
10
|
|
11
11
|
### Service and Task Names Convention
|
12
12
|
|
@@ -44,5 +44,5 @@ ufo ship hi-web --target-group=arn:aws:elasticloadbalancing:us-east-1:12345689:t
|
|
44
44
|
```
|
45
45
|
|
46
46
|
<a id="prev" class="btn btn-basic" href="{% link _docs/helpers.md %}">Back</a>
|
47
|
-
<a id="next" class="btn btn-primary" href="{% link _docs/
|
47
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/auto-completion.md %}">Next Step</a>
|
48
48
|
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
data/docs/_docs/helpers.md
CHANGED
@@ -2,21 +2,21 @@
|
|
2
2
|
title: Helpers
|
3
3
|
---
|
4
4
|
|
5
|
-
The
|
5
|
+
The `task_definitions.rb` file has access to helper methods. These helper methods provide useful contextual information about the project.
|
6
6
|
|
7
|
-
For example, one of the
|
7
|
+
For example, one of the helper methods provides the exposed port in the Dockerfile of the project. This is useful if someone changes the exported port in the Dockerfile, he likely to forget to also update the ufo variable so it is referenced via the helper. Here is a list of the helpers:
|
8
8
|
|
9
9
|
Helper | Description
|
10
10
|
------------- | -------------
|
11
|
-
full\_image\_name | The full docker image name that ufo builds. The "base" portion of the docker image name is defined in
|
11
|
+
full\_image\_name | The full docker image name that ufo builds. The "base" portion of the docker image name is defined in `settings.yml`. For example, the base portion is `tongueroo/hi` and the full image name is `tongueroo/hi:ufo-[timestamp]-[sha]`. The base name does not include the generated Docker tag, which contains a timestamp and git sha of the Dockerfile that is used.
|
12
12
|
dockerfile\_port | Exposed port extracted from the Dockerfile of the project.
|
13
|
-
env_vars(text) | This method takes a block of text that contains the env values in key=value format and converts that block of text to the proper task definition json format.
|
13
|
+
env_vars(text) | This method takes a block of text that contains the env values in `key=value` format and converts that block of text to the proper task definition json format.
|
14
14
|
env_file(path) | This method takes an `.env` file which contains a simple key value list of environment variables and converts the list to the proper task definition json format.
|
15
15
|
task_definition_name | The name of the task_definition. So if the code looks like this `task_definition "demo-web" do`, the task_definition_name is "demo-web".
|
16
16
|
|
17
|
-
To call the helper in task_definitions.rb you must add `helper.` in front. So
|
17
|
+
To call the helper in task_definitions.rb you must add `helper.` in front. So `full_image_name` is called via `helper.full_image_name`.
|
18
18
|
|
19
|
-
The 2 classes which provide these special helper methods are in [ufo/dsl.rb](https://github.com/tongueroo/ufo/blob/master/lib/ufo/dsl.rb) and [ufo/dsl/helper.rb](https://github.com/tongueroo/ufo/blob/master/lib/ufo/dsl/helper.rb). Refer to these classes for the full list of the
|
19
|
+
The 2 classes which provide these special helper methods are in [ufo/dsl.rb](https://github.com/tongueroo/ufo/blob/master/lib/ufo/dsl.rb) and [ufo/dsl/helper.rb](https://github.com/tongueroo/ufo/blob/master/lib/ufo/dsl/helper.rb). Refer to these classes for the full list of the helper methods.
|
20
20
|
|
21
21
|
<a id="prev" class="btn btn-basic" href="{% link _docs/variables.md %}">Back</a>
|
22
22
|
<a id="next" class="btn btn-primary" href="{% link _docs/conventions.md %}">Next Step</a>
|
data/docs/_docs/run-in-pieces.md
CHANGED
@@ -2,29 +2,36 @@
|
|
2
2
|
title: Run in Pieces
|
3
3
|
---
|
4
4
|
|
5
|
-
The `ufo ship` command goes through a few stages:
|
5
|
+
The `ufo ship` command goes through a few stages:
|
6
|
+
|
7
|
+
1. building the docker image
|
8
|
+
2. registering the task defiintions
|
9
|
+
2. updating the ECS service.
|
10
|
+
|
11
|
+
The CLI exposes many of these steps as separate commands. Here is now you would be able to run each of the steps in pieces.
|
6
12
|
|
7
13
|
Build the docker image first.
|
8
14
|
|
9
15
|
```bash
|
10
16
|
ufo docker build
|
11
|
-
ufo docker
|
17
|
+
ufo docker push # pushes last built image to a registry
|
12
18
|
```
|
13
19
|
|
14
20
|
Build the task definitions.
|
15
21
|
|
16
22
|
```bash
|
17
|
-
ufo tasks build
|
18
|
-
ufo tasks register #
|
23
|
+
ufo tasks build # generates task definition json files to .ufo/output
|
24
|
+
ufo tasks register # registers all genreated task definitions .ufo/output to ECS
|
19
25
|
```
|
20
26
|
|
21
|
-
|
27
|
+
Update the service with the task definitions in `.ufo/output` untouched.
|
22
28
|
|
23
29
|
```bash
|
24
|
-
ufo
|
30
|
+
ufo deploy hi-web
|
25
31
|
```
|
26
|
-
Note if you use the `--no-docker` option you should ensure that you have already push a docker image to your docker registry. Or else the task will not be able to spin up because the docker image does not exist. It is normally recommended that you normally use `ufo ship`.
|
27
32
|
|
28
|
-
|
33
|
+
Note if you use the `ufo deploy` you should ensure that you have already push 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
|
+
|
35
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/auto-completion.md %}">Back</a>
|
29
36
|
<a id="next" class="btn btn-primary" href="{% link _docs/single-task.md %}">Next Step</a>
|
30
37
|
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
data/docs/_docs/settings.md
CHANGED
@@ -12,86 +12,98 @@ Let's take a look at an example `ufo/settings.yml`:
|
|
12
12
|
|
13
13
|
```yaml
|
14
14
|
image: tongueroo/hi
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
15
|
+
base:
|
16
|
+
image: <%= @image %>
|
17
|
+
# clean_keep: 30 # cleans up docker images on your docker server.
|
18
|
+
# ecr_keep: 30 # cleans up images on ECR and keeps this remaining amount. Defaults to keep all.
|
19
|
+
# defaults when an new ECS service is created by ufo ship
|
20
|
+
new_service:
|
21
|
+
maximum_percent: 200
|
22
|
+
minimum_healthy_percent: 100
|
23
|
+
desired_count: 1
|
24
|
+
|
25
|
+
development:
|
26
|
+
# cluster: dev # uncomment if you want the cluster name be other than the default
|
27
|
+
# the default is to match UFO_ENV. So UFO_ENV=development means the ECS
|
28
|
+
# cluster will be name development
|
29
|
+
# When you have AWS_PROFILE set to one of these values, ufo will switch to the desired
|
30
|
+
# environment. This prevents you from switching AWS_PROFILE, forgetting to
|
31
|
+
# also switch UFO_ENV, and accidentally deploying to production vs development.
|
32
|
+
# aws_profiles:
|
33
|
+
# - dev_profile1
|
34
|
+
# - dev_profile2
|
35
|
+
|
36
|
+
production:
|
37
|
+
# cluster: prod
|
38
|
+
# aws_profiles:
|
39
|
+
# - prod_profile
|
30
40
|
```
|
31
41
|
|
32
|
-
The table below covers
|
42
|
+
The table below covers each setting:
|
33
43
|
|
34
44
|
Setting | Description
|
35
45
|
------------- | -------------
|
36
46
|
`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/hi` is correct and `tongueroo/hi:my-tag` is incorrect.
|
37
|
-
`
|
38
|
-
`
|
47
|
+
`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.
|
48
|
+
`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.
|
49
|
+
`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 convetion.
|
50
|
+
`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
|
39
51
|
|
52
|
+
Maps the `UFO_ENV` to an ECS cluster value. This allows you to override the convention where the default cluster equals to `UFO_ENV`. value. This is covered in detailed at [Conventions]({% link _docs/conventions.md %}).
|
40
53
|
|
41
|
-
### UFO_ENV to ECS Cluster Mapping
|
42
54
|
|
43
|
-
|
55
|
+
### ECS Cluster Convention
|
44
56
|
|
45
|
-
|
57
|
+
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`. This setting allows you to override this behavior so that you do not have to specify the `--cluster` CLI option repeatedly. Let's go through an example:
|
46
58
|
|
47
|
-
|
48
|
-
UFO_ENV=production ufo ship hi-web # cluster defaults to UFO_ENV which is prod
|
49
|
-
UFO_ENV=production ufo ship hi-web --cluster prod # same as above
|
50
|
-
```
|
51
|
-
|
52
|
-
Override the convention and explicitly specify the `--cluster` option in the CLI.
|
59
|
+
By default, these are all the same:
|
53
60
|
|
54
61
|
```sh
|
55
|
-
|
62
|
+
ufo ship hi-web
|
63
|
+
UFO_ENV=development ufo ship hi-web # same
|
64
|
+
UFO_ENV=development ufo ship hi-web --cluster development # same
|
56
65
|
```
|
57
66
|
|
58
|
-
|
67
|
+
If you use a specific `UFO_ENV=production`, these are the same
|
59
68
|
|
60
|
-
```
|
61
|
-
|
62
|
-
|
69
|
+
```
|
70
|
+
UFO_ENV=production ufo ship hi-web
|
71
|
+
UFO_ENV=production ufo ship hi-web --cluster production # same
|
63
72
|
```
|
64
73
|
|
65
|
-
|
74
|
+
Override the convention and explicitly specify the `--cluster` option in the CLI.
|
66
75
|
|
67
76
|
```sh
|
68
|
-
|
77
|
+
ufo ship hi-web --cluster custom-cluster # override the cluster
|
78
|
+
UFO_ENV=production ufo ship hi-web --cluster production-cluster # override the cluster
|
69
79
|
```
|
70
80
|
|
71
|
-
|
81
|
+
By setting the cluster option in the `settings.yml` file, you won't have to specify the cluster repeatedly.
|
82
|
+
|
83
|
+
### AWS_PROFILE awareness
|
72
84
|
|
73
|
-
An interesting
|
85
|
+
An interesting option is `aws_profiles`. Here's an example:
|
74
86
|
|
75
87
|
```yaml
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
88
|
+
development:
|
89
|
+
aws_profiles:
|
90
|
+
- dev-profile1
|
91
|
+
- dev-profile2
|
92
|
+
|
93
|
+
production:
|
94
|
+
aws_profiles:
|
95
|
+
- prod-profile
|
80
96
|
```
|
81
97
|
|
82
|
-
In this case, when you set `AWS_PROFILE` to switch AWS profiles, ufo picks this up and maps the `AWS_PROFILE` value to the specified `UFO_ENV` using the `
|
98
|
+
In this case, when you set the environment variable `AWS_PROFILE` to switch AWS profiles in your shell, ufo picks this up and maps the `AWS_PROFILE` value to the specified `UFO_ENV` using the `aws_profiles` option. Example:
|
83
99
|
|
84
100
|
```sh
|
85
|
-
AWS_PROFILE=
|
86
|
-
AWS_PROFILE=
|
87
|
-
AWS_PROFILE=
|
88
|
-
AWS_PROFILE=whatever => UFO_ENV=development
|
101
|
+
AWS_PROFILE=dev-profile1 => UFO_ENV=development
|
102
|
+
AWS_PROFILE=dev-profile2 => UFO_ENV=development
|
103
|
+
AWS_PROFILE=prod-profile => UFO_ENV=production
|
89
104
|
```
|
90
105
|
|
91
|
-
|
92
|
-
|
93
|
-
This behavior prevents you from switching `AWS_PROFILE`s and then accidentally deploying a production based docker image to staging and vice versas because you forgot to also switch `UFO_ENV` to its respective environment.
|
94
|
-
|
106
|
+
This behavior prevents you from switching `AWS_PROFILE`s and then accidentally deploying a production based docker image to development and vice versas because you forgot to also switch `UFO_ENV` to its respective environment.
|
95
107
|
|
96
108
|
<a id="prev" class="btn btn-basic" href="{% link _docs/ufo-help.md %}">Back</a>
|
97
109
|
<a id="next" class="btn btn-primary" href="{% link _docs/ufo-env.md %}">Next Step</a>
|