ufo 3.5.7 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/Gemfile.lock +16 -10
  4. data/README.md +12 -13
  5. data/docs/_config.yml +1 -1
  6. data/docs/_docs/auto-completion.md +4 -4
  7. data/docs/_docs/automated-cleanup.md +1 -1
  8. data/docs/_docs/conventions.md +7 -7
  9. data/docs/_docs/customize-cloudformation.md +36 -0
  10. data/docs/_docs/faq.md +9 -7
  11. data/docs/_docs/fargate.md +102 -0
  12. data/docs/_docs/helpers.md +3 -3
  13. data/docs/_docs/load-balancer.md +72 -0
  14. data/docs/_docs/migrations.md +2 -2
  15. data/docs/_docs/next-steps.md +2 -2
  16. data/docs/_docs/params.md +12 -41
  17. data/docs/_docs/route53-support.md +28 -0
  18. data/docs/_docs/run-in-pieces.md +2 -2
  19. data/docs/_docs/security-groups.md +54 -0
  20. data/docs/_docs/settings-cfn.md +11 -0
  21. data/docs/_docs/settings-network.md +34 -0
  22. data/docs/_docs/settings.md +18 -15
  23. data/docs/_docs/single-task.md +3 -3
  24. data/docs/_docs/ssl-support.md +42 -0
  25. data/docs/_docs/structure.md +5 -1
  26. data/docs/_docs/stuck-cloudformation.md +30 -0
  27. data/docs/_docs/tutorial-ufo-docker-build.md +19 -31
  28. data/docs/_docs/tutorial-ufo-init.md +16 -12
  29. data/docs/_docs/tutorial-ufo-ship.md +50 -54
  30. data/docs/_docs/tutorial-ufo-ships.md +9 -7
  31. data/docs/_docs/tutorial-ufo-tasks-build.md +26 -17
  32. data/docs/_docs/ufo-current.md +50 -0
  33. data/docs/_docs/ufo-env-extra.md +21 -0
  34. data/docs/_docs/ufo-env.md +6 -13
  35. data/docs/_docs/ufo-tasks-register.md +3 -3
  36. data/docs/_docs/upgrade4.md +49 -0
  37. data/docs/_docs/variables.md +5 -5
  38. data/docs/_docs/why-cloudformation.md +22 -0
  39. data/docs/_includes/about.html +1 -1
  40. data/docs/_includes/cfn-customize.md +39 -0
  41. data/docs/_includes/commands.html +6 -6
  42. data/docs/_includes/css/ufo.css +1 -0
  43. data/docs/_includes/example.html +13 -13
  44. data/docs/_includes/reference.md +1 -1
  45. data/docs/_includes/subnav.html +22 -5
  46. data/docs/_includes/ufo-ship-options.md +7 -6
  47. data/docs/_reference/ufo-apps.md +36 -0
  48. data/docs/_reference/ufo-cancel.md +24 -0
  49. data/docs/_reference/ufo-completion.md +1 -1
  50. data/docs/_reference/ufo-completion_script.md +1 -1
  51. data/docs/_reference/ufo-current.md +93 -0
  52. data/docs/_reference/ufo-deploy.md +18 -17
  53. data/docs/_reference/ufo-destroy.md +6 -4
  54. data/docs/_reference/ufo-docker-base.md +7 -7
  55. data/docs/_reference/ufo-docker-build.md +9 -9
  56. data/docs/_reference/ufo-docker-clean.md +8 -8
  57. data/docs/_reference/ufo-docker-name.md +4 -4
  58. data/docs/_reference/ufo-docker.md +4 -2
  59. data/docs/_reference/ufo-init.md +31 -20
  60. data/docs/_reference/ufo-network-help.md +15 -0
  61. data/docs/_reference/ufo-network-init.md +38 -0
  62. data/docs/_reference/ufo-network.md +26 -0
  63. data/docs/_reference/ufo-ps.md +53 -0
  64. data/docs/_reference/ufo-releases.md +40 -0
  65. data/docs/_reference/ufo-resources.md +44 -0
  66. data/docs/_reference/ufo-rollback.md +59 -0
  67. data/docs/_reference/ufo-scale.md +23 -3
  68. data/docs/_reference/ufo-ship.md +54 -27
  69. data/docs/_reference/ufo-ships.md +17 -26
  70. data/docs/_reference/ufo-stop.md +31 -0
  71. data/docs/_reference/ufo-task.md +15 -16
  72. data/docs/_reference/ufo-tasks-build.md +10 -10
  73. data/docs/_reference/ufo-tasks-register.md +3 -3
  74. data/docs/_reference/ufo-tasks.md +1 -1
  75. data/docs/_reference/ufo-upgrade-help.md +15 -0
  76. data/docs/_reference/ufo-upgrade-v2to3.md +15 -0
  77. data/docs/_reference/ufo-upgrade-v3_3to3_4.md +15 -0
  78. data/docs/_reference/ufo-upgrade-v3to4.md +27 -0
  79. data/docs/_reference/ufo-upgrade.md +28 -0
  80. data/docs/_reference/ufo-version.md +1 -1
  81. data/docs/articles.md +2 -2
  82. data/docs/docs.md +1 -1
  83. data/docs/img/docs/cloudformation-resources.png +0 -0
  84. data/docs/img/tutorials/ecs-console-task-definitions.png +0 -0
  85. data/docs/img/tutorials/ecs-console-ufo-ship.png +0 -0
  86. data/docs/img/tutorials/ecs-console-ufo-ships.png +0 -0
  87. data/docs/quick-start.md +21 -9
  88. data/docs/reference.md +10 -2
  89. data/exe/ufo +1 -1
  90. data/lib/cfn/stack.yml +259 -0
  91. data/lib/template/.ufo/params.yml.tt +21 -60
  92. data/lib/template/.ufo/settings.yml.tt +6 -1
  93. data/lib/template/.ufo/settings/cfn/default.yml.tt +55 -0
  94. data/lib/template/.ufo/settings/network/default.yml.tt +18 -0
  95. data/lib/template/.ufo/task_definitions.rb.tt +7 -6
  96. data/lib/template/.ufo/templates/fargate.json.erb +1 -1
  97. data/lib/template/.ufo/templates/main.json.erb +1 -0
  98. data/lib/template/.ufo/variables/base.rb.tt +5 -2
  99. data/lib/template/Dockerfile +10 -15
  100. data/lib/template/bin/deploy.tt +2 -2
  101. data/lib/ufo.rb +29 -20
  102. data/lib/ufo/apps.rb +49 -0
  103. data/lib/ufo/apps/cfn_map.rb +70 -0
  104. data/lib/ufo/apps/service.rb +56 -0
  105. data/lib/ufo/aws_service.rb +15 -6
  106. data/lib/ufo/base.rb +32 -0
  107. data/lib/ufo/cancel.rb +23 -0
  108. data/lib/ufo/cli.rb +91 -27
  109. data/lib/ufo/core.rb +35 -3
  110. data/lib/ufo/current.rb +104 -0
  111. data/lib/ufo/destroy.rb +10 -41
  112. data/lib/ufo/docker/builder.rb +5 -4
  113. data/lib/ufo/docker/cleaner.rb +1 -1
  114. data/lib/ufo/docker/pusher.rb +2 -2
  115. data/lib/ufo/ecr/cleaner.rb +1 -1
  116. data/lib/ufo/help/apps.md +12 -0
  117. data/lib/ufo/help/balancer.md +3 -0
  118. data/lib/ufo/help/current.md +65 -0
  119. data/lib/ufo/help/deploy.md +4 -4
  120. data/lib/ufo/help/destroy.md +3 -3
  121. data/lib/ufo/help/docker.md +3 -1
  122. data/lib/ufo/help/docker/base.md +7 -7
  123. data/lib/ufo/help/docker/build.md +9 -9
  124. data/lib/ufo/help/docker/clean.md +8 -8
  125. data/lib/ufo/help/docker/name.md +4 -4
  126. data/lib/ufo/help/help.md +5 -0
  127. data/lib/ufo/help/init.md +24 -16
  128. data/lib/ufo/help/network/init.md +13 -0
  129. data/lib/ufo/help/ps.md +27 -0
  130. data/lib/ufo/help/releases.md +16 -0
  131. data/lib/ufo/help/resources.md +20 -0
  132. data/lib/ufo/help/rollback.md +35 -0
  133. data/lib/ufo/help/scale.md +22 -2
  134. data/lib/ufo/help/ship.md +40 -14
  135. data/lib/ufo/help/ships.md +4 -13
  136. data/lib/ufo/help/stop.md +7 -0
  137. data/lib/ufo/help/task.md +9 -9
  138. data/lib/ufo/help/tasks/build.md +10 -10
  139. data/lib/ufo/help/tasks/register.md +3 -3
  140. data/lib/ufo/help/upgrade/v3to4.md +3 -0
  141. data/lib/ufo/info.rb +62 -0
  142. data/lib/ufo/init.rb +36 -23
  143. data/lib/ufo/log_group.rb +2 -1
  144. data/lib/ufo/network.rb +24 -0
  145. data/lib/ufo/network/fetch.rb +41 -0
  146. data/lib/ufo/network/helper.rb +23 -0
  147. data/lib/ufo/network/init.rb +26 -0
  148. data/lib/ufo/param.rb +5 -5
  149. data/lib/ufo/ps.rb +102 -0
  150. data/lib/ufo/ps/task.rb +78 -0
  151. data/lib/ufo/releases.rb +14 -0
  152. data/lib/ufo/rollback.rb +53 -0
  153. data/lib/ufo/scale.rb +6 -12
  154. data/lib/ufo/sequence.rb +7 -0
  155. data/lib/ufo/setting.rb +7 -6
  156. data/lib/ufo/setting/profile.rb +24 -0
  157. data/lib/ufo/ship.rb +35 -326
  158. data/lib/ufo/stack.rb +203 -0
  159. data/lib/ufo/stack/context.rb +242 -0
  160. data/lib/ufo/stack/helper.rb +28 -0
  161. data/lib/ufo/stack/status.rb +195 -0
  162. data/lib/ufo/stop.rb +47 -0
  163. data/lib/ufo/task.rb +96 -15
  164. data/lib/ufo/tasks/register.rb +1 -1
  165. data/lib/ufo/template_scope.rb +81 -7
  166. data/lib/ufo/upgrade.rb +32 -0
  167. data/lib/ufo/{upgrade3.rb → upgrade/upgrade3.rb} +1 -1
  168. data/lib/ufo/{upgrade33_to_34.rb → upgrade/upgrade33to34.rb} +2 -2
  169. data/lib/ufo/upgrade/upgrade4.rb +161 -0
  170. data/lib/ufo/util.rb +19 -6
  171. data/lib/ufo/version.rb +1 -1
  172. data/spec/fixtures/apps/describe_services.json +96 -0
  173. data/spec/fixtures/cfn/stack-events-complete.json +1080 -0
  174. data/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
  175. data/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
  176. data/spec/fixtures/deployments.json +50 -0
  177. data/spec/fixtures/ps/describe_tasks.json +58 -0
  178. data/spec/fixtures/settings.yml +2 -0
  179. data/spec/lib/apps_spec.rb +20 -0
  180. data/spec/lib/cli_spec.rb +4 -4
  181. data/spec/lib/ps_spec.rb +14 -0
  182. data/spec/lib/setting_spec.rb +2 -1
  183. data/spec/lib/ship_spec.rb +6 -30
  184. data/spec/lib/stack/status_spec.rb +76 -0
  185. data/spec/lib/stop_spec.rb +13 -0
  186. data/spec/lib/task_spec.rb +5 -2
  187. data/spec/spec_helper.rb +1 -1
  188. data/ufo.gemspec +2 -0
  189. metadata +120 -6
  190. data/docs/_reference/ufo-upgrade3.md +0 -23
  191. data/docs/_reference/ufo-upgrade3_3_to_3_4.md +0 -23
