hako 2.0.4 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2de7cfe5e38e22aaf20d4bca43d9a3b579eafd5eb68173a260c448df063864cc
4
- data.tar.gz: 9ff76702eb2e6be3ffff566cd897cf670e84fe8fd3addd45cba17d5b025426d3
3
+ metadata.gz: 1a314c9baebed4e29a7f3650abec5d8f988f57a54db5ba979957040a15b01ba0
4
+ data.tar.gz: f7221e593ed0ded7fb3b8f3f312d289da9efacb7fae79408e935d20f3badfeb9
5
5
  SHA512:
6
- metadata.gz: 299bb255b8e7f1e7a768c298b303a1a1ef9366959cbaf3c29560a121a2100e72f9b07b0ae8e8af1c52f1e12f8d659bf112ed32cda636590ba088b8933b423332
7
- data.tar.gz: c9937025cda397635911b79e8fafca65cfdaa423eb26386c62e14cbe5aaed7d10bc3ad8f1cdaadbed09a4025617282ca75531c126e5249a3a3ccc3c9f45bb6c5
6
+ metadata.gz: 4f2507875d79feae5c66f61c9cabe735dafadf80c0395217363772c812663a8a93b73ad52219e6b19364b335ebdbfd3b6ebfe4bd86df68dd68b898b9fce774bc
7
+ data.tar.gz: 29d24a5c810a615d9bfff1d553d8a84ccf6bfdad33fbf24b9900841f41cb1de3afd558bda73d45c0b3fe47f6ded8e8e21a4beb22ca86f685a89d9f82a7becbd1
@@ -9,6 +9,10 @@ Layout/FirstParameterIndentation:
9
9
 
10
10
  Naming/PredicateName:
11
11
  Enabled: false
12
+ Naming/UncommunicativeMethodParamName:
13
+ Enabled: false
14
+ Naming/MemoizedInstanceVariableName:
15
+ Enabled: false
12
16
 
13
17
  Style/Alias:
14
18
  EnforcedStyle: prefer_alias_method
@@ -35,7 +39,9 @@ Style/StderrPuts:
35
39
  Enabled: false
36
40
  Style/TrailingCommaInArguments:
37
41
  Enabled: false
38
- Style/TrailingCommaInLiteral:
42
+ Style/TrailingCommaInArrayLiteral:
43
+ Enabled: false
44
+ Style/TrailingCommaInHashLiteral:
39
45
  Enabled: false
40
46
 
41
47
  Performance/RedundantBlockCall:
@@ -1,3 +1,10 @@
1
+ # 2.1.0 (2018-04-18)
2
+ ## New features
3
+ - Support Network Load Balancer
4
+ - See [examples/hello-internal-nlb.jsonnet](examples/hello-internal-nlb.jsonnet)
5
+ - Support `health_check_grace_period_seconds`
6
+ - See [examples/hello-lb-v2.jsonnet](examples/hello-lb-v2.jsonnet)
7
+
1
8
  # 2.0.4 (2018-02-26)
2
9
  ## Bug fixes
3
10
  - Pass AWS region of ECS scheduler to other AWS clients (CloudWatch, ApplicationAutoScaling)
@@ -27,7 +34,7 @@
27
34
  ## New features
28
35
  - Add support for awsvpc network mode
29
36
  - Add support for Fargate
30
- - See [examples/hello-fargate.yml](examples/hello-fargate.yml) and [examples/hello-fargate-batch.yml](examples/hello-fargate-batch.yml)
37
+ - See [examples/hello-fargate.jsonnet](examples/hello-fargate.jsonnet) and [examples/hello-fargate-batch.jsonnet](examples/hello-fargate-batch.jsonnet)
31
38
 
32
39
  # 1.8.4 (2017-11-24)
33
40
  ## Improvements
@@ -48,7 +55,7 @@
48
55
  # 1.8.1 (2017-09-15)
49
56
  ## Improvements
50
57
  - Add container_name and container_port option to elb and elb_v2
51
- - See [examples/hello-nofront.yml](examples/hello-nofront.yml)
58
+ - See [examples/hello-nofront.jsonnet](examples/hello-nofront.jsonnet)
52
59
 
53
60
  # 1.8.0 (2017-09-15)
54
61
  ## Changes
