ufo 4.5.8 → 4.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/README.md +2 -0
  4. data/docs/_docs/conventions.md +1 -1
  5. data/docs/_docs/extras/codebuild-iam-role.md +2 -2
  6. data/docs/_docs/extras/dockerfile-erb.md +2 -2
  7. data/docs/_docs/extras/ecs-network-mode.md +2 -2
  8. data/docs/_docs/extras/load-balancer.md +2 -2
  9. data/docs/_docs/extras/minimal-deploy-iam.md +2 -2
  10. data/docs/_docs/extras/redirection-support.md +2 -2
  11. data/docs/_docs/extras/route53-support.md +2 -2
  12. data/docs/_docs/extras/security-groups.md +2 -2
  13. data/docs/_docs/extras/ssl-support.md +2 -2
  14. data/docs/_docs/faq.md +2 -2
  15. data/docs/_docs/helpers.md +1 -1
  16. data/docs/_docs/install.md +1 -1
  17. data/docs/_docs/more/auto-completion.md +2 -2
  18. data/docs/_docs/more/automated-cleanup.md +2 -2
  19. data/docs/_docs/more/customize-cloudformation.md +2 -2
  20. data/docs/_docs/more/migrations.md +2 -2
  21. data/docs/_docs/more/run-in-pieces.md +2 -2
  22. data/docs/_docs/more/single-task.md +2 -2
  23. data/docs/_docs/more/stuck-cloudformation.md +2 -2
  24. data/docs/_docs/more/why-cloudformation.md +2 -2
  25. data/docs/_docs/next-steps.md +2 -2
  26. data/docs/_docs/quick-start-ec2.md +1 -1
  27. data/docs/_docs/settings.md +1 -1
  28. data/docs/_docs/settings/aws_profile.md +1 -1
  29. data/docs/_docs/settings/cfn.md +1 -1
  30. data/docs/_docs/settings/cluster.md +1 -1
  31. data/docs/_docs/settings/network.md +1 -1
  32. data/docs/_docs/ssl_errors.md +1 -2
  33. data/docs/_docs/structure.md +1 -1
  34. data/docs/_docs/tutorial-ufo-docker-build.md +1 -1
  35. data/docs/_docs/tutorial-ufo-init.md +1 -1
  36. data/docs/_docs/tutorial-ufo-ship.md +1 -1
  37. data/docs/_docs/tutorial-ufo-ships.md +1 -1
  38. data/docs/_docs/tutorial-ufo-tasks-build.md +1 -1
  39. data/docs/_docs/tutorial.md +1 -1
  40. data/docs/_docs/ufo-current.md +2 -2
  41. data/docs/_docs/ufo-env-extra.md +2 -2
  42. data/docs/_docs/ufo-env.md +2 -2
  43. data/docs/_docs/ufo-logs.md +50 -0
  44. data/docs/_docs/ufo-task-params.md +2 -2
  45. data/docs/_docs/upgrading.md +2 -2
  46. data/docs/_docs/upgrading/upgrade4.5.md +2 -2
  47. data/docs/_docs/upgrading/upgrade4.md +2 -2
  48. data/docs/_docs/variables.md +1 -1
  49. data/docs/_includes/subnav.html +1 -0
  50. data/docs/_reference/ufo-logs.md +40 -0
  51. data/docs/articles.md +2 -2
  52. data/docs/docs.md +1 -1
  53. data/docs/quick-start.md +1 -1
  54. data/docs/reference.md +1 -0
  55. data/lib/ufo/aws_service.rb +2 -0
  56. data/lib/ufo/cli.rb +10 -0
  57. data/lib/ufo/core.rb +5 -5
  58. data/lib/ufo/dsl/helper.rb +13 -1
  59. data/lib/ufo/help/logs.md +10 -0
  60. data/lib/ufo/logs.rb +56 -0
  61. data/lib/ufo/tasks/register.rb +11 -8
  62. data/lib/ufo/version.rb +1 -1
  63. data/spec/fixtures/mocks/logs/awslogs.json +70 -0
  64. data/spec/fixtures/mocks/logs/no-awslogs.json +70 -0
  65. data/spec/lib/logs_spec.rb +55 -0
  66. data/ufo.gemspec +2 -0
  67. metadata +41 -4