@@ -1,57 +1,26 @@
1
1
  module Ufo
2
- class Destroy
3
- include Util
4
- include AwsService
5
-
6
- def initialize(service, options={})
7
- @service = service
8
- @options = options
9
- @cluster = @options[:cluster] || default_cluster
10
- end
11
-
2
+ class Destroy < Base
12
3
  def bye
13
4
  unless are_you_sure?
14
5
  puts "Phew, that was close"
15
- exit
6
+ return
16
7
  end
17
8
 
18
- clusters = ecs.describe_clusters(clusters: [@cluster]).clusters
19
- if clusters.size < 1
20
- puts "The #{@cluster} cluster does not exist so there can be no service on that cluster to delete."
21
- exit
22
- end
23
-
24
- services = ecs.describe_services(cluster: @cluster, services: [@service]).services
25
- service = services.first
26
- if service.nil?
27
- puts "Unable to find #{@service} service to delete it."
28
- exit
29
- end
30
- if service.status != "ACTIVE"
31
- puts "The #{@service} service is not ACTIVE so no need to delete it."
9
+ stack = find_stack(@stack_name)
10
+ unless stack
11
+ puts "Stack #{@stack_name} does not exit"
32
12
  exit
33
13
  end
34
14
 
35
- # changes desired size to 0
36
- ecs.update_service(
37
- desired_count: 0,
38
- cluster: @cluster,
39
- service: @service
40
- )
41
- # Cannot find all tasks scoped to a service. Only scoped to a cluster.
42
- # So will not try to stop the tasks.
43
- # ask to stop them
44
- #
45
- resp = ecs.delete_service(
46
- cluster: @cluster,
47
- service: @service
48
- )
49
- puts "#{@service} service has been scaled down to 0 and destroyed." unless @options[:mute]
15
+ cloudformation.delete_stack(stack_name: @stack_name)
16
+ puts "Deleting CloudFormation stack with ECS resources: #{@stack_name}."
17
+ return unless @options[:wait]
18
+ status.wait
50
19
  end