@@ -0,0 +1 @@
1
+ { type: 'create_aws_cloud_watch_logs_log_group' }
@@ -0,0 +1,20 @@
1
+ {
2
+ scheduler: {
3
+ type: 'ecs',
4
+ region: 'ap-northeast-1',
5
+ cluster: 'eagletmt',
6
+ desired_count: 2,
7
+ role: 'ecsServiceRole',
8
+ autoscaling_group_for_oneshot: 'hako-batch-cluster',
9
+ },
10
+ app: {
11
+ image: 'ryotarai/hello-sinatra',
12
+ memory: 128,
13
+ cpu: 256,
14
+ env: {
15
+ PORT: '3000',
16
+ MESSAGE: 'hello',
17
+ },
18
+ command: ['echo', 'heavy offline job'],
19
+ },
20
+ }
@@ -0,0 +1,78 @@
1
+ local fileProvider = std.native('provide.file');
2
+ local provide(name) = fileProvider(std.toString({ path: 'hello.env' }), name);
3
+
4
+ {
5
+ scheduler: {
6
+ type: 'ecs',
7
+ region: 'ap-northeast-1',
8
+ cluster: 'eagletmt',
9
+ desired_count: 2,
10
+ role: 'ecsServiceRole',
11
+ elb: {
12
+ listeners: [
13
+ {
14
+ load_balancer_port: 80,
15
+ protocol: 'HTTP',
16
+ },
17
+ ],
18
+ subnets: [
19
+ 'subnet-XXXXXXXX',
20
+ 'subnet-YYYYYYYY',
21
+ ],
22
+ security_groups: [
23
+ 'sg-ZZZZZZZZ',
24
+ ],
25
+ },
26
+ autoscaling: {
27
+ role_arn: 'arn:aws:iam::012345678901:role/ecsAutoscaleRole',
28
+ min_capacity: 1,
29
+ max_capacity: 4,
30
+ policies: [
31
+ // Add one task when ecs-scaling-out-hello-autoscaling-service is in alarm state
32
+ {
33
+ alarms: ['ecs-scaling-out-hello-autoscaling-service'],
34
+ cooldown: 300,
35
+ adjustment_type: 'ChangeInCapacity',
36
+ scaling_adjustment: 1,
37
+ metric_interval_lower_bound: 0,
38
+ metric_aggregation_type: 'Average',
39
+ },
40
+ // Remove one task when ecs-scaling-in-hello-autoscaling-service is in alarm state
41
+ {
42
+ alarms: ['ecs-scaling-in-hello-autoscaling-service'],
43
+ cooldown: 300,
44
+ adjustment_type: 'ChangeInCapacity',
45
+ scaling_adjustment: -1,
46
+ metric_interval_upper_bound: 0,
47
+ metric_aggregation_type: 'Average',
48
+ },
49
+ ],
50
+ },
51
+ },
52
+ app: {
53
+ image: 'ryotarai/hello-sinatra',
54
+ memory: 128,
55
+ cpu: 256,
56
+ env: {
57
+ PORT: '3000',
58
+ MESSAGE: std.format('%s-san', provide('username')),
59
+ },
60
+ },
61
+ additional_containers: {
62
+ front: {
63
+ image_tag: 'hako-nginx',
64
+ memory: 32,
65
+ cpu: 32,
66
+ },
67
+ },
68
+ scripts: [
69
+ (import 'front.libsonnet') + {
70
+ backend_port: 3000,
71
+ locations: {
72
+ '/': {
73
+ allow_only_from: ['10.0.0.0/24'],
74
+ },
75
+ },
76
+ },
77
+ ],
78
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ scheduler: {
3
+ type: 'ecs',
4
+ region: 'ap-northeast-1',
5
+ cluster: 'eagletmt',
6
+ desired_count: 1,
7
+ },
8
+ app: {
9
+ image: 'busybox',
10
+ memory: 128,
11
+ cpu: 256,
12
+ command: ['echo', 'hello awslogs'],
13
+ log_configuration: {
14
+ log_driver: 'awslogs',
15
+ options: {
16
+ 'awslogs-group': 'my-logs',
17
+ 'awslogs-region': 'ap-northeast-1',
18
+ 'awslogs-stream-prefix': 'example',
19
+ },
20
+ },
21
+ },
22
+ scripts: [
23
+ (import 'create_aws_cloud_watch_logs_log_group.libsonnet'),
24
+ ],
25
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ scheduler: {
3
+ type: 'ecs',
4
+ region: 'ap-northeast-1',
5
+ cluster: 'eagletmt',
6
+ desired_count: 1,
7
+ },
8
+ app: {
9
+ image: 'busybox',
10
+ memory: 128,
11
+ cpu: 256,
12
+ command: ['echo', 'hello with SYS_RAWIO'],
13
+ linux_parameters: {
14
+ capabilities: {
15
+ add: ['SYS_RAWIO'],
16
+ },
17
+ },
18
+ },
19
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ scheduler: {
3
+ type: 'ecs',
4
+ region: 'us-east-1',
5
+ cluster: 'eagletmt',
6
+ // Fargate
7
+ execution_role_arn: 'arn:aws:iam::012345678901:role/ecsTaskExecutionRole',
8
+ cpu: '1024',
9
+ memory: '2048',
10
+ requires_compatibilities: ['FARGATE'],
11
+ network_mode: 'awsvpc',
12
+ launch_type: 'FARGATE',
13
+ network_configuration: {
14
+ awsvpc_configuration: {
15
+ subnets: ['subnet-XXXXXXXX'],
16
+ security_groups: [],
17
+ assign_public_ip: 'DISABLED',
18
+ },
19
+ },
20
+ },
21
+ app: {
22
+ image: 'ryotarai/hello-sinatra',
23
+ cpu: 1024,
24
+ memory: 256,
25
+ memory_reservation: 128,
26
+ log_configuration: {
27
+ log_driver: 'awslogs',
28
+ options: {
29
+ 'awslogs-group': '/ecs/hello-fargate-batch',
30
+ 'awslogs-region': 'us-east-1',
31
+ 'awslogs-stream-prefix': 'ecs',
32
+ },
33
+ },
34
+ },
35
+ scripts: [
36
+ (import './create_aws_cloud_watch_logs_log_group.libsonnet'),
37
+ ],
38
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ scheduler: {
3
+ type: 'ecs',
4
+ region: 'ap-northeast-1',
5
+ cluster: 'eagletmt',
6
+ desired_count: 2,
7
+ role: 'ecsServiceRole',
8
+ // health_check_grace_period_seconds: 0,
9
+ elb_v2: {
10
+ // NLB can not have
11
+ // * health check path
12
+ // * securit group
13
+ scheme: 'internal',
14
+ type: 'network',
15
+ // VPC id where the target group is located
16
+ vpc_id: 'vpc-WWWWWWWW',
17
+ listeners: [
18
+ {
19
+ port: 80,
20
+ protocol: 'TCP',
21
+ },
22
+ ],
23
+ subnets: [
24
+ 'subnet-XXXXXXXX',
25
+ 'subnet-YYYYYYYY',
26
+ ],
27
+ container_name: 'app',
28
+ container_port: 80,
29
+ // If you want enalbed cross zone load balancing, then specify attribute.
30
+ // load_balancer_attributes: {
31
+ // 'load_balancing.cross_zone.enabled': 'true',
32
+ // },
33
+ },
34
+ },
35
+ app: {
36
+ image: 'nginx',
37
+ memory: 128,
38
+ cpu: 256,
39
+ port_mappings: [
40
+ {
41
+ container_port: 80,
42
+ host_port: 0,
43
+ protocol: 'TCP',
44
+ },
45
+ ],
46
+ },
47
+ }
@@ -0,0 +1,71 @@
1
+ local fileProvider = std.native('provide.file');
2
+ local provide(name) = fileProvider(std.toString({ path: 'hello.env' }), name);
3
+
4
+ {
5
+ scheduler: {
6
+ type: 'ecs',
7
+ region: 'ap-northeast-1',
8
+ cluster: 'eagletmt',
9
+ desired_count: 2,
10
+ role: 'ecsServiceRole',
11
+ // dynamic_port_mapping is enabled by default with elb_v2
12
+ // dynamic_port_mapping: false,
13
+ // health_check_grace_period_seconds: 0,
14
+ elb_v2: {
15
+ // VPC id where the target group is located
16
+ vpc_id: 'vpc-WWWWWWWW',
17
+ // If you want internal ELB, then use 'scheme'. (ex. internal service that like microservice inside VPC)
18
+ // scheme: internal
19
+ // Health check path of the target group
20
+ health_check_path: '/site/sha',
21
+ listeners: [
22
+ {
23
+ port: 80,
24
+ protocol: 'HTTP',
25
+ },
26
+ {
27
+ port: 443,
28
+ protocol: 'HTTPS',
29
+ certificate_arn: 'arn:aws:iam::012345678901:server-certificate/hello-lb-v2.example.com',
30
+ },
31
+ ],
32
+ subnets: ['subnet-XXXXXXXX', 'subnet-YYYYYYYY'],
33
+ security_groups: ['sg-ZZZZZZZZ'],
34
+ load_balancer_attributes: {
35
+ 'access_logs.s3.enabled': 'true',
36
+ 'access_logs.s3.bucket': 'hako-access-logs',
37
+ 'access_logs.s3.prefix': 'hako-hello-lb-v2',
38
+ },
39
+ target_group_attributes: {
40
+ // http://docs.aws.amazon.com/en_us/elasticloadbalancing/latest/application/load-balancer-target-groups.html#target-group-attributes
41
+ 'deregistration_delay.timeout_seconds': '20',
42
+ },
43
+ },
44
+ },
45
+ app: {
46
+ image: 'ryotarai/hello-sinatra',
47
+ memory: 128,
48
+ cpu: 256,
49
+ env: {
50
+ PORT: '3000',
51
+ MESSAGE: std.format('%s-san', provide('username')),
52
+ },
53
+ },
54
+ additional_containers: {
55
+ front: {
56
+ image_tag: 'hako-nginx',
57
+ memory: 32,
58
+ cpu: 32,
59
+ },
60
+ },
61
+ scripts: [
62
+ (import 'front.libsonnet') + {
63
+ backend_port: 3000,
64
+ locations: {
65
+ '/': {
66
+ allow_only_from: ['10.0.0.0/24'],
67
+ },
68
+ },
69
+ },
70
+ ],
71
+ }
@@ -0,0 +1,49 @@
1
+ local fileProvider = std.native('provide.file');
2
+ local provide(name) = fileProvider(std.toString({ path: 'hello.env' }), name);
3
+
4
+ {
5
+ scheduler: {
6
+ type: 'ecs',
7
+ region: 'ap-northeast-1',
8
+ cluster: 'eagletmt',
9
+ desired_count: 2,
10
+ role: 'ecsServiceRole',
11
+ // dynamic_port_mapping cannot be enabled with elb
12
+ elb: {
13
+ listeners: [
14
+ {
15
+ load_balancer_port: 80,
16
+ protocol: 'HTTP',
17
+ },
18
+ ],
19
+ subnets: ['subnet-XXXXXXXX', 'subnet-YYYYYYYY'],
20
+ security_groups: ['sg-ZZZZZZZZ'],
21
+ },
22
+ },
23
+ app: {
24
+ image: 'ryotarai/hello-sinatra',
25
+ memory: 128,
26
+ cpu: 256,
27
+ env: {
28
+ PORT: '3000',
29
+ MESSAGE: std.format('%s-san', provide('username')),
30
+ },
31
+ },
32
+ additional_containers: {
33
+ front: {
34
+ image_tag: 'hako-nginx',
35
+ memory: 32,
36
+ cpu: 32,
37
+ },
38
+ },
39
+ scripts: [
40
+ (import 'front.libsonnet') + {
41
+ backend_port: 3000,
42
+ locations: {
43
+ '/': {
44
+ allow_only_from: ['10.0.0.0/24'],
45
+ },
46
+ },
47
+ },
48
+ ],
49
+ }
@@ -0,0 +1,56 @@
1
+ local fileProvider = std.native('provide.file');
2
+ local provide(name) = fileProvider(std.toString({ path: 'hello.env' }), name);
3
+
4
+ {
5
+ scheduler: {
6
+ type: 'ecs',
7
+ region: 'ap-northeast-1',
8
+ cluster: 'eagletmt',
9
+ desired_count: 2,
10
+ role: 'ecsServiceRole',
11
+ elb_v2: {
12
+ // VPC id where the target group is located
13
+ vpc_id: 'vpc-WWWWWWWW',
14
+ // Health check path of the target group
15
+ health_check_path: '/site/sha',
16
+ listeners: [
17
+ {
18
+ port: 80,
19
+ protocol: 'HTTP',
20
+ },
21
+ {
22
+ port: 443,
23
+ protocol: 'HTTPS',
24
+ certificate_arn: 'arn:aws:iam::012345678901:server-certificate/hello-lb-v2.example.com',
25
+ },
26
+ ],
27
+ subnets: ['subnet-XXXXXXXX', 'subnet-YYYYYYYY'],
28
+ security_groups: ['sg-ZZZZZZZZ'],
29
+ load_balancer_attributes: {
30
+ 'access_logs.s3.enabled': 'true',
31
+ 'access_logs.s3.bucket': 'hako-access-logs',
32
+ 'access_logs.s3.prefix': 'hako-hello-lb-v2',
33
+ },
34
+ // Connect ELB to app container
35
+ container_name: 'app',
36
+ container_port: 3000,
37
+ },
38
+ },
39
+ app: {
40
+ image: 'ryotarai/hello-sinatra',
41
+ memory: 128,
42
+ cpu: 256,
43
+ env: {
44
+ PORT: '3000',
45
+ MESSAGE: std.format('%s-san', provide('username')),
46
+ },
47
+ // Add port mapping to connect to ELB
48
+ port_mappings: [
49
+ {
50
+ container_port: 3000,
51
+ host_port: 0,
52
+ protocol: 'tcp',
53
+ },
54
+ ],
55
+ },
56
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ scheduler: {
3
+ type: 'ecs',
4
+ region: 'ap-northeast-1',
5
+ cluster: 'eagletmt',
6
+ desired_count: 1,
7
+ },
8
+ app: {
9
+ image: 'busybox',
10
+ memory: 128,
11
+ cpu: 256,
12
+ command: ['echo', 'hello from --privileged mode'],
13
+ privileged: true,
14
+ },
15
+ }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'hako/version'
6
6
 
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency 'coveralls'
38
38
  spec.add_development_dependency 'rake'