@@ -0,0 +1,70 @@
1
+ {
2
+ "task_definition": {
3
+ "task_definition_arn": "arn:aws:ecs:us-west-2:112233445566:task-definition/demo-web:1",
4
+ "container_definitions": [
5
+ {
6
+ "name": "web",
7
+ "image": "112233445566.dkr.ecr.us-west-2.amazonaws.com/demo/sinatra:ufo-2020-01-16T22-56-26-a28378e80",
8
+ "cpu": 256,
9
+ "memory": 1024,
10
+ "memory_reservation": 1024,
11
+ "port_mappings": [
12
+ {
13
+ "container_port": 4567,
14
+ "host_port": 4567,
15
+ "protocol": "tcp"
16
+ }
17
+ ],
18
+ "essential": true,
19
+ "command": [
20
+ "bin/web"
21
+ ],
22
+ "environment": [],
23
+ "log_configuration": {
24
+ "log_driver": "whatever",
25
+ "options": {
26
+ "awslogs-group": "ecs/demo-web",
27
+ "awslogs-region": "us-west-2",
28
+ "awslogs-stream-prefix": "demo"
29
+ }
30
+ }
31
+ }
32
+ ],
33
+ "family": "demo-web",
34
+ "task_role_arn": "arn:aws:iam::112233445566:role/demo",
35
+ "network_mode": "awsvpc",
36
+ "revision": 1,
37
+ "volumes": [
38
+ ],
39
+ "status": "ACTIVE",
40
+ "requires_attributes": [
41
+ {
42
+ "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
43
+ },
44
+ {
45
+ "name": "com.amazonaws.ecs.capability.ecr-auth"
46
+ },
47
+ {
48
+ "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
49
+ },
50
+ {
51
+ "name": "com.amazonaws.ecs.capability.docker-remote-api.1.21"
52
+ },
53
+ {
54
+ "name": "com.amazonaws.ecs.capability.task-iam-role"
55
+ },
56
+ {
57
+ "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
58
+ },
59
+ {
60
+ "name": "ecs.capability.task-eni"
61
+ }
62
+ ],
63
+ "placement_constraints": [
64
+
65
+ ],
66
+ "compatibilities": [
67
+ "EC2"
68
+ ]
69
+ }
70
+ }
@@ -0,0 +1,55 @@
1
+ describe Ufo::Logs do
2
+ let(:logs) do
3
+ logs = Ufo::Logs.new("test-web", {})
4
+ allow(logs).to receive(:exit).and_return(null)
5
+ allow(logs).to receive(:info).and_return(null)
6
+ allow(logs).to receive(:ecs).and_return(ecs)
7
+ logs
8
+ end
9
+ let(:ecs) do
10
+ ecs = double(:ecs).as_null_object
11
+ allow(ecs).to receive(:describe_task_definition).and_return(mock_response(fixture))
12
+ ecs
13
+ end
14
+ let(:null) { double(:null).as_null_object }
15
+
16
+ context "awslogs conf" do
17
+ let(:fixture) { "spec/fixtures/mocks/logs/awslogs.json" }
18
+ it "find_log_group_name" do
19
+ log_group_name = logs.find_log_group_name
20
+ expect(log_group_name).to eq({"awslogs-group" => "ecs/demo-web", "awslogs-region" => "us-west-2", "awslogs-stream-prefix" => "demo" })
21
+ end
22
+ end
23
+
24
+ context "not a awslogs conf" do
25
+ let(:fixture) { "spec/fixtures/mocks/logs/no-awslogs.json" }
26
+ it "find_log_group_name" do
27
+ log_group_name = logs.find_log_group_name
28
+ expect(log_group_name).to be nil
29
+ end
30
+ end
31
+
32
+ def mock_response(file)
33
+ data = JSON.load(IO.read(file))
34
+
35
+ td = data["task_definition"]
36
+ container_definitions = td["container_definitions"].map do |c|
37
+ l = c["log_configuration"]
38
+ log_configuration = Aws::ECS::Types::LogConfiguration.new(
39
+ log_driver: l["log_driver"],
40
+ options: l["options"],
41
+ )
42
+ Aws::ECS::Types::ContainerDefinition.new(
43
+ name: c["name"],
44
+ log_configuration: log_configuration,
45
+ )
46
+ end
47
+ task_definition = Aws::ECS::Types::TaskDefinition.new(
48
+ task_definition_arn: td["task_definition_arn"],
49
+ container_definitions: container_definitions,
50
+ )
51
+ Aws::ECS::Types::DescribeTaskDefinitionResponse.new(
52
+ task_definition: task_definition,
53
+ )
54
+ end
55
+ end
data/ufo.gemspec CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_dependency "aws-logs"
22
+ spec.add_dependency "aws-mfa-secure"
21
23
  spec.add_dependency "aws-sdk-cloudformation"
22
24
  spec.add_dependency "aws-sdk-cloudwatchlogs"