51
20
 
52
21
  def are_you_sure?
53
22
  return true if @options[:sure]
54
- puts "You are about to destroy #{@service.colorize(:green)} service on the #{@cluster.colorize(:green)} cluster."
23
+ puts "You are about to destroy #{@pretty_service_name.colorize(:green)} service on the #{@cluster.colorize(:green)} cluster."
55
24
  print "Are you sure you want to do this? (y/n) "
56
25
  answer = $stdin.gets.strip
57
26
  answer =~ /^y/
@@ -41,7 +41,8 @@ class Ufo::Docker
41
41
  end
42
42
 
43
43
  took = Time.now - start_time
44
- say "Docker image #{full_image_name} built. " + "Took #{pretty_time(took)}.".green
44
+ say "Docker image #{full_image_name} built. "
45
+ say "Docker build took #{pretty_time(took)}.".green
45
46
  end
46
47
 
47
48
  def build_options
@@ -89,15 +90,15 @@ class Ufo::Docker
89
90
 
90
91
  # full_image - does not include the tag
91
92
  def image_name
92
- settings["image"]
93
+ settings[:image]
93
94
  end
94
95
 
95
96
  # full_image - Includes the tag. Examples:
96
97
  # 123456789.dkr.ecr.us-west-2.amazonaws.com/myapp:ufo-2018-04-20T09-29-08-b7d51df