39
39
  spec.add_development_dependency 'rspec'
40
- spec.add_development_dependency 'rubocop', '>= 0.50.0'
40
+ spec.add_development_dependency 'rubocop', '>= 0.53.0'
41
41
  spec.add_development_dependency 'simplecov'
42
42
  spec.add_development_dependency 'yard'
43
43
  end
@@ -43,6 +43,7 @@ module Hako
43
43
  @ecs_elb_v2_options['target_type'] = 'ip'
44
44
  end
45
45
  @dynamic_port_mapping = options.fetch('dynamic_port_mapping', @ecs_elb_options.nil?)
46
+ @health_check_grace_period_seconds = options.fetch('health_check_grace_period_seconds', nil)
46
47
  if options.key?('autoscaling')
47
48
  @autoscaling = EcsAutoscaling.new(options.fetch('autoscaling'), @region, dry_run: @dry_run)
48
49
  end
@@ -775,6 +776,7 @@ module Hako
775
776
  deployment_configuration: @deployment_configuration,
776
777
  platform_version: @platform_version,
777
778
  network_configuration: @network_configuration,
779
+ health_check_grace_period_seconds: @health_check_grace_period_seconds,
778
780
  }
779
781
  if @autoscaling
780
782
  # Keep current desired_count if autoscaling is enabled
