ufo 1.6.2 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 719240a41b0030380ceb747403c3fb272120a9be
4
- data.tar.gz: 8238a183e5602cc44f7681091a9bb823541f3ec5
3
+ metadata.gz: 2849f6fd26333671d12f542633c7a27819560d31
4
+ data.tar.gz: 5d9ae17fa3c35972c2a739cddc7020d82e9ff4c9
5
5
  SHA512:
6
- metadata.gz: 5aa712d256743f80d959653230cfc4f5542ff98aa315ea33012c4e93ac4810206dee120ac39c9c4b26c5ce0957e5d6126915813d46e153405d36684c8004d003
7
- data.tar.gz: 9e4707e07e52225a45f378a8f358d8033de2b39298b1014d03ebbd2b941ee157789ab28c8286dea1b77994e71a6f7dffb1ca4db5c974113443649080cc016f91
6
+ metadata.gz: 6d0cfef955d9f13cd416b94d9110fd45d6a9ec5e916bfc021c1f85efe94a3ac37068b9736c28526e681fc124dbd26b4c69fe0a26eb6b5c60f95f585cb2781cb0
7
+ data.tar.gz: e6c0e2c981e36b99b69e72273c1ea2ca2104651db6800013d36eca85324f1463327b0a4ca52015d98867b6f384b261710b9f01e912edb3649c3f71fce8702368
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [1.7.0]
7
+ * automatically create task definintion log group
8
+
9
+ ## [1.6.3]
10
+ * fix target_group_prompt
11
+
6
12
  ## [1.6.2]
7
13
  * update bin/deploy starter project script
8
14
  * update help menu
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ufo (1.5.0)
4
+ ufo (1.7.0)
5
5
  aws-sdk
6
6
  colorize
7
7
  deep_merge
@@ -20,14 +20,14 @@ GEM
20
20
  minitest (~> 5.1)
21
21
  thread_safe (~> 0.3, >= 0.3.4)
22
22
  tzinfo (~> 1.1)
23
- aws-sdk (2.9.37)
24
- aws-sdk-resources (= 2.9.37)
25
- aws-sdk-core (2.9.37)
23
+ aws-sdk (2.10.21)
24
+ aws-sdk-resources (= 2.10.21)
25
+ aws-sdk-core (2.10.21)
26
26
  aws-sigv4 (~> 1.0)
27
27
  jmespath (~> 1.0)
28
- aws-sdk-resources (2.9.37)
29
- aws-sdk-core (= 2.9.37)
30
- aws-sigv4 (1.0.0)
28
+ aws-sdk-resources (2.10.21)
29
+ aws-sdk-core (= 2.10.21)
30
+ aws-sigv4 (1.0.1)
31
31
  builder (3.2.3)
32
32
  byebug (9.0.6)
33
33
  codeclimate-test-reporter (1.0.8)
@@ -37,10 +37,10 @@ GEM
37
37
  diff-lcs (1.3)
38
38
  docile (1.1.5)
39
39
  hashie (3.5.5)
40
- i18n (0.8.4)
40
+ i18n (0.8.6)
41
41
  jmespath (1.3.1)
42
42
  json (2.1.0)
43
- minitest (5.10.2)
43
+ minitest (5.10.3)
44
44
  plissken (0.3.0)
45
45
  symbolize (~> 4.2)
46
46
  rake (12.0.0)
data/README.md CHANGED
@@ -1,6 +1,12 @@
1
+ <div align="center">
2
+ <img src="http://ufoships.com/img/logos/ufo-logo.png" />
3
+ </div>
4
+
1
5
  # Ufo - Easy Way to Build and Ship Docker to AWS ECS
2
6
 