97
- # tongueroo/hi:ufo-2018-04-20T09-29-08-b7d51df
98
+ # tongueroo/demo-ufo:ufo-2018-04-20T09-29-08-b7d51df
98
99
  def full_image_name
99
100
  return generate_name if @options[:generate]
100
- return "tongueroo/hi:ufo-12345678" if ENV['TEST']
101
+ return "tongueroo/demo-ufo:ufo-12345678" if ENV['TEST']
101
102
 
102
103
  unless File.exist?(docker_name_path)
103
104
  puts "Unable to find #{docker_name_path} which contains the last docker image name that was used as a part of `ufo docker build`. Please run `ufo docker build` first."
@@ -7,7 +7,7 @@ module Ufo
7
7
  # Example: 123456789.dkr.ecr.us-east-1.amazonaws.com/image
8
8
  @docker_image_name = docker_image_name
9
9
  @options = options
10
- @keep = options[:keep] || settings["clean_keep"] || 3
10
+ @keep = options[:keep] || settings[:clean_keep] || 3
11
11
  @tag_prefix = options[:tag_prefix] || "ufo"
12
12
  end
13
13
 
@@ -29,7 +29,7 @@ class Ufo::Docker
29
29
  end
30
30
  end
31
31
  took = Time.now - start_time
32
- message << " Took #{pretty_time(took)}.".green
32
+ message << "\nDocker push took #{pretty_time(took)}.".green
33
33
  puts message unless @options[:mute]
34
34
  end
35
35
 
@@ -45,7 +45,7 @@ class Ufo::Docker
45
45
 
46
46
  # full_image - does not include the tag
47
47
  def image_name
48
- settings["image"]
48
+ settings[:image]
49
49
  end
50
50
  end
51
51
  end
@@ -13,7 +13,7 @@ module Ufo
13
13
  # Example: 123456789.dkr.ecr.us-east-1.amazonaws.com/image
14
14
  @docker_image_name = docker_image_name
15
15
  @options = options
16
- @keep = options[:ecr_keep] || settings["ecr_keep"]
16
+ @keep = options[:ecr_keep] || settings[:ecr_keep]
17
17
  @tag_prefix = options[:tag_prefix] || "ufo"
18
18
  end
19
19
 
@@ -0,0 +1,12 @@
1
+ This command lists ECS services for an ECS cluster. It includes ECS services that were not created by ufo also. A `Ufo?` column value of `yes` indicates that the ECS service was created by ufo version 4 and above. If the service was created with ufo version 3 and below then it will show up as `no`.
2
+
3
+ ## Examples
4
+
5
+ $ ufo apps
6
+ Listing ECS services in the development cluster.
7
+ +--------------------------------------------------+-----------------+---------+-------------+------+
8
+ | Service Name | Task Definition | Running | Launch type | Ufo? |
9
+ +--------------------------------------------------+-----------------+---------+-------------+------+
10
+ | development-demo-web-Ecs-7GAUAXH5F56M (demo-web) | demo-web:85 | 2 | FARGATE | yes |
11
+ +--------------------------------------------------+-----------------+---------+-------------+------+
12
+ $
@@ -0,0 +1,3 @@
1
+ ## Examples
2
+
3
+ ufo network init
@@ -0,0 +1,65 @@
1
+ Sets a current service to remember so you do not have to provide the service name all the time. This shortens the commands
2
+
3
+ ufo ship demo-web # before
4
+ ufo current --service demo-web
5
+ ufo ship # after
6
+
7
+ The state information is written to `.ufo/current`.
8
+
9
+ ## Examples
10
+
11
+ ### summary
12
+
13
+ ufo current --service demo-web --env-extra 1
14
+ ufo current --service demo-web --env-extra 1 --services demo-web demo-worker
15
+ ufo current --service demo-web --env-extra ''
16
+ ufo current --service demo-web
17
+ ufo current --env-extra '1'
18
+
19
+ ### service
20
+
21
+ To set current service:
22
+
23
+ ufo current --service demo-web
24
+ ufo current --service demo-worker
25
+ ufo current --service demo-web
26
+
27
+ To view current service, run `ufo current` without any arguments.
28
+
29
+ $ ufo current
30
+ Current service: demo-web
31
+
32
+ To remove current service:
33
+
34
+ ufo current --service ''
35
+
36
+ ### env-extra
37
+
38
+ To also set a current `UFO_ENV_EXTRA`.
39
+
40
+ ufo current --env-extra 1
41
+
42
+ The extra env setting will be reflected:
43
+
44
+ $ ufo current
45
+ Current service: demo-web
46
+ Current env_extra: 1
47
+
48
+ The `UFO_ENV_EXTRA` variable takes higher precedence than the current setting in the saved file.
49
+
50
+ To unset:
51
+
52
+ ufo current --env-extra ''
53
+
54
+ ### services
55
+
56
+ The ufo ships command builds one docker image and deploys it to multiple ECS services. You can also have ufo remember what services to use with the current command.
57
+
58
+ ufo current --services demo-web demo-worker
59
+ ufo ships # will depoy to both demo-web and demo-worker
60
+
61
+ ### rm all
62
+
63
+ To remove all current settings use the `--rm` option.
64
+
65
+ ufo current --rm
@@ -1,15 +1,15 @@
1
- It is useful to sometimes deploy only the task definition without re-building it. Say for example, you are debugging the task definition and just want to directly edit the `.ufo/output/hi-web.json` definition. You can accomplish this with the `ufo deploy` command. The `ufo deploy` command will deploy the task definition in `.ufo/output` unmodified. Example:
1
+ It is useful to sometimes deploy only the task definition without re-building it. Say for example, you are debugging the task definition and just want to directly edit the `.ufo/output/demo-web.json` definition. You can accomplish this with the `ufo deploy` command. The `ufo deploy` command will deploy the task definition in `.ufo/output` unmodified. Example:
2
2
 