@@ -804,6 +806,7 @@ module Hako
804
806
  launch_type: @launch_type,
805
807
  platform_version: @platform_version,
806
808
  network_configuration: @network_configuration,
809
+ health_check_grace_period_seconds: @health_check_grace_period_seconds,
807
810
  }
808
811
  if ecs_elb_client.find_or_create_load_balancer(front_port)
809
812
  ecs_elb_client.modify_attributes
@@ -53,26 +53,52 @@ module Hako
53
53
  load_balancer = describe_load_balancer
54
54
  unless load_balancer
55
55
  tags = @elb_v2_config.fetch('tags', {}).map { |k, v| { key: k, value: v.to_s } }
56
- load_balancer = elb_client.create_load_balancer(
57
- name: name,
58
- subnets: @elb_v2_config.fetch('subnets'),
59
- security_groups: @elb_v2_config.fetch('security_groups'),
60
- scheme: @elb_v2_config.fetch('scheme', nil),
61
- tags: tags.empty? ? nil : tags,
62
- ).load_balancers[0]
63
- Hako.logger.info "Created ELBv2 #{load_balancer.dns_name}"
56
+
57
+ elb_type = @elb_v2_config.fetch('type', nil)
58
+ if elb_type == 'network'
59
+ load_balancer = elb_client.create_load_balancer(
60
+ name: name,
61
+ subnets: @elb_v2_config.fetch('subnets'),
62
+ scheme: @elb_v2_config.fetch('scheme', nil),
63
+ type: 'network',
64
+ tags: tags.empty? ? nil : tags,
65
+ ).load_balancers[0]
66
+ Hako.logger.info "Created ELBv2(NLB) #{load_balancer.dns_name}"
67
+ else
68
+ load_balancer = elb_client.create_load_balancer(
69
+ name: name,
70
+ subnets: @elb_v2_config.fetch('subnets'),
71
+ security_groups: @elb_v2_config.fetch('security_groups'),
72
+ scheme: @elb_v2_config.fetch('scheme', nil),
73
+ type: @elb_v2_config.fetch('type', nil),
74
+ tags: tags.empty? ? nil : tags,
75
+ ).load_balancers[0]
76
+ Hako.logger.info "Created ELBv2 #{load_balancer.dns_name}"
77
+ end
64
78
  end