23
25
  spec.add_dependency "aws-sdk-ec2"
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ufo
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.8
4
+ version: 4.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-18 00:00:00.000000000 Z
11
+ date: 2020-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-logs
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-mfa-secure
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: aws-sdk-cloudformation
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -297,7 +325,6 @@ files:
297
325
  - README.md
298
326
  - Rakefile
299
327
  - docs/.gitignore
300
- - docs/.ruby-version
301
328
  - docs/CNAME
302
329
  - docs/Gemfile
303
330
  - docs/LICENSE
@@ -344,6 +371,7 @@ files:
344
371
  - docs/_docs/ufo-current.md
345
372
  - docs/_docs/ufo-env-extra.md
346
373
  - docs/_docs/ufo-env.md
374
+ - docs/_docs/ufo-logs.md
347
375
  - docs/_docs/ufo-task-params.md
348
376
  - docs/_docs/ufo-tasks-register.md
349
377
  - docs/_docs/upgrading.md
@@ -400,6 +428,7 @@ files:
400
428
  - docs/_reference/ufo-docker-push.md
401
429
  - docs/_reference/ufo-docker.md
402
430
  - docs/_reference/ufo-init.md
431
+ - docs/_reference/ufo-logs.md
403
432
  - docs/_reference/ufo-network-help.md
404
433
  - docs/_reference/ufo-network-init.md
405
434
  - docs/_reference/ufo-network.md
@@ -530,6 +559,7 @@ files:
530
559
  - lib/ufo/help/docker/push.md
531
560
  - lib/ufo/help/help.md
532
561
  - lib/ufo/help/init.md
562
+ - lib/ufo/help/logs.md
533
563
  - lib/ufo/help/network/init.md
534
564
  - lib/ufo/help/ps.md
535
565
  - lib/ufo/help/releases.md
@@ -547,6 +577,7 @@ files:
547
577
  - lib/ufo/info.rb
548
578
  - lib/ufo/init.rb
549
579
  - lib/ufo/log_group.rb
580
+ - lib/ufo/logs.rb
550
581
  - lib/ufo/network.rb
551
582
  - lib/ufo/network/fetch.rb
552
583
  - lib/ufo/network/helper.rb
@@ -590,6 +621,8 @@ files:
590
621
  - spec/fixtures/dockerfiles/ecr/Dockerfile
591
622
  - spec/fixtures/home_existing/.aws/config
592
623
  - spec/fixtures/home_existing/.docker/config.json
624
+ - spec/fixtures/mocks/logs/awslogs.json
625
+ - spec/fixtures/mocks/logs/no-awslogs.json
593
626
  - spec/fixtures/ps/describe_tasks.json
594
627
  - spec/fixtures/settings.yml
595
628
  - spec/lib/apps_spec.rb
@@ -598,6 +631,7 @@ files:
598
631
  - spec/lib/completion_spec.rb
599
632
  - spec/lib/ecr_auth_spec.rb
600
633
  - spec/lib/ecr_cleaner_spec.rb
634
+ - spec/lib/logs_spec.rb
601
635
  - spec/lib/ps_spec.rb
602
636
  - spec/lib/register_spec.rb
603
637
  - spec/lib/setting_spec.rb
@@ -626,7 +660,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
626
660
  - !ruby/object:Gem::Version
627
661
  version: '0'
628
662
  requirements: []
629
- rubygems_version: 3.0.6
663
+ rubygems_version: 3.1.2
630
664
  signing_key:
631
665
  specification_version: 4
632
666
  summary: AWS ECS Deploy Tool
@@ -641,6 +675,8 @@ test_files:
641
675
  - spec/fixtures/dockerfiles/ecr/Dockerfile
642
676
  - spec/fixtures/home_existing/.aws/config
643
677
  - spec/fixtures/home_existing/.docker/config.json
678
+ - spec/fixtures/mocks/logs/awslogs.json
679
+ - spec/fixtures/mocks/logs/no-awslogs.json
644
680
  - spec/fixtures/ps/describe_tasks.json
645
681
  - spec/fixtures/settings.yml
646
682
  - spec/lib/apps_spec.rb
@@ -649,6 +685,7 @@ test_files:
649
685
  - spec/lib/completion_spec.rb
650
686
  - spec/lib/ecr_auth_spec.rb
651
687
  - spec/lib/ecr_cleaner_spec.rb
688
+ - spec/lib/logs_spec.rb
652
689
  - spec/lib/ps_spec.rb
653
690
  - spec/lib/register_spec.rb
654
691
  - spec/lib/setting_spec.rb