3
7
  [![CircleCI](https://circleci.com/gh/tongueroo/ufo.svg?style=svg)](https://circleci.com/gh/tongueroo/ufo)
8
+ [![Join the chat at https://gitter.im/tongueroo/ufo](https://badges.gitter.im/tongueroo/ufo.svg)](https://gitter.im/tongueroo/ufo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
9
+ [![Support](https://img.shields.io/badge/get-support-blue.svg)](https://boltops.com?utm_source=badge&utm_medium=badge&utm_campaign=ufo)
4
10
 
5
11
  Ufo is a tool that makes building and shipping Docker images to [AWS ECS](https://aws.amazon.com/ecs/) super easy.
6
12
 
data/docs/_config.yml CHANGED
@@ -2,13 +2,14 @@
2
2
  title: Ufo
3
3
  email: tongueroo@gmail.com
4
4
  url: http://ufoships.com
5
- description: "An Easy Way to Build and Ship Docker Images to AWS ECS"
5
+ description: "Easy Way to Build and Ship Docker Images to AWS ECS"
6
6
  keywords: "AWS EC2 Container Service, AWS ECS, UFO, Deploy to ECS, ufo ship"
7
7
  skills: ""
8
8
  meta_author: Tung Nguyen
9
9
 
10
10
  # Google webmaster tools
11
11
  google_verify:
12
+ google_analytics: UA-98684555-4
12
13
 
13
14
  # https://ssl.bing.com/webmaster/configure/verify/ownership Option 2 content= goes here
14
15
  bing_verify:
@@ -2,7 +2,7 @@
2
2
  title: Structure
3
3
  ---
4
4
 
5
- Ufo creates a ufo folder within your project which contains the required files used by for ufo to build and deploy docker images to ECS. The standard directory structure of the ufo folder looks like this:
5
+ Ufo creates a ufo folder within your project which contains the required files used by ufo to build and deploy docker images to ECS. The standard directory structure of the ufo folder looks like this:
6
6
 
7
7
  ```sh
8
8
  ufo
@@ -18,8 +18,8 @@ The table below covers the purpose of each folder and file.
18
18
  File / Directory | Description
19
19
  ------------- | -------------
20
20
  <code>output/</code> | The folder where the generated task definitions are written to. The way the task definitions are generated are covered in [ufo tasks build]({% link _docs/tutorial-ufo-tasks-build.md %}).
21
- <code>settings.yml</code> | Ufo's settings file, where you and adjust the default settings.
22
- <code>task_definitions.rb</code> | This where you define the task definitions and specify the variables to be used for the ERB templates.
21
+ <code>settings.yml</code> | Ufo's settings file, where you and adjust the default [settings]({% link _docs/settings.md %}).
22
+ <code>task_definitions.rb</code> | This where you define the task definitions and specify the variables to be used by the ERB templates.
23
23
  <code>templates/</code> | The ERB templates with the task definition json code. The template are covered in more detail in [ufo tasks build]({% link _docs/tutorial-ufo-tasks-build.md %}).
24
24
  <code>templates/main.json.erb</code> | This is the main and starter template task definition json file that ufo initially generates.
25
25
 
@@ -2,7 +2,7 @@
2
2
  title: ufo init
3
3
  ---
4
4
 
5
- The `ufo init` command provides a way to quickly setup a project to be ufo ready. It creates a ufo with all the starter supporting files in order to use ufo. This page demonstrates how to use `ufo init`. The command has a few required options `--app`, `--env`, `--cluster`, and `--image`.
5
+ 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 has a few required options `--app`, `--env`, `--cluster`, and `--image`.
6
6
 
7
7
  For this example we will use [tongueroo/hi](https://github.com/tongueroo/hi) which is a small test sinatra app.
8
8
 
@@ -9,7 +9,7 @@
9
9
  </div>
10
10
  <div class="row">
11
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>
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 <code>ufo ship</code> command that deploys your code to ECS.</p>
13
13
  </div>
14
14
  <div class="col-lg-4">
15
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>
@@ -0,0 +1,10 @@
1
+ <!-- Google analytics -->
2
+ <script>
3
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
4
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
5
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
6
+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
7
+
8
+ ga('create', '{{ site.google_analytics }}', 'auto');
9
+ ga('send', 'pageview');
10
+ </script>
@@ -3,7 +3,7 @@
3
3
  <div class="container">
4
4
  <div class="row">
5
5
  <div class="col-lg-12">
6
- <img class="img-responsive" src="/img/ufo.jpg" alt="">
6
+ <img class="img-responsive" src="/img/logos/ufo-logo.png" alt="">
7
7
  <div class="intro-text">
8
8
  <span class="name">{{ site.title }}</span>
9
9
  <hr class="star-light">
@@ -26,3 +26,7 @@
26
26
  {% endif %}
27
27
 
28
28
  <script src="{{ "/js/nav.js" }}"></script>
29
+
30
+ {% if site.google_analytics and jekyll.environment == "production" %}
31
+ {% include google_analytics.html %}
32
+ {% endif %}
@@ -9,7 +9,7 @@
9
9
  <span class="icon-bar"></span>
10
10
  <span class="icon-bar"></span>
11
11
  </button>
12
- <a class="navbar-brand" href="/#page-top"><img class="navbar-logo" src="/img/logos/boltops-logo.png" />{{ site.title }}</a>
12
+ <a class="navbar-brand" href="/#page-top"><img class="navbar-logo" src="/img/logos/ufo-site-header.png" />{{ site.title }}</a>
13
13
  </div>
14
14
 
15
15
  <!-- Collect the nav links, forms, and other content for toggling -->
Binary file
Binary file
File without changes
@@ -13,5 +13,9 @@ module Ufo
13
13
  def ecr
14
14
  @ecr ||= Aws::ECR::Client.new
15
15
  end
16
+
17
+ def cloudwatchlogs
18
+ @cloudwatchlogs ||= Aws::CloudWatchLogs::Client.new
19
+ end
16
20
  end
17
21
  end
data/lib/ufo/cli.rb CHANGED
@@ -49,6 +49,7 @@ module Ufo
49
49
 
50
50
  task_definition = options[:task] || service # convention
51
51
  Tasks::Builder.register(task_definition, options) if options[:tasks]
52
+ LogGroup.new(task_definition, options).create
52
53
  ship = Ship.new(service, task_definition, options)
53
54
  ship.deploy
54
55
 
@@ -65,6 +66,7 @@ module Ufo
65
66
  service_name, task_defintion_name = service.split(':')
66
67
  task_definition = task_defintion_name || service_name # convention
67
68
  Tasks::Builder.register(task_definition, options) if options[:tasks]
69
+ LogGroup.new(task_definition, options).create
68
70
  ship = Ship.new(service, task_definition, options)
69
71
  ship.deploy
70
72
  end
@@ -0,0 +1,33 @@
1
+ # Use to automatically create the CloudWatch group
2
+ module Ufo
3
+ class LogGroup
4
+ include AwsServices
5
+
6
+ def initialize(task_definition, options)
7
+ @task_definition, @options = task_definition, options
8
+ end
9
+
10
+ def create
11
+ puts "Ensuring log group for #{@task_definition} exists"
12
+ return if @options[:noop]
13
+ task_def = JSON.load(IO.read(task_def_path))
14
+ task_def["containerDefinitions"].each do |container_def|
15
+ begin
16
+ log_group_name = container_def["logConfiguration"]["options"]["awslogs-group"]
17
+ rescue NoMethodError
18
+ # silence when the logConfiguration is not specified
19
+ end
20
+
21
+ create_log_group(log_group_name) if log_group_name
22
+ end
23
+ end
24
+
25
+ def create_log_group(log_group_name)
26
+ cloudwatchlogs.create_log_group(log_group_name: log_group_name)
27
+ end
28
+
29
+ def task_def_path
30
+ "./ufo/output/#{@task_definition}.json"
31
+ end
32
+ end
33
+ end
data/lib/ufo/settings.rb CHANGED
@@ -15,7 +15,7 @@ module Ufo
15
15
  @data = YAML.load_file(settings_path)
16
16
  @data = user_settings.merge(@data)
17
17
  else
18
- puts "ERROR: No settings file at #{settings_path}"
18
+ puts "ERROR: No settings file at #{settings_path}. Are you sure you are in a project with ufo setup?"
19
19
  puts "Please create a settings file via: ufo init"
20
20
  exit 1
21
21
  end
data/lib/ufo/ship.rb CHANGED
@@ -227,8 +227,9 @@ module Ufo
227
227
  # the ECS console. `ufo scale` will allow you to updated the desired_count from the
228
228
  # CLI though.
229
229
  def create_service
230
+ puts "This service #{@service} does not yet exist in the #{@cluster} cluster. This deploy will create it."
230
231
  container = container_info(@task_definition)
231
- target_group = create_service_prompt(container)
232
+ target_group = target_group_prompt(container)
232
233
 
233
234
  message = "#{@service} service created on #{@cluster} cluster"
234
235
  if @options[:noop]
@@ -245,7 +246,7 @@ module Ufo
245
246
  task_definition: @task_definition
246
247
  }
247
248
  unless target_group.nil? || target_group.empty?
248
- add_load_balancer!(container, options)
249
+ add_load_balancer!(container, options, target_group)
249
250
  end
250
251
  response = ecs.create_service(options)
251
252
  service = response.service # must set service here since this might never be called if @wait_for_deployment is false
@@ -285,14 +286,14 @@ module Ufo
285
286
  # Only support Application Load Balancer
286
287
  # Think there is an AWS bug that complains about not having the LB
287
288
  # name but you cannot pass both a LB Name and a Target Group.
288
- def add_load_balancer!(container, options)
289
+ def add_load_balancer!(container, options, target_group)
289
290
  options.merge!(
290
291
  role: "ecsServiceRole", # assumption that we're using the ecsServiceRole
291
292
  load_balancers: [
292
293
  {
293
294
  container_name: container[:name],
294
295
  container_port: container[:port],
295
- target_group_arn: @options[:target_group],
296
+ target_group_arn: target_group,
296
297
  }
297
298
  ]
298
299
  )
@@ -301,16 +302,17 @@ module Ufo
301
302
  # Returns the target_group.
302
303
  # Will only allow an target_group and the service to use a load balancer
303
304
  # if the container name is "web".
304
- def create_service_prompt(container)
305
+ def target_group_prompt(container)
305
306
  return if @options[:noop]
307
+ # If a target_group is provided at the CLI return it right away.
308
+ return @options[:target_group] if @options[:target_group]
309
+ # Allows skipping the target group prompt.
306
310
  return unless @target_group_prompt
307
- if container[:name] != "web" and @options[:target_group]
308
- puts "WARNING: A --target-group #{@options[:target_group]} was provided but it will not be used because this not a web container. Container name: #{container[:name].inspect}."
309
- end
311
+
312
+ # If the container name is web then it is assume that this is a web service that
313
+ # needs a target group/elb.
310
314
  return unless container[:name] == 'web'
311
- return @options[:target_group] if @options[:target_group]
312
315
 
313
- puts "This service #{@service} does not yet exist in the #{@cluster} cluster. This deploy will create it."
314
316
  puts "Would you like this service to be associated with an Application Load Balancer?"
315
317
  puts "If yes, please provide the Application Load Balancer Target Group ARN."
316
318
  puts "If no, simply press enter."
data/lib/ufo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ufo
2
- VERSION = "1.6.2"
2
+ VERSION = "1.7.0"
3
3
  end
data/lib/ufo.rb CHANGED
@@ -17,6 +17,7 @@ module Ufo
17
17
  autoload :Destroy, 'ufo/destroy'
18
18
  autoload :DSL, 'ufo/dsl'
19
19
  autoload :Scale, 'ufo/scale'
20
+ autoload :LogGroup, 'ufo/log_group'
20
21
 
21
22
  autoload :Docker, 'ufo/docker'
22
23
  autoload :Ecr, 'ufo/ecr'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ufo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-22 00:00:00.000000000 Z
11
+ date: 2017-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -220,6 +220,7 @@ files:
220
220
  - docs/_includes/edit-on-github.html
221
221
  - docs/_includes/example.html
222
222
  - docs/_includes/footer.html
223
+ - docs/_includes/google_analytics.html
223
224
  - docs/_includes/head.html
224
225
  - docs/_includes/header.html
225
226
  - docs/_includes/js.html
@@ -243,12 +244,14 @@ files:
243
244
  - docs/docs.md
244
245
  - docs/img/logos/boltops-logo-full.png
245
246
  - docs/img/logos/boltops-logo.png
247
+ - docs/img/logos/ufo-logo.png
248
+ - docs/img/logos/ufo-site-header.png
249
+ - docs/img/logos/ufo.jpg
246
250
  - docs/img/tutorials/ecs-console-task-definitions.png
247
251
  - docs/img/tutorials/ecs-console-ufo-ship.png
248
252
  - docs/img/tutorials/ecs-console-ufo-ships.png
249
253
  - docs/img/tutorials/ufo-init.png
250
254
  - docs/img/tutorials/ufo-tasks-build.png
251
- - docs/img/ufo.jpg
252
255
  - docs/index.html
253
256
  - docs/js/bootstrap.js
254
257
  - docs/js/bootstrap.min.js
@@ -290,6 +293,7 @@ files:
290
293
  - lib/ufo/ecr/auth.rb
291
294
  - lib/ufo/ecr/cleaner.rb
292
295
  - lib/ufo/init.rb
296
+ - lib/ufo/log_group.rb
293
297
  - lib/ufo/scale.rb
294
298
  - lib/ufo/settings.rb
295
299
  - lib/ufo/ship.rb