65
79
 
66
80
  target_group = describe_target_group
67
81
  unless target_group
68
- target_group = elb_client.create_target_group(
69
- name: name,
70
- port: 80,
71
- protocol: 'HTTP',
72
- vpc_id: @elb_v2_config.fetch('vpc_id'),
73
- health_check_path: @elb_v2_config.fetch('health_check_path', nil),
74
- target_type: @elb_v2_config.fetch('target_type', nil),
75
- ).target_groups[0]
82
+ elb_type = @elb_v2_config.fetch('type', nil)
83
+ target_group = if elb_type == 'network'
84
+ elb_client.create_target_group(
85
+ name: name,
86
+ port: 80,
87
+ protocol: 'TCP',
88
+ vpc_id: @elb_v2_config.fetch('vpc_id'),
89
+ target_type: @elb_v2_config.fetch('target_type', nil),
90
+ ).target_groups[0]
91
+ else
92
+ elb_client.create_target_group(
93
+ name: name,
94
+ port: 80,
95
+ protocol: 'HTTP',
96
+ vpc_id: @elb_v2_config.fetch('vpc_id'),
97
+ health_check_path: @elb_v2_config.fetch('health_check_path', nil),
98
+ target_type: @elb_v2_config.fetch('target_type', nil),
99
+ ).target_groups[0]
100
+ end
101
+
76
102
  Hako.logger.info "Created target group #{target_group.target_group_arn}"
77
103
  end
78
104
 
@@ -119,7 +119,7 @@ module Hako
119
119
 
120
120
  # @return [String]
121
121
  def templates_directory
122
- File.expand_path('../../templates', __FILE__)
122
+ File.expand_path('../templates', __dir__)
123
123
  end
124
124
 
125
125
  # @return [String]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hako
4
- VERSION = '2.0.4'
4
+ VERSION = '2.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hako
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Suzuki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-26 00:00:00.000000000 Z
11
+ date: 2018-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-applicationautoscaling
@@ -226,14 +226,14 @@ dependencies:
226
226
  requirements:
227
227
  - - ">="
228
228
  - !ruby/object:Gem::Version
229
- version: 0.50.0
229
+ version: 0.53.0
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - ">="
235
235
  - !ruby/object:Gem::Version
236
- version: 0.50.0
236
+ version: 0.53.0
237
237
  - !ruby/object:Gem::Dependency
238
238
  name: simplecov
239
239
  requirement: !ruby/object:Gem::Requirement
@@ -285,23 +285,22 @@ files:
285
285
  - bin/setup
