ufo 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile.lock +7 -7
  4. data/docs/.gitignore +4 -0
  5. data/docs/CNAME +1 -0
  6. data/docs/Gemfile +3 -0
  7. data/docs/LICENSE +21 -0
  8. data/docs/README.md +21 -0
  9. data/docs/_config.yml +69 -0
  10. data/docs/_docs/commands.md +10 -0
  11. data/docs/_docs/conventions.md +45 -0
  12. data/docs/_docs/install.md +32 -0
  13. data/docs/_docs/next-steps.md +18 -0
  14. data/docs/_docs/structure.md +31 -0
  15. data/docs/_docs/tutorial-ufo-docker-build.md +68 -0
  16. data/docs/_docs/tutorial-ufo-init.md +34 -0
  17. data/docs/_docs/tutorial-ufo-ship.md +64 -0
  18. data/docs/_docs/tutorial-ufo-ships.md +28 -0
  19. data/docs/_docs/tutorial-ufo-tasks-build.md +166 -0
  20. data/docs/_docs/tutorial.md +15 -0
  21. data/docs/_docs/ufo-destroy.md +20 -0
  22. data/docs/_docs/ufo-docker-base.md +42 -0
  23. data/docs/_docs/ufo-docker-build.md +79 -0
  24. data/docs/_docs/ufo-docker-clean.md +27 -0
  25. data/docs/_docs/ufo-docker-name.md +15 -0
  26. data/docs/_docs/ufo-help.md +22 -0
  27. data/docs/_docs/ufo-init.md +37 -0
  28. data/docs/_docs/ufo-scale.md +22 -0
  29. data/docs/_docs/ufo-settings.md +57 -0
  30. data/docs/_docs/ufo-ship.md +75 -0
  31. data/docs/_docs/ufo-ships.md +52 -0
  32. data/docs/_docs/ufo-tasks-build.md +150 -0
  33. data/docs/_docs/ufo-tasks-register.md +26 -0
  34. data/docs/_includes/about.html +19 -0
  35. data/docs/_includes/commands.html +78 -0
  36. data/docs/_includes/contact.html +17 -0
  37. data/docs/_includes/contact_disqus.html +16 -0
  38. data/docs/_includes/contact_static.html +17 -0
  39. data/docs/_includes/content.html +21 -0
  40. data/docs/_includes/css/bootstrap.min.css +7 -0
  41. data/docs/_includes/css/main.css +481 -0
  42. data/docs/_includes/css/quotes.css +102 -0
  43. data/docs/_includes/css/syntax.css +60 -0
  44. data/docs/_includes/css/table.css +53 -0
  45. data/docs/_includes/css/timeline.css +201 -0
  46. data/docs/_includes/css/ufo.css +166 -0
  47. data/docs/_includes/edit-on-github.html +11 -0
  48. data/docs/_includes/example.html +80 -0
  49. data/docs/_includes/footer.html +48 -0
  50. data/docs/_includes/head.html +32 -0
  51. data/docs/_includes/header.html +15 -0
  52. data/docs/_includes/js.html +28 -0
  53. data/docs/_includes/js_disqus.html +21 -0
  54. data/docs/_includes/modals.html +40 -0
  55. data/docs/_includes/nav.html +27 -0
  56. data/docs/_includes/quotes.html +19 -0
  57. data/docs/_includes/subnav.html +40 -0
  58. data/docs/_includes/ufo-ship-options.md +13 -0
  59. data/docs/_includes/uses.html +19 -0
  60. data/docs/_layouts/default.html +11 -0
  61. data/docs/_layouts/style.css +6 -0
  62. data/docs/articles.md +8 -0
  63. data/docs/css/font-awesome/css/font-awesome.css +1566 -0
  64. data/docs/css/font-awesome/css/font-awesome.min.css +4 -0
  65. data/docs/css/font-awesome/fonts/FontAwesome.otf +0 -0
  66. data/docs/css/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  67. data/docs/css/font-awesome/fonts/fontawesome-webfont.svg +504 -0
  68. data/docs/css/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  69. data/docs/css/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  70. data/docs/docs.md +16 -0
  71. data/docs/img/logos/boltops-logo-full.png +0 -0
  72. data/docs/img/logos/boltops-logo.png +0 -0
  73. data/docs/img/tutorials/ecs-console-task-definitions.png +0 -0
  74. data/docs/img/tutorials/ecs-console-ufo-ship.png +0 -0
  75. data/docs/img/tutorials/ecs-console-ufo-ships.png +0 -0
  76. data/docs/img/tutorials/ufo-init.png +0 -0
  77. data/docs/img/tutorials/ufo-tasks-build.png +0 -0
  78. data/docs/img/ufo.jpg +0 -0
  79. data/docs/index.html +9 -0
  80. data/docs/js/bootstrap.js +2114 -0
  81. data/docs/js/bootstrap.min.js +6 -0
  82. data/docs/js/cbpAnimatedHeader.js +44 -0
  83. data/docs/js/cbpAnimatedHeader.min.js +11 -0
  84. data/docs/js/classie.js +80 -0
  85. data/docs/js/contact_me.js +70 -0
  86. data/docs/js/contact_me_static.js +23 -0
  87. data/docs/js/freelancer.js +37 -0
  88. data/docs/js/jqBootstrapValidation.js +912 -0
  89. data/docs/js/jquery-1.11.0.js +4 -0
  90. data/docs/js/jquery.easing.min.js +44 -0
  91. data/docs/js/nav.js +53 -0
  92. data/docs/quick-start.md +27 -0
  93. data/docs/style.css +3 -0
  94. data/lib/starter_project/ufo/settings.yml +3 -0
  95. data/lib/starter_project/ufo/task_definitions.rb +3 -3
  96. data/lib/ufo/cli.rb +5 -4
  97. data/lib/ufo/cli/help.rb +4 -4
  98. data/lib/ufo/docker.rb +6 -6
  99. data/lib/ufo/docker/cleaner.rb +2 -1
  100. data/lib/ufo/docker/help.rb +4 -4
  101. data/lib/ufo/ship.rb +2 -2
  102. data/lib/ufo/version.rb +1 -1
  103. data/spec/lib/cli_spec.rb +1 -1
  104. data/spec/spec_helper.rb +1 -1
  105. metadata +92 -2
