ufo 3.3.2 → 3.4.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 +9 -0
- data/Gemfile.lock +9 -7
- data/docs/README.md +1 -2
- data/docs/_docs/params.md +72 -0
- data/docs/_docs/settings.md +1 -6
- data/docs/_docs/tutorial-ufo-init.md +0 -5
- data/docs/_docs/ufo-env.md +1 -1
- data/docs/_includes/subnav.html +1 -0
- data/docs/_reference/ufo-deploy.md +9 -1
- data/docs/_reference/ufo-init.md +30 -9
- data/docs/_reference/ufo-task.md +11 -12
- data/docs/_reference/ufo-upgrade3_3_to_3_4.md +23 -0
- data/docs/reference.md +1 -0
- data/lib/template/.ufo/params.yml.tt +65 -0
- data/lib/template/.ufo/settings.yml.tt +0 -4
- data/lib/template/.ufo/templates/fargate.json.erb +37 -0
- data/lib/template/.ufo/variables/base.rb.tt +15 -0
- data/lib/template/.ufo/variables/development.rb +1 -1
- data/lib/ufo.rb +3 -1
- data/lib/ufo/cli.rb +7 -3
- data/lib/ufo/default/settings.yml +0 -4
- data/lib/ufo/destroy.rb +1 -1
- data/lib/ufo/docker/builder.rb +1 -5
- data/lib/ufo/docker/cleaner.rb +1 -2
- data/lib/ufo/docker/pusher.rb +1 -5
- data/lib/ufo/dsl.rb +1 -1
- data/lib/ufo/dsl/helper.rb +3 -8
- data/lib/ufo/dsl/task_definition.rb +7 -45
- data/lib/ufo/ecr/cleaner.rb +2 -2
- data/lib/ufo/help/deploy.md +9 -1
- data/lib/ufo/help/init.md +18 -0
- data/lib/ufo/help/task.md +6 -6
- data/lib/ufo/init.rb +9 -2
- data/lib/ufo/param.rb +24 -0
- data/lib/ufo/scale.rb +1 -1
- data/lib/ufo/sequence.rb +14 -0
- data/lib/ufo/ship.rb +6 -6
- data/lib/ufo/task.rb +9 -1
- data/lib/ufo/tasks/register.rb +21 -1
- data/lib/ufo/template_scope.rb +45 -0
- data/lib/ufo/upgrade/params.yml +47 -0
- data/lib/ufo/upgrade33_to_34.rb +32 -0
- data/lib/ufo/util.rb +25 -0
- data/lib/ufo/version.rb +1 -1
- data/spec/fixtures/settings.yml +0 -4
- data/spec/lib/setting_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -1
- data/ufo.gemspec +1 -0
- metadata +25 -4
- data/lib/template/.ufo/variables/base.rb +0 -6
- data/lib/ufo/default.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6538c65fc62bc274a20fba3434414de8c69ad9ed21191d0045ea6eb3ded848b
|
4
|
+
data.tar.gz: 995b140a23c61dd0afc8d30e81c5c83dd0c2fafd75c5d0d11e5a12f8adc6fb75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53c156400bd5f0ede61f83f1305ca8203b85dac5607c8b3397f4fe42741323941ba3f89364d2a47792a7e2ae99fc63c0991aa2961dca03c78bdb6b57f1a5796f
|
7
|
+
data.tar.gz: 738494c751a0bedd7209053682ea0141bf4d717035cc057e96b53d42df4b3c4cde762d5effba4f00ce028f4274347e4abc1abc4a6637a8cfe1e67aaf85d414ab
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,15 @@
|
|
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.4.0]
|
7
|
+
- Merge pull request #31 fargate support
|
8
|
+
- ufo upgrade3_3_to_3_4 command
|
9
|
+
- add params.yml concept to support fargate and any other aws-sdk option
|
10
|
+
- add TemplateScope class
|
11
|
+
- combine Default into Util module
|
12
|
+
- clean up settings method
|
13
|
+
- display params as helpful info
|
14
|
+
|
6
15
|
## [3.3.2]
|
7
16
|
- Merge pull request #28 from netguru/master
|
8
17
|
- Fix one off task: ufo task
|
data/Gemfile.lock
CHANGED
@@ -9,6 +9,7 @@ PATH
|
|
9
9
|
aws-sdk-elasticloadbalancingv2
|
10
10
|
colorize
|
11
11
|
deep_merge
|
12
|
+
memoist
|
12
13
|
plissken
|
13
14
|
render_me_pretty
|
14
15
|
thor
|
@@ -16,16 +17,16 @@ PATH
|
|
16
17
|
GEM
|
17
18
|
remote: https://rubygems.org/
|
18
19
|
specs:
|
19
|
-
activesupport (5.
|
20
|
+
activesupport (5.2.0)
|
20
21
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
21
|
-
i18n (
|
22
|
+
i18n (>= 0.7, < 2)
|
22
23
|
minitest (~> 5.1)
|
23
24
|
tzinfo (~> 1.1)
|
24
|
-
aws-partitions (1.
|
25
|
+
aws-partitions (1.80.0)
|
25
26
|
aws-sdk-cloudwatchlogs (1.2.0)
|
26
27
|
aws-sdk-core (~> 3)
|
27
28
|
aws-sigv4 (~> 1.0)
|
28
|
-
aws-sdk-core (3.
|
29
|
+
aws-sdk-core (3.19.0)
|
29
30
|
aws-partitions (~> 1.0)
|
30
31
|
aws-sigv4 (~> 1.0)
|
31
32
|
jmespath (~> 1.0)
|
@@ -42,7 +43,7 @@ GEM
|
|
42
43
|
aws-sdk-core (~> 3)
|
43
44
|
aws-sigv4 (~> 1.0)
|
44
45
|
aws-sigv4 (1.0.2)
|
45
|
-
byebug (10.0.
|
46
|
+
byebug (10.0.2)
|
46
47
|
cli_markdown (0.1.0)
|
47
48
|
codeclimate-test-reporter (1.0.8)
|
48
49
|
simplecov (<= 0.13)
|
@@ -51,10 +52,11 @@ GEM
|
|
51
52
|
deep_merge (1.2.1)
|
52
53
|
diff-lcs (1.3)
|
53
54
|
docile (1.1.5)
|
54
|
-
i18n (0.
|
55
|
+
i18n (1.0.0)
|
55
56
|
concurrent-ruby (~> 1.0)
|
56
|
-
jmespath (1.
|
57
|
+
jmespath (1.4.0)
|
57
58
|
json (2.1.0)
|
59
|
+
memoist (0.16.0)
|
58
60
|
minitest (5.11.3)
|
59
61
|
plissken (1.2.0)
|
60
62
|
rake (12.3.1)
|
data/docs/README.md
CHANGED
@@ -14,8 +14,7 @@ For larger fixes, you can run the site locally with the following:
|
|
14
14
|
git clone https://github.com/tongueroo/ufo.git
|
15
15
|
cd ufo/docs
|
16
16
|
bundle
|
17
|
-
jekyll clean
|
18
|
-
jekyll serve
|
17
|
+
bin/web # runs jekyll clean and jekyll serve
|
19
18
|
```
|
20
19
|
|
21
20
|
You'll be able to view the site on [http://localhost:4000](http://localhost:4000).
|
@@ -0,0 +1,72 @@
|
|
1
|
+
---
|
2
|
+
title: Params
|
3
|
+
---
|
4
|
+
|
5
|
+
Additionally, the params that ufo sends to the [ruby aws-sdk](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/ECS/Client.html#run_task-instance_method) methods to create resources can be customized with a `params.yml` file. This allows you to customize the tool using the full power of the aws-sdk.
|
6
|
+
|
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
|
+
|
9
|
+
```yaml
|
10
|
+
<%
|
11
|
+
# replace with actual values:
|
12
|
+
@subnets = ["subnet-111","subnet-222"]
|
13
|
+
@security_groups = ["sg-111"]
|
14
|
+
%>
|
15
|
+
# These params are passsed to the corresponding aws-sdk ecs client methods.
|
16
|
+
# AWS Docs example: https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/ECS/Client.html#run_task-instance_method
|
17
|
+
#
|
18
|
+
# Comments left in as examples.
|
19
|
+
# Uncomment launch_type and network_configuration sections to enable fargate.
|
20
|
+
#
|
21
|
+
|
22
|
+
create_service:
|
23
|
+
deployment_configuration:
|
24
|
+
maximum_percent: 200
|
25
|
+
minimum_healthy_percent: 100
|
26
|
+
desired_count: 1
|
27
|
+
# launch_type: "FARGATE"
|
28
|
+
# network_configuration:
|
29
|
+
# awsvpc_configuration:
|
30
|
+
# subnets: <%= @subnets.inspect %> # required
|
31
|
+
# security_groups: <%= @security_groups.inspect %>
|
32
|
+
# assign_public_ip: "ENABLED" # accepts ENABLED, DISABLED
|
33
|
+
|
34
|
+
# update service is provide as an example below. Though it is probably better
|
35
|
+
# to not add any options to update_service if you are using the ECS console
|
36
|
+
# to update these settings often.
|
37
|
+
update_service:
|
38
|
+
# force_new_deployment: true
|
39
|
+
# deployment_configuration:
|
40
|
+
# maximum_percent: 200
|
41
|
+
# minimum_healthy_percent: 100
|
42
|
+
# desired_count: 1
|
43
|
+
# launch_type: "FARGATE"
|
44
|
+
# network_configuration:
|
45
|
+
# awsvpc_configuration:
|
46
|
+
# subnets: ["subnet-0ea22ddeb59d13ecc","subnet-0215e12250b7404e7"] # required
|
47
|
+
# security_groups: ["sg-0815f009d64fc4b2d"]
|
48
|
+
# assign_public_ip: "ENABLED" # accepts ENABLED, DISABLED
|
49
|
+
|
50
|
+
run_task:
|
51
|
+
# launch_type: "FARGATE"
|
52
|
+
# network_configuration:
|
53
|
+
# awsvpc_configuration:
|
54
|
+
# subnets: <%= @subnets.inspect %> # required
|
55
|
+
# security_groups: <%= @security_groups.inspect %>
|
56
|
+
# assign_public_ip: "ENABLED" # accepts ENABLED, DISABLED
|
57
|
+
```
|
58
|
+
|
59
|
+
Ufo provides 1st class citizen adjust to the params that get sent to the aws-sdk calls:
|
60
|
+
|
61
|
+
* create_service - `ufo ship` is calls this when the ECS service does not yet exist.
|
62
|
+
* update_service - `ufo ship` is calls this when the ECS service already exists.
|
63
|
+
* run_task - `ufo task` calls this.
|
64
|
+
|
65
|
+
The parameters from this `params.yml` file gets 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.
|
66
|
+
|
67
|
+
ERB and variables are available in the params file. Noticed how ERB is used at the top of the example file to set some subnets to prevent duplication.
|
68
|
+
|
69
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/settings.md %}">Back</a>
|
70
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/ufo-env.md %}">Next Step</a>
|
71
|
+
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
72
|
+
|
data/docs/_docs/settings.md
CHANGED
@@ -15,11 +15,6 @@ base:
|
|
15
15
|
image: tongueroo/hi
|
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
|
-
# defaults when an new ECS service is created by ufo ship
|
19
|
-
new_service:
|
20
|
-
maximum_percent: 200
|
21
|
-
minimum_healthy_percent: 100
|
22
|
-
desired_count: 1
|
23
18
|
|
24
19
|
development:
|
25
20
|
# cluster: dev # uncomment if you want the cluster name be other than the default
|
@@ -111,6 +106,6 @@ AWS_PROFILE=prod-profile => UFO_ENV=production
|
|
111
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.
|
112
107
|
|
113
108
|
<a id="prev" class="btn btn-basic" href="{% link _docs/structure.md %}">Back</a>
|
114
|
-
<a id="next" class="btn btn-primary" href="{% link _docs/
|
109
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/params.md %}">Next Step</a>
|
115
110
|
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
116
111
|
|
@@ -63,11 +63,6 @@ base:
|
|
63
63
|
# clean_keep: 30 # cleans up docker images on your docker server.
|
64
64
|
# ecr_keep: 30 # cleans up images on ECR and keeps this remaining amount. Defaults to keep all.
|
65
65
|
# defaults when an new ECS service is created by ufo ship
|
66
|
-
new_service:
|
67
|
-
maximum_percent: 200
|
68
|
-
minimum_healthy_percent: 100
|
69
|
-
desired_count: 1
|
70
|
-
|
71
66
|
development:
|
72
67
|
# cluster: dev # uncomment if you want the cluster name be other than the default
|
73
68
|
# the default is to match UFO_ENV. So UFO_ENV=development means the ECS
|
data/docs/_docs/ufo-env.md
CHANGED
@@ -51,6 +51,6 @@ AWS_PROFILE=whatever => UFO_ENV=development # since there are no profiles that m
|
|
51
51
|
|
52
52
|
Notice how `AWS_PROFILE=whatever` results in `UFO_ENV=development`. This is because there are no matching aws_profiles in the `settings.yml`. More info on settings is available at [settings]({% link _docs/settings.md %}).
|
53
53
|
|
54
|
-
<a id="prev" class="btn btn-basic" href="{% link _docs/
|
54
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/params.md %}">Back</a>
|
55
55
|
<a id="next" class="btn btn-primary" href="{% link _docs/variables.md %}">Next Step</a>
|
56
56
|
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
data/docs/_includes/subnav.html
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
<ul>
|
16
16
|
<li><a href="{% link _docs/structure.md %}">Structure</a></li>
|
17
17
|
<li><a href="{% link _docs/settings.md %}">Settings</a></li>
|
18
|
+
<li><a href="{% link _docs/params.md %}">Params</a></li>
|
18
19
|
<li><a href="{% link _docs/ufo-env.md %}">UFO_ENV</a></li>
|
19
20
|
<li><a href="{% link _docs/variables.md %}">Shared Variables</a></li>
|
20
21
|
<li><a href="{% link _docs/helpers.md %}">Helpers</a></li>
|
@@ -20,7 +20,15 @@ The above command does the following:
|
|
20
20
|
1. register the `.ufo/output/hi-web.json` task definition to ECS untouched.
|
21
21
|
2. deploys it to ECS by updating the service
|
22
22
|
|
23
|
-
|
23
|
+
### ufo tasks build
|
24
|
+
|
25
|
+
To regenerate a `.ufo/output/hi-web.json` definition:
|
26
|
+
|
27
|
+
ufo tasks build
|
28
|
+
|
29
|
+
### ufo ship
|
30
|
+
|
31
|
+
The `ufo deploy` command does less than the `ufo ship` command. Normally, it is recommended to use `ufo ship` over the `ufo deploy` command to do everything in one step:
|
24
32
|
|
25
33
|
1. build the Docker image
|
26
34
|
2. register the ECS task definition
|
data/docs/_reference/ufo-init.md
CHANGED
@@ -32,6 +32,12 @@ For this example we will use [tongueroo/hi](https://github.com/tongueroo/hi) whi
|
|
32
32
|
append .gitignore
|
33
33
|
Starter ufo files created.
|
34
34
|
|
35
|
+
## More Short Examples
|
36
|
+
|
37
|
+
ufo init --image httpd --app demo
|
38
|
+
ufo init --image 123456789012.dkr.ecr.us-west-2.amazonaws.com/myimage --app demo
|
39
|
+
ufo init --image tongueroo/hi --app hi --launch-type fargate --execution-role-arn arn:aws:iam::536766270177:role/ecsTaskExecutionRole
|
40
|
+
|
35
41
|
## Options: app and image
|
36
42
|
|
37
43
|
The `app` is that application name that you want to show up on the ECS dashboard. It is encouraged to have the app name be a single word.
|
@@ -59,6 +65,18 @@ The standard directory structure of the `.ufo` folder that was created looks lik
|
|
59
65
|
|
60
66
|
For a explanation of the folders and files refer to [Structure]({% link _docs/structure.md %}).
|
61
67
|
|
68
|
+
## Fargate Support
|
69
|
+
|
70
|
+
For ECS Fargate, the ECS task definition structure is a bit different. To initialize a project to support Fargate use the `--launch-type fargate` option. You'll be prompted for a execution role arn. This value gets added to the generated `.ufo/variables/base.rb` and used in the `.ufo/templates/main.json.erb`.
|
71
|
+
|
72
|
+
ufo init --image tongueroo/hi --app hi --force --launch-type fargate
|
73
|
+
|
74
|
+
You can also generate the init ufo files and bypass the prompt by providing the `----execution-role-arn` option upfront.
|
75
|
+
|
76
|
+
ufo init --image tongueroo/hi --app hi --force --launch-type fargate --execution-role-arn arn:aws:iam::536766270177:role/ecsTaskExecutionRole
|
77
|
+
|
78
|
+
Important: You will need to adjust adjust the generated `.ufo/params.yml` and set the subnet and security_group values which are required for Fargate.
|
79
|
+
|
62
80
|
## Custom Templates
|
63
81
|
|
64
82
|
If you would like the `ufo init` command to use your own custom templates, you can achieve this with the `--template` and `--template-mode` options. Example:
|
@@ -83,14 +101,17 @@ If you would like to use a local template that is not on GitHub, then created a
|
|
83
101
|
## Options
|
84
102
|
|
85
103
|
```
|
86
|
-
[--force]
|
87
|
-
--image=IMAGE
|
88
|
-
--app=APP
|
89
|
-
[--
|
90
|
-
|
91
|
-
[--
|
92
|
-
[--
|
93
|
-
[--
|
94
|
-
[--
|
104
|
+
[--force] # Bypass overwrite are you sure prompt for existing files.
|
105
|
+
--image=IMAGE # Docker image name without the tag. Example: tongueroo/hi. Configures ufo/settings.yml
|
106
|
+
--app=APP # App name. Preferably one word. Used in the generated ufo/task_definitions.rb.
|
107
|
+
[--launch-type=LAUNCH_TYPE] # ec2 or fargate.
|
108
|
+
# Default: ec2
|
109
|
+
[--execution-role-arn=EXECUTION_ROLE_ARN] # execution role arn used by tasks, required for fargate.
|
110
|
+
[--template=TEMPLATE] # Custom template to use.
|
111
|
+
[--template-mode=TEMPLATE_MODE] # Template mode: replace or additive.
|
112
|
+
[--verbose], [--no-verbose]
|
113
|
+
[--mute], [--no-mute]
|
114
|
+
[--noop], [--no-noop]
|
115
|
+
[--cluster=CLUSTER] # Cluster. Overrides ufo/settings.yml.
|
95
116
|
```
|
96
117
|
|
data/docs/_reference/ufo-task.md
CHANGED
@@ -13,25 +13,24 @@ Run a one-time task.
|
|
13
13
|
|
14
14
|
## Examples
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
ufo task hi-migrate
|
19
|
-
|
20
|
-
You can also override the command used by the Docker container in the task definitions via command.
|
16
|
+
You can use the `--command` or `-c` option to override the Docker container command.
|
21
17
|
|
18
|
+
ufo task hi-migrate # default command
|
22
19
|
ufo task hi-web --command bin/migrate
|
23
20
|
ufo task hi-web --command bin/with_env bundle exec rake db:migrate:redo VERSION=xxx
|
21
|
+
ufo task hi-web -c uptime
|
22
|
+
ufo task hi-web -c pwd
|
24
23
|
|
25
24
|
|
26
25
|
## Options
|
27
26
|
|
28
27
|
```
|
29
|
-
[--docker], [--no-docker] # Enable docker build and push
|
30
|
-
|
31
|
-
[--command=one two three]
|
32
|
-
[--verbose], [--no-verbose]
|
33
|
-
[--mute], [--no-mute]
|
34
|
-
[--noop], [--no-noop]
|
35
|
-
[--cluster=CLUSTER] # Cluster. Overrides ufo/settings.yml.
|
28
|
+
[--docker], [--no-docker] # Enable docker build and push
|
29
|
+
# Default: true
|
30
|
+
c, [--command=one two three] # Override the command used for the container
|
31
|
+
[--verbose], [--no-verbose]
|
32
|
+
[--mute], [--no-mute]
|
33
|
+
[--noop], [--no-noop]
|
34
|
+
[--cluster=CLUSTER] # Cluster. Overrides ufo/settings.yml.
|
36
35
|
```
|
37
36
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
title: ufo upgrade3_3_to_3_4
|
3
|
+
reference: true
|
4
|
+
---
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
ufo upgrade3_3_to_3_4
|
9
|
+
|
10
|
+
## Description
|
11
|
+
|
12
|
+
Upgrade from version 3.3 to 3.4
|
13
|
+
|
14
|
+
|
15
|
+
## Options
|
16
|
+
|
17
|
+
```
|
18
|
+
[--verbose], [--no-verbose]
|
19
|
+
[--mute], [--no-mute]
|
20
|
+
[--noop], [--no-noop]
|
21
|
+
[--cluster=CLUSTER] # Cluster. Overrides ufo/settings.yml.
|
22
|
+
```
|
23
|
+
|
data/docs/reference.md
CHANGED
@@ -15,4 +15,5 @@ title: CLI Reference
|
|
15
15
|
* [ufo task]({% link _reference/ufo-task.md %})
|
16
16
|
* [ufo tasks]({% link _reference/ufo-tasks.md %})
|
17
17
|
* [ufo upgrade3]({% link _reference/ufo-upgrade3.md %})
|
18
|
+
* [ufo upgrade3_3_to_3_4]({% link _reference/ufo-upgrade3_3_to_3_4.md %})
|
18
19
|
* [ufo version]({% link _reference/ufo-version.md %})
|
@@ -0,0 +1,65 @@
|
|
1
|
+
<%%
|
2
|
+
# replace with actual values:
|
3
|
+
@subnets = ["subnet-111","subnet-222"]
|
4
|
+
@security_groups = ["sg-111"]
|
5
|
+
%>
|
6
|
+
# These params are passsed to the corresponding aws-sdk ecs client methods.
|
7
|
+
# AWS Docs example: https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/ECS/Client.html#run_task-instance_method
|
8
|
+
#
|
9
|
+
# Comments left in as examples.
|
10
|
+
# Uncomment launch_type and network_configuration sections to enable fargate.
|
11
|
+
#
|
12
|
+
|
13
|
+
create_service:
|
14
|
+
deployment_configuration:
|
15
|
+
maximum_percent: 200
|
16
|
+
minimum_healthy_percent: 100
|
17
|
+
desired_count: 1
|
18
|
+
<% if @options[:launch_type] == "fargate" -%>
|
19
|
+
launch_type: "FARGATE"
|
20
|
+
network_configuration:
|
21
|
+
awsvpc_configuration:
|
22
|
+
subnets: <%%= @subnets.inspect %> # required
|
23
|
+
security_groups: <%%= @security_groups.inspect %>
|
24
|
+
assign_public_ip: "ENABLED" # accepts ENABLED, DISABLED
|
25
|
+
<% else -%>
|
26
|
+
# launch_type: "FARGATE"
|
27
|
+
# network_configuration:
|
28
|
+
# awsvpc_configuration:
|
29
|
+
# subnets: <%%= @subnets.inspect %> # required
|
30
|
+
# security_groups: <%%= @security_groups.inspect %>
|
31
|
+
# assign_public_ip: "ENABLED" # accepts ENABLED, DISABLED
|
32
|
+
<% end -%>
|
33
|
+
|
34
|
+
# update service is provide as an example below. Though it is probably better
|
35
|
+
# to not add any options to update_service if you are using the ECS console
|
36
|
+
# to update these settings often.
|
37
|
+
update_service:
|
38
|
+
# force_new_deployment: true
|
39
|
+
# deployment_configuration:
|
40
|
+
# maximum_percent: 200
|
41
|
+
# minimum_healthy_percent: 100
|
42
|
+
# desired_count: 1
|
43
|
+
# launch_type: "FARGATE"
|
44
|
+
# network_configuration:
|
45
|
+
# awsvpc_configuration:
|
46
|
+
# subnets: <%%= @subnets.inspect %> # required
|
47
|
+
# security_groups: <%%= @security_groups.inspect %>
|
48
|
+
# assign_public_ip: "ENABLED" # accepts ENABLED, DISABLED
|
49
|
+
|
50
|
+
run_task:
|
51
|
+
<% if @options[:launch_type] == "fargate" -%>
|
52
|
+
launch_type: "FARGATE"
|
53
|
+
network_configuration:
|
54
|
+
awsvpc_configuration:
|
55
|
+
subnets: <%%= @subnets.inspect %> # required
|
56
|
+
security_groups: <%%= @security_groups.inspect %>
|
57
|
+
assign_public_ip: "ENABLED" # accepts ENABLED, DISABLED
|
58
|
+
<% else -%>
|
59
|
+
# launch_type: "FARGATE"
|
60
|
+
# network_configuration:
|
61
|
+
# awsvpc_configuration:
|
62
|
+
# subnets: <%%= @subnets.inspect %> # required
|
63
|
+
# security_groups: <%%= @security_groups.inspect %>
|
64
|
+
# assign_public_ip: "ENABLED" # accepts ENABLED, DISABLED
|
65
|
+
<% end -%>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
{
|
2
|
+
"family": "<%= @family %>",
|
3
|
+
"requiresCompatibilities": ["FARGATE"],
|
4
|
+
"networkMode": "awsvpc",
|
5
|
+
"executionRoleArn": "<%= @execution_role_arn %>",
|
6
|
+
"cpu": "<%= @cpu %>",
|
7
|
+
"memory": "<%= @memory %>",
|
8
|
+
"containerDefinitions": [
|
9
|
+
{
|
10
|
+
"name": "<%= @name %>",
|
11
|
+
"image": "<%= @image %>",
|
12
|
+
<% if @container_port %>
|
13
|
+
"portMappings": [
|
14
|
+
{
|
15
|
+
"containerPort": "<%= @container_port %>",
|
16
|
+
"protocol": "tcp"
|
17
|
+
}
|
18
|
+
],
|
19
|
+
<% end %>
|
20
|
+
"command": <%= @command.to_json %>,
|
21
|
+
<% if @environment %>
|
22
|
+
"environment": <%= @environment.to_json %>,
|
23
|
+
<% end %>
|
24
|
+
<% if @awslogs_group %>
|
25
|
+
"logConfiguration": {
|
26
|
+
"logDriver": "awslogs",
|
27
|
+
"options": {
|
28
|
+
"awslogs-group": "<%= @awslogs_group %>",
|
29
|
+
"awslogs-region": "<%= @awslogs_region || 'us-east-1' %>",
|
30
|
+
"awslogs-stream-prefix": "<%= @awslogs_stream_prefix %>"
|
31
|
+
}
|
32
|
+
},
|
33
|
+
<% end %>
|
34
|
+
"essential": true
|
35
|
+
}
|
36
|
+
]
|
37
|
+
}
|