286
286
  - docs/ecs-task-notification.md
287
287
  - docs/jsonnet.md
288
- - examples/create_aws_cloud_watch_logs_log_group.yml
288
+ - examples/create_aws_cloud_watch_logs_log_group.libsonnet
289
289
  - examples/front.libsonnet
290
290
  - examples/front.yml
291
- - examples/hello-autoscaling-group.yml
292
- - examples/hello-autoscaling.yml
293
- - examples/hello-awslogs-driver.yml
294
- - examples/hello-cap-add-app.yml
295
- - examples/hello-fargate-batch.yml
291
+ - examples/hello-autoscaling-group.jsonnet
292
+ - examples/hello-autoscaling.jsonnet
293
+ - examples/hello-awslogs-driver.jsonnet
294
+ - examples/hello-cap-add-app.jsonnet
295
+ - examples/hello-fargate-batch.jsonnet
296
296
  - examples/hello-fargate.jsonnet
297
- - examples/hello-fargate.yml
298
- - examples/hello-lb-v2.yml
299
- - examples/hello-lb.yml
300
- - examples/hello-nofront.yml
301
- - examples/hello-privileged-app.yml
297
+ - examples/hello-internal-nlb.jsonnet
298
+ - examples/hello-lb-v2.jsonnet
299
+ - examples/hello-lb.jsonnet
300
+ - examples/hello-nofront.jsonnet
301
+ - examples/hello-privileged-app.jsonnet
302
302
  - examples/hello.env
303
303
  - examples/hello.jsonnet
304
- - examples/hello.yml
305
304
  - examples/put-ecs-container-status-to-s3/index.js
306
305
  - examples/put-ecs-container-status-to-s3/package.json
307
306
  - exe/hako