3
- ufo deploy hi-web
3
+ ufo deploy demo-web
4
4
 
5
5
  The above command does the following:
6
6
 
7
- 1. register the `.ufo/output/hi-web.json` task definition to ECS untouched.
7
+ 1. register the `.ufo/output/demo-web.json` task definition to ECS untouched.
8
8
  2. deploys it to ECS by updating the service
9
9
 
10
10
  ### ufo tasks build
11
11
 
12
- To regenerate a `.ufo/output/hi-web.json` definition:
12
+ To regenerate a `.ufo/output/demo-web.json` definition:
13
13
 
14
14
  ufo tasks build
15
15
 
@@ -1,9 +1,9 @@
1
1
  ## Examples
2
2
 
3
- Ufo provides a quick way to destroy an ECS service. To destroy an ECS service, you must make sure that the desired number of tasks is first set to 0. It is easy to forget to do this and waste time. So as part of destroying the service ufo will scale the ECS service down to 0 automatically first and then destroys the service. Ufo also prompts you before destroying the service.
3
+ Ufo provides a quick way to destroy an ECS service. This is effectively the same thing as deleting the CloudFormation stack.
4
4
 
5
- ufo destroy hi-web
5
+ ufo destroy demo-web
6
6
 
7
7
  If you would like to bypass the prompt, you can use the `--sure` option.
8
8
 
9
- ufo destroy hi-web --sure
9
+ ufo destroy demo-web --sure
@@ -1,4 +1,6 @@
1
1
  ## Examples
2
2
 
3
+ ufo docker base
3
4
  ufo docker build