@@ -0,0 +1,22 @@
1
+ ---
2
+ title: ufo scale
3
+ ---
4
+
5
+ Ufo provides a command to quickly scale up and down an ECS service. Here's an example of how you use it:
6
+
7
+ ```sh
8
+ ufo scale hi-web-stag 3
9
+ ```
10
+
11
+ You should get output similiar to below:
12
+
13
+ ```sh
14
+ Scale hi-web-stag service in stag cluster to 3
15
+ ```
16
+
17
+ 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.
18
+
19
+ <a id="prev" class="btn btn-basic" href="{% link _docs/ufo-ships.md %}">Back</a>
20
+ <a id="next" class="btn btn-primary" href="{% link _docs/ufo-destroy.md %}">Next Step</a>
21
+ <p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
22
+
@@ -0,0 +1,57 @@
1
+ ---
2
+ title: Settings
3
+ ---
4
+
5
+ The behavior of ufo can be configured via the `ufo/settings.yml` file. A starter `settings.yml` file is generated as part of the `ufo init` command. A lot of these settings are default options so you do not have to type out these options repeatedly for some of the ufo commands. Let's cover the available settings in an example `settings.yml` that we've modified:
6
+
7
+ ```yaml
8
+ image: tongueroo/hi
9
+ clean_keep: 30
10
+ ecr_keep: 30
11
+ service_cluster:
12
+ default: stag # default cluster
13
+ hi-web-stag: stag
14
+ hi-clock-stag: blue
15
+ hi-worker-stag: anothercluster
16
+ ```
17
+
18
+ ### Docker image name
19
+
20
+ 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. For example, `tongueroo/hi` is correct and `tongueroo/hi:my-tag` is incorrect.
21
+
22
+ ### ECS Cluster for Service
23
+
24
+ The `service_cluster` mapping provides a way to set default "service-to-cluster" mappings so that you do not have to specify the `--cluster` repeatedly. This is very helpful. For example:
25
+
26
+ ```sh
27
+ ufo ship hi-web-stag --cluster stag
28
+ ufo ship hi-web-stag # same as above because it is configured in ufo/settings.yml
29
+ ufo ship hi-web-stag --cluster special-cluster # overrides the default setting in `ufo/settings.yml`
30
+ ```
31
+
32
+ Also, with this `settings.yml`:
33
+
34
+ ```sh
35
+ ufo ship hi-clock-stag # deploys to the ECS cluster named blue
36
+ ```
37
+
38
+ ### ECR Cleanup
39
+
40
+ Ufo can be configured to automatically clean old images from the ECR registry after the deploy completes.
41
+
42
+ ```yaml
43
+ ecr_keep: 30
44
+ ```
45
+
46
+ ### Docker Cleanup
47
+
48
+ Ufo can be configured to automatically clean old Docker images.
49
+
50
+ ```yaml
51
+ docker_keep: 30
52
+ ```
53
+
54
+ <a id="prev" class="btn btn-basic" href="{% link _docs/ufo-help.md %}">Back</a>
55
+ <a id="next" class="btn btn-primary" href="{% link _docs/conventions.md %}">Next Step</a>
56
+ <p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
57
+
@@ -0,0 +1,75 @@
1
+ ---
2
+ title: ufo ship
3
+ ---
4
+
5
+ The main command you use when using ufo is: `ufo ship`. This command builds the docker image, registers the generated ECS task definition and deploys the definition to AWS ECS all in one go.
6
+
7
+ The command has a decent amount of options, you can see the options available with `ufo ship -h`. The table below covers some of the options in detail:
8
+
9
+ {% include ufo-ship-options.md %}
10
+
11
+ As you can see there are plenty of options for `ufo ship`. Let's demonstrate usage of them in a few examples:
12
+
13
+ #### Load Balancer Target Group
14
+
15
+ When you are deploying to a service with the word 'web' in it, ufo by convention assumes that this is a web service that uses a load balancer in front of it. This is also covered a in the [Conventions]({% link _docs/conventions.md %}) page. If you would you like to create a service with the word web without an load balancer associated with it you can use the `--no-target-group-prompt` option:
16
+
17
+ ```sh
18
+ ufo ship hi-web-stag --no-target-group-prompt
19
+ ```
20
+
21
+ Or if you would like specify the target-group up front and not be bother with the prompted later you can use the `--target-group` option.
22
+
23
+ ```sh
24
+ ufo ship hi-web-stag --target-group=arn:aws:elasticloadbalancing:us-east-1:12345689:targetgroup/hi-web-prod/12345
25
+ ```
26
+
27
+ #### Deploying Existing Task Definition
28
+
29
+ Let's say you already have built an registered a task definition by some other means and only want to use ufo to deploy that already registered task definition. You can do this by skipping the task build and register phase. It probably also makes sense to skip the docker phase in this case.
30
+
31
+ ```sh
32
+ ufo ship hi-web-stag --no-docker --no-tasks
33
+ ```
34
+
35
+ #### Waiting for Deployments to Complete
36
+
37
+ 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
38
+
39
+ ```sh
40
+ ufo ship hi-web-stag --wait
41
+ ```
42
+
43
+ You should see output similar to this:
44
+
45
+ ```sh
46
+ Shipping hi-web-stag...
47
+ hi-web-stag service updated on stag cluster with task hi-web-stag
48
+ Waiting for deployment of task definition hi-web-stag:8 to complete
49
+ ......
50
+ Time waiting for ECS deployment: 31s.
51
+ Software shipped!
52
+ ```
53
+
54
+ #### Cleaning up Docker Images Automatically
55
+
56
+ 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.
57
+
58
+ ```sh
59
+ docker ship hi-web-stag --ecr-keep 2
60
+ ```
61
+
62
+ You should see something like this:
63
+
64
+ ```sh
65
+ Cleaning up docker images...
66
+ Running: docker rmi tongueroo/hi:ufo-2017-06-12T06-46-12-a18aa30
67
+ ```
68
+
69
+ If you are using DockerHub or another registry, ufo does not automatically clean up images.
70
+
71
+
72
+ <a id="prev" class="btn btn-basic" href="{% link _docs/ufo-init.md %}">Back</a>
73
+ <a id="next" class="btn btn-primary" href="{% link _docs/ufo-ships.md %}">Next Step</a>
74
+ <p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
75
+
@@ -0,0 +1,52 @@
1
+ ---
2
+ title: ufo ships
3
+ ---
4
+
5
+ The `ufo ships` command allows you to deploy the *same* Docker image and task definition to multiple ECS services. This is a very common pattern to have the same code base running on different roles. For example, say you have an app with 3 roles:
6
+
7
+ 1. web - serves web requests.
8
+ 2. worker - processes background jobs.
9
+ 3. clock - schedules background jobs.
10
+
11
+ Instead of using the [ufo ship]({% link _docs/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:
12
+
13
+ ```sh
14
+ ufo ships hi-web-stag hi-worker-stag hi-clock-stag
15
+ ```
16
+
17
+ ### Shell expansion
18
+
19
+ Since the ECS service names are provided as a list you can shorten the command by using bash shell expansion 😁
20
+
21
+ ```sh
22
+ ufo ships hi-{web,worker,clock}-stag
23
+ ```
24
+
25
+ If you're new to shell expansion, run this to understand why above works just as well:
26
+
27
+ ```sh
28
+ $ echo hi-{web,worker,clock}-stag
29
+ hi-web-stag hi-worker-stag hi-clock-stag
30
+ ```
31
+
32
+ ### Overriding convention
33
+
34
+ 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:
35
+
36
+ ```sh
37
+ ufo ships hi-web-prod-1:hi-web-prod hi-clock-prod-1 hi-worker-prod-1
38
+ ufo ships hi-web-prod-1:my-task hi-clock-prod-1:another-task hi-worker-prod-1:third-task
39
+ ```
40
+
41
+ ### ufo ships Options
42
+
43
+ The `ufo ships` and `ufo ship` command support the same options. The options are presented here again for convenience:
44
+
45
+ {% include ufo-ship-options.md %}
46
+
47
+ Note: The `--task` option is not used with the `ufo ships` command.
48
+
49
+ <a id="prev" class="btn btn-basic" href="{% link _docs/ufo-ship.md %}">Back</a>
50
+ <a id="next" class="btn btn-primary" href="{% link _docs/ufo-scale.md %}">Next Step</a>
51
+ <p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
52
+
@@ -0,0 +1,150 @@
1
+ ---
2
+ title: ufo tasks build
3
+ ---
4
+
5
+ The command `ufo tasks build` generates the task definitions locally and writes them to the `output/` folder. There are 2 files that it uses in order to produce the raw AWS task definitions files.
6
+
7
+ 1. ufo/templates/main.json.erb
8
+ 2. ufo/task_definitions.rb
9
+
10
+ Here's an example of each of them:
11
+
12
+ **main.json.erb**:
13
+
14
+ ```json
15
+ {
16
+ "family": "<%= @family %>",
17
+ "containerDefinitions": [
18
+ {
19
+ "name": "<%= @name %>",
20
+ "image": "<%= @image %>",
21
+ "cpu": <%= @cpu %>,
22
+ <% if @memory %>
23
+ "memory": <%= @memory %>,
24
+ <% end %>
25
+ <% if @memory_reservation %>
26
+ "memoryReservation": <%= @memory_reservation %>,
27
+ <% end %>
28
+ <% if @container_port %>
29
+ "portMappings": [
30
+ {
31
+ "containerPort": "<%= @container_port %>",
32
+ "protocol": "tcp"
33
+ }
34
+ ],
35
+ <% end %>
36
+ "command": <%= @command.to_json %>,
37
+ <% if @environment %>
38
+ "environment": <%= @environment.to_json %>,
39
+ <% end %>
40
+ <% if @awslogs_group %>
41
+ "logConfiguration": {
42
+ "logDriver": "awslogs",
43
+ "options": {
44
+ "awslogs-group": "<%= @awslogs_group %>",
45
+ "awslogs-region": "<%= @awslogs_region || 'us-east-1' %>",
46
+ "awslogs-stream-prefix": "<%= @awslogs_stream_prefix %>"
47
+ }
48
+ },
49
+ <% end %>
50
+ "essential": true
51
+ }
52
+ ]
53
+ }
54
+ ```
55
+
56
+ **task_definitions.rb**:
57
+
58
+ ```
59
+ # common variables
60
+ common = {
61
+ image: helper.full_image_name, # includes the git sha tongueroo/hi:ufo-[sha].
62
+ cpu: 128,
63
+ memory_reservation: 256,
64
+ environment: helper.env_file(".env")
65
+ # another example
66
+ # environment: helper.env_vars(%Q{
67
+ # RAILS_ENV=production
68
+ # SECRET_KEY_BASE=secret
69
+ # })
70
+ }
71
+
72
+ task_definition "hi-web-stag" do
73
+ source "main" # will use ufo/templates/main.json.erb
74
+ variables(common.dup.deep_merge(
75
+ family: task_definition_name,
76
+ name: "web",
77
+ container_port: helper.dockerfile_port,
78
+ command: ["bin/web"]
79
+ ))
80
+ end
81
+
82
+ task_definition "hi-worker-stag" do
83
+ source "main" # will use ufo/templates/main.json.erb
84
+ variables(common.dup.deep_merge(
85
+ family: task_definition_name,
86
+ name: "worker",
87
+ command: ["bin/worker"]
88
+ ))
89
+ end
90
+
91
+ task_definition "hi-clock-stag" do
92
+ source "main" # will use ufo/templates/main.json.erb
93
+ variables(common.dup.deep_merge(
94
+ family: task_definition_name,
95
+ name: "clock",
96
+ command: ["bin/clock"]
97
+ ))
98
+ end
99
+ ```
100
+
101
+ Ufo uses the ERB template in `main.json.erb` and combines it with the variables defined in the task definition declarations in `task_definitions.rb` and generates the raw AWS formatted task definition in the `output` folder. In this case there are 3 task_definitions so there will be 3 generated output files.
102
+
103
+ To build the task definitions:
104
+
105
+ ```sh
106
+ ufo tasks build
107
+ ```
108
+
109
+ You should see output similar to below:
110
+
111
+ <img src="/img/tutorials/ufo-tasks-build.png" class="doc-photo" />
112
+
113
+ Let's take a look at one of the generated files: `ufo/output/hi-web-stag.json`.
114
+
115
+ ```json
116
+ {
117
+ "family": "hi-web-stag",
118
+ "containerDefinitions": [
119
+ {
120
+ "name": "web",
121
+ "image": "tongueroo/hi:ufo-2017-06-11T22-22-32-a18aa30",
122
+ "cpu": 128,
123
+ "memoryReservation": 256,
124
+ "portMappings": [
125
+ {
126
+ "containerPort": "3000",
127
+ "protocol": "tcp"
128
+ }
129
+ ],
130
+ "command": [
131
+ "bin/web"
132
+ ],
133
+ "environment": [
134
+ {
135
+ "name": "RAILS_ENV",
136
+ "value": "staging"
137
+ }
138
+ ],
139
+ "essential": true
140
+ }
141
+ ]
142
+ }
143
+ ```
144
+
145
+ If you need to modify the task definition template to suite your own needs it is super simple, just edit `main.json.erb`. No need to dive deep into internal code that builds up the task definition with some internal structure. It is all there for you to fully control.
146
+
147
+ <a id="prev" class="btn btn-basic" href="{% link _docs/ufo-docker-clean.md %}">Back</a>
148
+ <a id="next" class="btn btn-primary" href="{% link _docs/ufo-tasks-register.md %}">Next Step</a>
149
+ <p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
150
+
@@ -0,0 +1,26 @@
1
+ ---
2
+ title: ufo tasks register
3
+ ---
4
+
5
+ The `ufo tasks register` command registers all the generated task definitions in `output/` to AWS ECS. Let's run it:
6
+
7
+ ```sh
8
+ ufo ecs register
9
+ ```
10
+
11
+ You should see something similiar to this:
12
+
13
+ ```sh
14
+ hi-clock-stag task definition registered.
15
+ hi-web-stag task definition registered.
16
+ hi-worker-stag task definition registered.
17
+ ```
18
+
19
+ 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:
20
+
21
+ <img src="/img/tutorials/ecs-console-task-definitions.png" class="doc-photo" />
22
+
23
+ <a id="prev" class="btn btn-basic" href="{% link _docs/ufo-tasks-build.md %}">Back</a>
24
+ <a id="next" class="btn btn-primary" href="{% link _docs/ufo-help.md %}">Next Step</a>
25
+ <p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
26
+
@@ -0,0 +1,19 @@
1
+ <!-- About Section -->
2
+ <section class="success" id="about">
3
+ <div class="container">
4
+ <div class="row">
5
+ <div class="col-lg-12 text-center">
6
+ <h2>About</h2>
7
+ <hr class="star-light">
8
+ </div>
9
+ </div>
10
+ <div class="row">
11
+ <div class="col-lg-4 col-lg-offset-2">
12
+ <p>Ufo is a tool that makes building and shipping Docker containers to AWS ECS super easy. At a basic level, ufo builds the docker container image, registers that image to ECS as a task definition, and then deploys that task definition to ECS by updating the service. Ufo provides a `ufo ship` command that deploys your code to ECS.</p>
13
+ </div>
14
+ <div class="col-lg-4">
15
+ <p>Ufo was built directly from real life production use cases after seeing the same patterns repeated over and over. Ufo allows you to write the AWS task definition json format file in ERB, an easy templating language. This allows you to reuse the ufo tool with multiple applications and only put the truly application specific business logic in each app code base.</p>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ </section>
@@ -0,0 +1,78 @@
1
+ <!-- About Section -->
2
+ <section id="about">
3
+ <div class="container">
4
+ <div class="row">
5
+ <div class="col-lg-12 text-center">
6
+ <h2>Commands</h2>
7
+ <hr class="star-primary">
8
+ </div>
9
+ </div>
10
+ <div class="row">
11
+ <div class="col-lg-8 col-lg-offset-2">
12
+ <div class="commands">
13
+ {% highlight sh %}
14
+ ufo ship
15
+
16
+ ufo docker build
17
+
18
+ ufo tasks build
19
+
20
+ ufo scale
21
+
22
+ ufo destroy
23
+ {% endhighlight %}
24
+ </div>
25
+ </div>
26
+ </div>
27
+ <div class="row">
28
+ <div class="col-lg-6">
29
+ <h3>ufo/templates/main.json.erb</h3>
30
+ <div class="commands">
31
+ {% highlight json %}
32
+ {
33
+ "family": "<%= @family %>",
34
+ "containerDefinitions": [
35
+ {
36
+ "name": "<%= @name %>",
37
+ "image": "<%= @image %>",
38
+ "cpu": <%= @cpu %>,
39
+ <% end %>
40
+ "command": <%= @command.to_json %>,
41
+ <% if @environment %>
42
+ "environment": <%= @environment.to_json %>,
43
+ <% end %>
44
+ "essential": true
45
+ }
46
+ ]
47
+ }
48
+ {% endhighlight %}
49
+ </div>
50
+ </div>
51
+ <div class="col-lg-6">
52
+ <h3>ufo/template_definitions.rb</h3>
53
+ <div class="commands">
54
+ {% highlight ruby %}
55
+ common = {
56
+ image: helper.full_image_name,
57
+ cpu: 128,
58
+ memory_reservation: 256,
59
+ environment: helper.env_vars("RAILS_ENV=production"),
60
+ container_port: helper.dockerfile_port,
61
+ }
62
+
63
+ task_definition "example-web" do
64
+ source "main"
65
+ variables(common.dup.deep_merge(
66
+ family: task_definition_name,
67
+ name: "web",
68
+ awslogs_group: "example-web",
69
+ awslogs_stream_prefix: "example",
70
+ command: ["bin/web"]
71
+ ))
72
+ end
73
+ {% endhighlight %}
74
+ </div>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ </section>