@@ -1 +0,0 @@
1
- type: create_aws_cloud_watch_logs_log_group
@@ -1,14 +0,0 @@
1
- scheduler:
2
- type: ecs
3
- region: ap-northeast-1
4
- cluster: eagletmt
5
- role: ecsServiceRole
6
- autoscaling_group_for_oneshot: hako-batch-cluster
7
- app:
8
- image: ryotarai/hello-sinatra
9
- memory: 128
10
- cpu: 256
11
- env:
12
- PORT: '3000'
13
- MESSAGE: 'hello'
14
- command: ['echo', 'heavy offline job']
@@ -1,56 +0,0 @@
1
- scheduler:
2
- type: ecs
3
- region: ap-northeast-1
4
- cluster: eagletmt
5
- desired_count: 2
6
- role: ecsServiceRole
7
- elb:
8
- listeners:
9
- - load_balancer_port: 80
10
- protocol: HTTP
11
- subnets:
12
- - subnet-XXXXXXXX
13
- - subnet-YYYYYYYY
14
- security_groups:
15
- - sg-ZZZZZZZZ
16
- autoscaling:
17
- role_arn: arn:aws:iam::012345678901:role/ecsAutoscaleRole
18
- min_capacity: 1
19
- max_capacity: 4
20
- policies:
21
- # Add one task when ecs-scaling-out-hello-autoscaling-service is in alarm state
22
- - alarms: [ecs-scaling-out-hello-autoscaling-service]
23
- cooldown: 300
24
- adjustment_type: ChangeInCapacity
25
- scaling_adjustment: 1
26
- metric_interval_lower_bound: 0
27
- metric_aggregation_type: Average
28
- # Remove one task when ecs-scaling-in-hello-autoscaling-service is in alarm state
29
- - alarms: [ecs-scaling-in-hello-autoscaling-service]
30
- cooldown: 300
31
- adjustment_type: ChangeInCapacity
32
- scaling_adjustment: -1
33
- metric_interval_upper_bound: 0
34
- metric_aggregation_type: Average
35
- app:
36
- image: ryotarai/hello-sinatra
37
- memory: 128
38
- cpu: 256
39
- env:
40
- $providers:
41
- - type: file
42
- path: hello.env
43
- PORT: '3000'
44
- MESSAGE: '#{username}-san'
45
- additional_containers:
46
- front:
47
- image_tag: hako-nginx
48
- memory: 32
49
- cpu: 32
50
- scripts:
51
- - <<: !include front.yml
52
- backend_port: 3000
53
- locations:
54
- /:
55
- allow_only_from:
56
- - 10.0.0.0/24
@@ -1,18 +0,0 @@
1
- scheduler:
2
- type: ecs
3
- region: ap-northeast-1
4
- cluster: eagletmt
5
- desired_count: 1
6
- app:
7
- image: busybox
8
- memory: 128
9
- cpu: 256
10
- command: ['echo', 'hello awslogs']
11
- log_configuration:
12
- log_driver: awslogs
13
- options:
14
- awslogs-group: my-logs
15
- awslogs-region: ap-northeast-1
16
- awslogs-stream-prefix: example
17
- scripts:
18
- - <<: !include create_aws_cloud_watch_logs_log_group.yml
@@ -1,13 +0,0 @@
1
- scheduler:
2
- type: ecs
3
- region: ap-northeast-1
4
- cluster: eagletmt
5
- desired_count: 1
6
- app:
7
- image: busybox
8
- memory: 128
9
- cpu: 256
10
- command: ['echo', 'hello with SYS_RAWIO']
11
- linux_parameters:
12
- capabilities:
13
- add: ['SYS_RAWIO']
@@ -1,31 +0,0 @@
1
- scheduler:
2
- type: ecs
3
- region: us-east-1
4
- cluster: eagletmt
5
- # Fargate
6
- execution_role_arn: arn:aws:iam::012345678901:role/ecsTaskExecutionRole
7
- cpu: '1024'
8
- memory: '2048'
9
- requires_compatibilities: ['FARGATE']
10
- network_mode: awsvpc
11
- launch_type: FARGATE
12
- network_configuration:
13
- awsvpc_configuration:
14
- subnets:
15
- - subnet-XXXXXXXX
16
- security_groups: []
17
- assign_public_ip: DISABLED
18
-
19
- app:
20
- image: ryotarai/hello-sinatra
21
- cpu: 1024
22
- memory: 256
23
- memory_reservation: 128
24
- log_configuration:
25
- log_driver: awslogs
26
- options:
27
- awslogs-group: /ecs/hello-fargate-batch
28
- awslogs-region: us-east-1
29
- awslogs-stream-prefix: ecs
30
- scripts:
31
- - type: create_aws_cloud_watch_logs_log_group
@@ -1,68 +0,0 @@
1
- scheduler:
2
- type: ecs
3
- region: us-east-1
4
- cluster: eagletmt
5
- desired_count: 1
6
- task_role_arn: arn:aws:iam::012345678901:role/EcsDefault
7
- elb_v2:
8
- vpc_id: vpc-xxxxxxxx
9
- health_check_path: /site/sha
10
- listeners:
11
- - port: 80
12
- protocol: HTTP
13
- - port: 443
14
- protocol: HTTPS
15
- certificate_arn: arn:aws:acm:us-east-1:012345678901:certificate/01234567-89ab-cdef-0123-456789abcdef
16
- subnets:
17
- - subnet-xxxxxxxx
18
- - subnet-yyyyyyyy
19
- security_groups:
20
- - sg-xxxxxxxx
21
- load_balancer_attributes:
22
- access_logs.s3.enabled: 'true'
23
- access_logs.s3.bucket: hako-access-logs
24
- access_logs.s3.prefix: hako-hello-fargate
25
- idle_timeout.timeout_seconds: '5'
26
- target_group_attributes:
27
- deregistration_delay.timeout_seconds: '20'
28
- # Fargate
29
- execution_role_arn: arn:aws:iam::012345678901:role/ecsTaskExecutionRole
30
- cpu: '1024'
31
- memory: '2048'
32
- requires_compatibilities: ['FARGATE']
33
- network_mode: awsvpc
34
- launch_type: FARGATE
35
- network_configuration:
36
- awsvpc_configuration:
37
- subnets:
38
- - subnet-zzzzzzzz
39
- - subnet-wwwwwwww
40
- security_groups:
41
- - sg-yyyyyyyy
42
- - sg-zzzzzzzz
43
- assign_public_ip: DISABLED
44
- app:
45
- image: ryotarai/hello-sinatra
46
- cpu: 128
47
- memory: 256
48
- env:
49
- PORT: '3000'
50
- MESSAGE: 'Hello, Fargate'
51
- log_configuration:
52
- log_driver: awslogs
53
- options:
54
- awslogs-group: /ecs/hello-fargate
55
- awslogs-region: us-east-1
56
- awslogs-stream-prefix: ecs
57
- additional_containers:
58
- front:
59
- image_tag: hako-nginx
60
- log_configuration:
61
- log_driver: awslogs
62
- options:
63
- awslogs-group: /ecs/hello-fargate
64
- awslogs-region: us-east-1
65
- awslogs-stream-prefix: ecs
66
- scripts:
67
- - <<: !include front.yml
68
- backend_port: 3000
@@ -1,53 +0,0 @@
1
- scheduler:
2
- type: ecs
3
- region: ap-northeast-1
4
- cluster: eagletmt
5
- desired_count: 2
6
- role: ecsServiceRole
7
- # dynamic_port_mapping is enabled by default with elb_v2
8
- # dynamic_port_mapping: false
9
- elb_v2:
10
- # VPC id where the target group is located
11
- vpc_id: vpc-WWWWWWWW
12
- # Health check path of the target group
13
- health_check_path: /site/sha
14
- listeners:
15
- - port: 80
16
- protocol: HTTP
17
- - port: 443
18
- protocol: HTTPS
19
- certificate_arn: arn:aws:iam::012345678901:server-certificate/hello-lb-v2.example.com
20
- subnets:
21
- - subnet-XXXXXXXX
22
- - subnet-YYYYYYYY
23
- security_groups:
24
- - sg-ZZZZZZZZ
25
- load_balancer_attributes:
26
- access_logs.s3.enabled: 'true'
27
- access_logs.s3.bucket: hako-access-logs
28
- access_logs.s3.prefix: hako-hello-lb-v2
29
- target_group_attributes:
30
- deregistration_delay.timeout_seconds: '20'
31
- # http://docs.aws.amazon.com/en_us/elasticloadbalancing/latest/application/load-balancer-target-groups.html#target-group-attributes
32
- app:
33
- image: ryotarai/hello-sinatra
34
- memory: 128
35
- cpu: 256
36
- env:
37
- $providers:
38
- - type: file
39
- path: hello.env
40
- PORT: '3000'
41
- MESSAGE: '#{username}-san'
42
- additional_containers:
43
- front:
44
- image_tag: hako-nginx
45
- memory: 32
46
- cpu: 32
47
- scripts:
48
- - <<: !include front.yml
49
- backend_port: 3000
50
- locations:
51
- /:
52
- allow_only_from:
53
- - 10.0.0.0/24
@@ -1,38 +0,0 @@
1
- scheduler:
2
- type: ecs
3
- region: ap-northeast-1
4
- cluster: eagletmt
5
- desired_count: 2
6
- role: ecsServiceRole
7
- # dynamic_port_mapping cannot be enabled with elb
8
- elb:
9
- listeners:
10
- - load_balancer_port: 80
11
- protocol: HTTP
12
- subnets:
13
- - subnet-XXXXXXXX
14
- - subnet-YYYYYYYY
15
- security_groups:
16
- - sg-ZZZZZZZZ
17
- app:
18
- image: ryotarai/hello-sinatra
19
- memory: 128
20
- cpu: 256
21
- env:
22
- $providers:
23
- - type: file
24
- path: hello.env
25
- PORT: '3000'
26
- MESSAGE: '#{username}-san'
27
- additional_containers:
28
- front:
29
- image_tag: hako-nginx
30
- memory: 32
31
- cpu: 32
32
- scripts:
33
- - <<: !include front.yml
34
- backend_port: 3000
35
- locations:
36
- /:
37
- allow_only_from:
38
- - 10.0.0.0/24
@@ -1,44 +0,0 @@
1
- scheduler:
2
- type: ecs
3
- region: ap-northeast-1
4
- cluster: eagletmt
5
- desired_count: 2
6
- role: ecsServiceRole
7
- elb_v2:
8
- # VPC id where the target group is located
9
- vpc_id: vpc-WWWWWWWW
10
- # Health check path of the target group
11
- health_check_path: /site/sha
12
- listeners:
13
- - port: 80
14
- protocol: HTTP
15
- - port: 443
16
- protocol: HTTPS
17
- certificate_arn: arn:aws:iam::012345678901:server-certificate/hello-lb-v2.example.com
18
- subnets:
19
- - subnet-XXXXXXXX
20
- - subnet-YYYYYYYY
21
- security_groups:
22
- - sg-ZZZZZZZZ
23
- load_balancer_attributes:
24
- access_logs.s3.enabled: 'true'
25
- access_logs.s3.bucket: hako-access-logs
26
- access_logs.s3.prefix: hako-hello-lb-v2
27
- # Connect ELB to app container
28
- container_name: app
29
- container_port: 3000
30
- app:
31
- image: ryotarai/hello-sinatra
32
- memory: 128
33
- cpu: 256
34
- env:
35
- $providers:
36
- - type: file
37
- path: hello.env
38
- PORT: '3000'
39
- MESSAGE: '#{username}-san'
40
- # Add port mapping to connect to ELB
41
- port_mappings:
42
- - container_port: 3000
43
- host_port: 0
44
- protocol: tcp
@@ -1,11 +0,0 @@
1
- scheduler:
2
- type: ecs
3
- region: ap-northeast-1
4
- cluster: eagletmt
5
- desired_count: 1
6
- app:
7
- image: busybox
8
- memory: 128
9
- cpu: 256
10
- command: ['echo', 'hello from --privileged mode']
11
- privileged: true
@@ -1,35 +0,0 @@
1
- scheduler:
2
- type: ecs
3
- region: ap-northeast-1
4
- cluster: eagletmt
5
- desired_count: 2
6
- task_role_arn: arn:aws:iam::012345678901:role/HelloRole
7
- # dynamic_port_mapping is enabled by default with no ELB option
8
- # dynamic_port_mapping: false
9
- deployment_configuration:
10
- maximum_percent: 200
11
- minimum_healthy_percent: 50
12
- app:
13
- image: ryotarai/hello-sinatra
14
- memory: 128
15
- cpu: 256
16
- links:
17
- - redis:redis
18
- env:
19
- $providers:
20
- - type: file
21
- path: hello.env
22
- PORT: '3000'
23
- MESSAGE: '#{username}-san'
24
- additional_containers:
25
- front:
26
- image_tag: hako-nginx
27
- memory: 32
28
- cpu: 32
29
- redis:
30
- image_tag: redis:3.0
31
- cpu: 64
32
- memory: 512
33
- scripts:
34
- - <<: !include front.yml
35
- backend_port: 3000