4
- ufo docker tag
5
+ ufo docker name
6
+ ufo docker push
@@ -6,7 +6,7 @@ updates the FROM `Dockerfile` image with the generated image from `Dockerfile.ba
6
6
  ufo docker base
7
7
  ufo docker base --no-push # do not push the image to the registry
8
8
 
9
- Docker image `tongueroo/hi:base-2016-10-21T15-50-57-88071f5` built.
9
+ Docker image `tongueroo/demo-ufo:base-2016-10-21T15-50-57-88071f5` built.
10
10
 
11
11
  ## Concept
12
12
 
@@ -18,22 +18,22 @@ There are pros and cons of using this approach. Remember there are 2 hard probl
18
18
 
19
19
  ## Demo
20
20
 
21
- To demonstrate this command, there's a `docker-cache` branch in the [tongueroo/hi](https://github.com/tongueroo/hi/tree/docker-cache) repo.
21
+ To demonstrate this command, there's a `docker-cache` branch in the [tongueroo/demo-ufo](https://github.com/tongueroo/demo-ufo/tree/docker-cache) repo.
22
22
 
23
23
  Let's see the command in action:
24
24
 
25
25
  ufo docker base
26
26
  Building docker image with:
27
- docker build -t tongueroo/hi:base-2017-06-12T14-36-44-2af505e -f Dockerfile.base .
27
+ docker build -t tongueroo/demo-ufo:base-2017-06-12T14-36-44-2af505e -f Dockerfile.base .
28
28
  ...
29
- Pushed tongueroo/hi:base-2017-06-12T14-36-44-2af505e docker image. Took 28s.
29
+ Pushed tongueroo/demo-ufo:base-2017-06-12T14-36-44-2af505e docker image. Took 28s.
30
30
  The Dockerfile FROM statement has been updated with the latest base image:
31
- tongueroo/hi:base-2017-06-12T14-36-44-2af505e
31
+ tongueroo/demo-ufo:base-2017-06-12T14-36-44-2af505e
32
32
 
33
33
  Some of the output has been excluded so we can focus on the important parts to point out. First notice that the commmand simply shells out to the docker command and calls:
34
34
 
35
- docker build -t tongueroo/hi:base-2017-06-12T14-36-44-2af505e -f Dockerfile.base .
35
+ docker build -t tongueroo/demo-ufo:base-2017-06-12T14-36-44-2af505e -f Dockerfile.base .
36
36
 
37
- It is using the docker `-f Dockerfile.base` option to build the base image. It names the image with `tongueroo/hi:base-2017-06-12T14-36-44-2af505e`. The image tag contains useful information: the timestamp when the image was built and the exact git sha of the code. The image gets push to a registry immediately.
37
+ It is using the docker `-f Dockerfile.base` option to build the base image. It names the image with `tongueroo/demo-ufo:base-2017-06-12T14-36-44-2af505e`. The image tag contains useful information: the timestamp when the image was built and the exact git sha of the code. The image gets push to a registry immediately.
38
38
 
39
39
  Notice at the very end, the *current* `Dockerfile`'s FROM statement has been updated with the newly built base Docker image automatically. This saves you from forgetting to copying and pasting it the `Dockerfile` yourself.
@@ -1,16 +1,16 @@
1
- The `ufo docker build` builds a Docker image using the Dockerfile in the current project folder. This simply is a wrapper command that shells out and calls the `docker` command. We're use the [tongueroo/hi](https://github.com/tongueroo/hi) project and it's Dockerfile for demonstration. Example:
1
+ The `ufo docker build` builds a Docker image using the Dockerfile in the current project folder. This simply is a wrapper command that shells out and calls the `docker` command. We're use the [tongueroo/demo-ufo](https://github.com/tongueroo/demo-ufo) project and it's Dockerfile for demonstration. Example:
2
2
 
3
3
  ufo docker build
4
4
 
5
5
  You'll see that it calls:
6
6
 
7
- docker build -t tongueroo/hi:ufo-2017-06-11T22-18-03-a18aa30 -f Dockerfile .
7
+ docker build -t tongueroo/demo-ufo:ufo-2017-06-11T22-18-03-a18aa30 -f Dockerfile .
8
8
 
9
9
  You should see similar output (some of the output has been truncated for conciseness):
10
10
 
11
11
  $ ufo docker build
12
12
  Building docker image with:
13
- docker build -t tongueroo/hi:ufo-2017-06-11T22-18-03-a18aa30 -f Dockerfile .
13
+ docker build -t tongueroo/demo-ufo:ufo-2017-06-11T22-18-03-a18aa30 -f Dockerfile .
14
14
  Sending build context to Docker daemon 734.2 kB
15
15
  Step 1 : FROM ruby:2.3.3
16
16
  ---> 0e1db669d557
@@ -37,7 +37,7 @@ You should see similar output (some of the output has been truncated for concise
37
37
  ---> 8547bb48b21f
38
38
  Removing intermediate container b1b26e68d957
39
39
  Successfully built 8547bb48b21f
40
- Docker image tongueroo/hi:ufo-2017-06-11T22-18-03-a18aa30 built. Took 33s.
40
+ Docker image tongueroo/demo-ufo:ufo-2017-06-11T22-18-03-a18aa30 built. Took 33s.
41
41
  $
42
42
 
43
43
  The docker image tag that is generated contains a useful timestamp and the current HEAD git sha of the project that you are on.
@@ -48,14 +48,14 @@ By default when you are running `ufo docker build` directly it does not push the
48
48
 
49
49
  You should see it being pushed at the end:
50
50
 
51
- Docker image tongueroo/hi:ufo-2017-06-11T22-22-32-a18aa30 built. Took 34s.
52
- The push refers to a repository [docker.io/tongueroo/hi]
51
+ Docker image tongueroo/demo-ufo:ufo-2017-06-11T22-22-32-a18aa30 built. Took 34s.
52
+ The push refers to a repository [docker.io/tongueroo/demo-ufo]
53
53
  ef375857f165: Pushed
54
54
  4d791d7cde66: Pushed
55
55
  277ff31e79b4: Layer already exists
56
56
  a361a4de05df: Layer already exists
57
57
  ufo-2017-06-11T22-22-32-a18aa30: digest: sha256:c5385a5084e87643bd943eb120e110321c59e8acd30736ba7b5223eb1143baa8 size: 3464
58
- Pushed tongueroo/hi:ufo-2017-06-11T22-22-32-a18aa30 docker image. Took 9s.
58
+ Pushed tongueroo/demo-ufo:ufo-2017-06-11T22-22-32-a18aa30 docker image. Took 9s.
59
59
 
60
60
  Note in order to push the image to a registry you will need to login into the registry. If you are using DockerHub use the `docker login` command. If you are using AWS ECR then you can use the `aws ecr get-login` command.
61
61
 
@@ -65,6 +65,6 @@ You can specify docker build options with the `UFO_DOCKER_BUILD_OPTIONS` environ
65
65
 
66
66
  $ UFO_DOCKER_BUILD_OPTIONS="--build-arg RAILS_ENV=production" ufo docker build
67
67
  Building docker image with:
68
- docker build --build-arg RAILS_ENV=production -t tongueroo/hi:ufo-2018-05-19T11-52-16-6714713 -f Dockerfile .
68
+ docker build --build-arg RAILS_ENV=production -t tongueroo/demo-ufo:ufo-2018-05-19T11-52-16-6714713 -f Dockerfile .
69
69
  ...
70
- Docker image tongueroo/hi:ufo-2018-05-19T11-52-16-6714713 built. Took 2s.
70
+ Docker image tongueroo/demo-ufo:ufo-2018-05-19T11-52-16-6714713 built. Took 2s.
@@ -2,19 +2,19 @@ Ufo comes with a handy command to clean up old images that ufo generates. Ufo on
2
2
 
3
3
  Say you currently have these images:
4
4
 
5
- tongueroo/hi:ufo-2016-10-15T19-29-06-88071f5
6
- tongueroo/hi:ufo-2016-10-16T19-29-06-88071f5
7
- tongueroo/hi:ufo-2016-10-17T19-29-06-88071f5
8
- tongueroo/hi:ufo-2016-10-18T19-29-06-88071f5
5
+ tongueroo/demo-ufo:ufo-2016-10-15T19-29-06-88071f5
6
+ tongueroo/demo-ufo:ufo-2016-10-16T19-29-06-88071f5
7
+ tongueroo/demo-ufo:ufo-2016-10-17T19-29-06-88071f5
8
+ tongueroo/demo-ufo:ufo-2016-10-18T19-29-06-88071f5
9
9
 
10
10
  To clean them up and keep the 3 more recent:
11
11
 
12
- $ ufo docker clean tongueroo/hi
12
+ $ ufo docker clean tongueroo/demo-ufo
13
13
  Cleaning up docker images...
14
- Running: docker rmi tongueroo/hi:ufo-2016-10-15T19-29-06-88071f5
14
+ Running: docker rmi tongueroo/demo-ufo:ufo-2016-10-15T19-29-06-88071f5
15
15
 
16
- This will remove tongueroo/hi:ufo-2016-10-15T19-29-06-88071f5.
16
+ This will remove tongueroo/demo-ufo:ufo-2016-10-15T19-29-06-88071f5.
17
17
 
18
18
  By default the clean command keeps the most 3 recent docker images. If you would like to override this setting you can use the `--keep` option. Example:
19
19
 
20
- ufo docker clean tongueroo/hi --keep 5
20
+ ufo docker clean tongueroo/demo-ufo --keep 5
@@ -5,12 +5,12 @@ It is sometimes handy to grab the name of the Docker image that was just generat
5
5
  ufo docker build # stores the docker image name in the .ufo/data folder
6
6
  ufo docker name # fetches image name from .ufo/data folder
7
7
 
8
- An example image name would look something like this: `tongueroo/hi:ufo-2018-02-15T19-29-06-88071f5`
8
+ An example image name would look something like this: `tongueroo/demo-ufo:ufo-2018-02-15T19-29-06-88071f5`
9
9
 
10
10
  Note, the `.ufo/data` folder is an internal data folder and it's structure can change in future releases.
11
11
 
12
12
  If you want to generate a brand new name for whatever purpose, you can use the `--generate` flag. The generate does not write to the `.ufo/data` folder. It only generates a fresh name to stdout. If you run it multiple times, it will generate new names. You can notice this by seeing that the timestamp will always update:
13
13
 
14
- ufo docker name --generate # example: tongueroo/hi:ufo-2018-02-15T10-00-00-88071f5
15
- ufo docker name --generate # example: tongueroo/hi:ufo-2018-02-15T10-00-08-88071f5
16
- ufo docker name --generate # example: tongueroo/hi:ufo-2018-02-15T10-00-16-88071f5
14
+ ufo docker name --generate # example: tongueroo/demo-ufo:ufo-2018-02-15T10-00-00-88071f5
15
+ ufo docker name --generate # example: tongueroo/demo-ufo:ufo-2018-02-15T10-00-08-88071f5
16
+ ufo docker name --generate # example: tongueroo/demo-ufo:ufo-2018-02-15T10-00-16-88071f5
@@ -0,0 +1,5 @@
1
+ Displays process information about the service.
2
+
3
+ ## Examples
4
+
5
+ $ ufo ps demo-web
@@ -1,12 +1,15 @@
1
- The `ufo init` command provides a way to quickly setup a project to be ufo ready. It creates a ufo folder with all the starter supporting files in order to use ufo. This page demonstrates how to use `ufo init`. The command requires these options: `--app` and `--image`.
1
+ The `ufo init` command provides a way to quickly setup a project to be ufo ready. It creates a ufo folder with all the starter supporting files in order to use ufo. This page demonstrates how to use `ufo init`. The command requires the `--image` option. If the `--app` option is not provided, then it is inferred and set as the parent folder name. Example:
2
+
3
+ cd demo
4
+ ufo init --image tongueroo/demo-ufo # same as --app demo
2
5
 
3
6
  ## Examples
4
7
 
5
- For this example we will use [tongueroo/hi](https://github.com/tongueroo/hi) which is a small test sinatra app. Let's run the command in our newly clone project.
8
+ For this example we will use [tongueroo/demo-ufo](https://github.com/tongueroo/demo-ufo) which is a small test sinatra app. Let's run the command in our newly clone project.
6
9
 
7
- $ git clone https://github.com/tongueroo/hi.git
8
- $ cd hi
9
- $ ufo init --app=hi --image=tongueroo/hi
10
+ $ git clone https://github.com/tongueroo/demo-ufo.git
11
+ $ cd demo-ufo
12
+ $ ufo init --app=demo --image=tongueroo/demo-ufo
10
13
  Setting up ufo project...
11
14
  create .ufo/settings.yml
12
15
  create .ufo/task_definitions.rb
@@ -23,17 +26,20 @@ For this example we will use [tongueroo/hi](https://github.com/tongueroo/hi) whi
23
26
 
24
27
  ufo init --image httpd --app demo
25
28
  ufo init --image 123456789012.dkr.ecr.us-west-2.amazonaws.com/myimage --app demo
26
- ufo init --image tongueroo/hi --app hi --launch-type fargate --execution-role-arn arn:aws:iam::536766270177:role/ecsTaskExecutionRole
29
+ ufo init --image tongueroo/demo-ufo --app demo --launch-type fargate --execution-role-arn arn:aws:iam::123456789012:role/ecsTaskExecutionRole
30
+ ufo init --image httpd --app demo --vpc-id vpc-123
27
31
 
28
- ## Options: app and image
32
+ ## Important options
29
33
 
30
- 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.
34
+ 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. If the option is not provided, the app name is inferred and is the parent folder name.
31
35
 
32
36
  The `image` is the base portion of image name that will be pushed to the docker registry, ie: DockerHub or AWS ECR. The image should **not** include the tag since the tag is generated upon a `ufo ship`. For example:
33
37
 
34
- tongueroo/hi => tongueroo/hi:ufo-2018-02-08T21-04-02-3c86158
38
+ tongueroo/demo-ufo => tongueroo/demo-ufo:ufo-2018-02-08T21-04-02-3c86158
39
+
40
+ The generated `tongueroo/demo-ufo:ufo-2018-02-08T21-04-02-3c86158` image name gets pushed to the docker registry.
35
41
 
36
- The generated `tongueroo/hi:ufo-2018-02-08T21-04-02-3c86158` image name gets pushed to the docker registry.
42
+ The `--vpc-id` option is optional but very useful. If not specified then ufo will use the default vpc for the network settings like subnets and security groups, which might not be what you want.
37
43
 
38
44
  ## Directory Structure
39
45
 
@@ -56,30 +62,32 @@ For a explanation of the folders and files refer to [Structure]({% link _docs/st
56
62
 
57
63
  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`.
58
64
 
59
- ufo init --image tongueroo/hi --app hi --force --launch-type fargate
65
+ ufo init --image tongueroo/demo-ufo --app demo --force --launch-type fargate
60
66
 
61
67
  You can also generate the init ufo files and bypass the prompt by providing the `--execution-role-arn` option upfront.
62
68
 
63
- ufo init --image tongueroo/hi --app hi --force --launch-type fargate --execution-role-arn arn:aws:iam::536766270177:role/ecsTaskExecutionRole
69
+ ufo init --image tongueroo/demo-ufo --app demo --force --launch-type fargate --execution-role-arn arn:aws:iam::123456789012:role/ecsTaskExecutionRole
64
70
 
65
71
  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.
66
72
 
73
+ For more information and a demo of Fargate support, check out the [Fargate Docs]({% link _docs/fargate.md %}).
74
+
67
75
  ## Custom Templates
68
76
 
69
77
  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:
70
78
 
71
- ufo init --app=hi --image=tongueroo/hi --template=tongueroo/ufo-custom-template
79
+ ufo init --app=demo --image=tongueroo/demo-ufo --template=tongueroo/ufo-custom-template
72
80
 
73
81
  This will clone the repo on GitHub into the `~/.ufo/templates/tongueroo/ufo-custom-template` and use that as an additional template source. The default `--template-mode=additive` mode means that if there's a file in `tongueroo/ufo-custom-template` that exists it will use that in place of the default template files.
74
82
 
75
83
  If you do not want to use any of the original default template files within the ufo gem at all, you can use the `--template-mode=replace` mode. Replace mode will only use templates from the provided `--template` option. Example:
76
84
 
77
- ufo init --app=hi --image=tongueroo/hi --template=tongueroo/ufo-custom-template --template-mode=replace
85
+ ufo init --app=demo --image=tongueroo/demo-ufo --template=tongueroo/ufo-custom-template --template-mode=replace
78
86
 
79
87
  You can also specific the full GitHub url. Example:
80
88
 
81
- ufo init --app=hi --image=tongueroo/hi --template=https://github.com/tongueroo/ufo-custom-template
89
+ ufo init --app=demo --image=tongueroo/demo-ufo --template=https://github.com/tongueroo/ufo-custom-template
82
90
 
83
91
  If you would like to use a local template that is not on GitHub, then created a top-level folder in `~/.ufo/templates` without a subfolder. Example:
84
92
 
85
- ufo init --app=hi --image=tongueroo/hi --template=my-custom # uses ~/.ufo/templates/my-custom
93
+ ufo init --app=demo --image=tongueroo/demo-ufo --template=my-custom # uses ~/.ufo/templates/my-custom