hako 2.14.0 → 2.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +37 -0
- data/.rubocop.yml +6 -1
- data/.rubocop_todo.yml +0 -2
- data/CHANGELOG.md +18 -0
- data/README.md +1 -1
- data/examples/hello-fargate-batch.jsonnet +3 -0
- data/examples/hello-fargate.jsonnet +3 -0
- data/examples/hello-grpc.jsonnet +60 -0
- data/hako.gemspec +2 -3
- data/lib/hako/cli.rb +3 -3
- data/lib/hako/commander.rb +2 -2
- data/lib/hako/env_providers/file.rb +1 -1
- data/lib/hako/env_providers/yaml.rb +1 -1
- data/lib/hako/schedulers/ecs.rb +48 -36
- data/lib/hako/schedulers/ecs_autoscaling.rb +1 -3
- data/lib/hako/schedulers/ecs_elb_v2.rb +10 -1
- data/lib/hako/schedulers/ecs_service_discovery.rb +2 -2
- data/lib/hako/scripts/nginx_front.rb +3 -3
- data/lib/hako/version.rb +1 -1
- metadata +11 -24
- data/.travis.yml +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 247a60cab9d7f9bec3f63bb9858453499066c9b54d23ce9f1d8bae69c133973a
|
4
|
+
data.tar.gz: c004ff0c4aac3d742f89f4eeb455ff189acebabc0d398dc586eb835902129577
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3a12ca201d09312f3c71e18e7418941aaf9330ad99d7acccb32094f0579d3085817004cea7209691d43a4f00f3181c242fbe452cc856ae9aad723bbf05d829b
|
7
|
+
data.tar.gz: a110da777e6ab79a3af3a3ebd6d6923e2428b59947208ad0bf771577bb45fb775ccbe723d0377d32e6b3df52419914e60ff1681a574db304763f11d13c3b6bf4
|
@@ -0,0 +1,37 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
pull_request:
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
rspec:
|
10
|
+
name: RSpec
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
matrix:
|
15
|
+
ruby:
|
16
|
+
- '2.6'
|
17
|
+
- '2.7'
|
18
|
+
- '3.0'
|
19
|
+
- '3.1'
|
20
|
+
steps:
|
21
|
+
- uses: actions/checkout@v2
|
22
|
+
- uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: ${{ matrix.ruby }}
|
25
|
+
bundler-cache: true
|
26
|
+
- run: bundle exec rspec
|
27
|
+
rubocop:
|
28
|
+
name: RuboCop
|
29
|
+
runs-on: ubuntu-latest
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v2
|
32
|
+
- uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
# Use the same version with .rubocop.yml
|
35
|
+
ruby-version: 2.6
|
36
|
+
bundler-cache: true
|
37
|
+
- run: bundle exec rubocop
|
data/.rubocop.yml
CHANGED
@@ -2,10 +2,13 @@ inherit_from: .rubocop_todo.yml
|
|
2
2
|
|
3
3
|
AllCops:
|
4
4
|
DisplayCopNames: true
|
5
|
-
TargetRubyVersion: 2.
|
5
|
+
TargetRubyVersion: 2.6
|
6
|
+
NewCops: disable
|
6
7
|
|
7
8
|
Layout/FirstArgumentIndentation:
|
8
9
|
Enabled: false
|
10
|
+
Layout/LineLength:
|
11
|
+
Enabled: false
|
9
12
|
|
10
13
|
Naming/PredicateName:
|
11
14
|
Enabled: false
|
@@ -35,6 +38,8 @@ Style/RaiseArgs:
|
|
35
38
|
EnforcedStyle: compact
|
36
39
|
Style/SignalException:
|
37
40
|
Enabled: false
|
41
|
+
Style/SoleNestedConditional:
|
42
|
+
Enabled: false
|
38
43
|
Style/StderrPuts:
|
39
44
|
Enabled: false
|
40
45
|
Style/TrailingCommaInArguments:
|
data/.rubocop_todo.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
# 2.16.0 (2022-05-02)
|
2
|
+
## New features
|
3
|
+
- Support ephemeral_storage option in ECS scheduler
|
4
|
+
|
5
|
+
## Bug fixes
|
6
|
+
- Fix keyword arguments for Ruby 3.0
|
7
|
+
|
8
|
+
## Changes
|
9
|
+
- Drop support for Ruby 2.5 (EOL on 2021-04-05)
|
10
|
+
|
11
|
+
# 2.15.1 (2021-08-06)
|
12
|
+
## Bug fixes
|
13
|
+
- Fix keyword arguments for Ruby 3.0
|
14
|
+
|
15
|
+
# 2.15.0 (2020-11-02)
|
16
|
+
## New features
|
17
|
+
- Support protocol_version and matcher option of ALB target groups
|
18
|
+
|
1
19
|
# 2.14.0 (2020-05-20)
|
2
20
|
## New features
|
3
21
|
- Support tags for task definition and propagate them to ECS tasks
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Hako
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/hako.svg)](http://badge.fury.io/rb/hako)
|
3
|
-
|
3
|
+
![CI](https://github.com/eagletmt/hako/workflows/CI/badge.svg)
|
4
4
|
|
5
5
|
Deploy Docker container.
|
6
6
|
|
@@ -51,6 +51,9 @@ local awslogs = {
|
|
51
51
|
execution_role_arn: 'arn:aws:iam::012345678901:role/ecsTaskExecutionRole',
|
52
52
|
cpu: '1024',
|
53
53
|
memory: '2048',
|
54
|
+
ephemeral_storage: {
|
55
|
+
size_in_gi_b: '25',
|
56
|
+
},
|
54
57
|
requires_compatibilities: ['FARGATE'],
|
55
58
|
network_mode: 'awsvpc',
|
56
59
|
launch_type: 'FARGATE',
|
@@ -0,0 +1,60 @@
|
|
1
|
+
{
|
2
|
+
scheduler: {
|
3
|
+
type: 'ecs',
|
4
|
+
region: 'ap-northeast-1',
|
5
|
+
cluster: 'eagletmt',
|
6
|
+
desired_count: 2,
|
7
|
+
role: 'ecsServiceRole',
|
8
|
+
elb_v2: {
|
9
|
+
// Specify protocol_version for gRPC servers
|
10
|
+
protocol_version: 'GRPC',
|
11
|
+
// VPC id where the target group is located
|
12
|
+
vpc_id: 'vpc-WWWWWWWW',
|
13
|
+
// If you want internal ELB, then use 'scheme'. (ex. internal service that like microservice inside VPC)
|
14
|
+
scheme: 'internal',
|
15
|
+
// Health check path of the target group
|
16
|
+
health_check_path: '/AWS.ELB/healthcheck',
|
17
|
+
listeners: [
|
18
|
+
{
|
19
|
+
port: 50051,
|
20
|
+
protocol: 'HTTPS',
|
21
|
+
certificate_arn: 'arn:aws:acm:ap-northeast-1:012345678901:certificate/01234567-89ab-cdef-0123-456789abcdef',
|
22
|
+
},
|
23
|
+
],
|
24
|
+
subnets: ['subnet-XXXXXXXX', 'subnet-YYYYYYYY'],
|
25
|
+
security_groups: ['sg-ZZZZZZZZ'],
|
26
|
+
load_balancer_attributes: {
|
27
|
+
'access_logs.s3.enabled': 'true',
|
28
|
+
'access_logs.s3.bucket': 'hako-access-logs',
|
29
|
+
'access_logs.s3.prefix': 'hako-hello-grpc',
|
30
|
+
},
|
31
|
+
target_group_attributes: {
|
32
|
+
// http://docs.aws.amazon.com/en_us/elasticloadbalancing/latest/application/load-balancer-target-groups.html#target-group-attributes
|
33
|
+
'deregistration_delay.timeout_seconds': '20',
|
34
|
+
},
|
35
|
+
// Route ELB traffic to app container directly
|
36
|
+
container_name: 'app',
|
37
|
+
container: 50051,
|
38
|
+
},
|
39
|
+
},
|
40
|
+
app: {
|
41
|
+
image: 'awesome-grpc-server',
|
42
|
+
memory: 128,
|
43
|
+
cpu: 256,
|
44
|
+
env: {
|
45
|
+
PORT: '50051',
|
46
|
+
},
|
47
|
+
secrets: [{
|
48
|
+
name: 'MESSAGE',
|
49
|
+
value_from: 'arn:aws:ssm:ap-northeast-1:012345678901:parameter/hako/hello-grpc/secret-message',
|
50
|
+
}],
|
51
|
+
port_mappings: [
|
52
|
+
{
|
53
|
+
container_port: 50051,
|
54
|
+
host_port: 0,
|
55
|
+
protocol: 'tcp',
|
56
|
+
},
|
57
|
+
],
|
58
|
+
},
|
59
|
+
scripts: [],
|
60
|
+
}
|
data/hako.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.bindir = 'exe'
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ['lib']
|
22
|
-
spec.required_ruby_version = '>= 2.
|
22
|
+
spec.required_ruby_version = '>= 2.6.0'
|
23
23
|
|
24
24
|
spec.add_dependency 'aws-sdk-applicationautoscaling'
|
25
25
|
spec.add_dependency 'aws-sdk-autoscaling'
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_dependency 'aws-sdk-ec2'
|
29
29
|
spec.add_dependency 'aws-sdk-ecs', '>= 1.54.0'
|
30
30
|
spec.add_dependency 'aws-sdk-elasticloadbalancing'
|
31
|
-
spec.add_dependency 'aws-sdk-elasticloadbalancingv2'
|
31
|
+
spec.add_dependency 'aws-sdk-elasticloadbalancingv2', '>= 1.54.0'
|
32
32
|
spec.add_dependency 'aws-sdk-s3'
|
33
33
|
spec.add_dependency 'aws-sdk-servicediscovery'
|
34
34
|
spec.add_dependency 'aws-sdk-sns'
|
@@ -36,7 +36,6 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_dependency 'jsonnet'
|
37
37
|
|
38
38
|
spec.add_development_dependency 'bundler'
|
39
|
-
spec.add_development_dependency 'coveralls'
|
40
39
|
spec.add_development_dependency 'rake'
|
41
40
|
spec.add_development_dependency 'rspec'
|
42
41
|
spec.add_development_dependency 'rubocop', '>= 0.53.0'
|
data/lib/hako/cli.rb
CHANGED
@@ -73,7 +73,7 @@ module Hako
|
|
73
73
|
else
|
74
74
|
{}
|
75
75
|
end
|
76
|
-
Commander.new(Application.new(@definition_path, options)).deploy(force: @force, tag: @tag, dry_run: @dry_run, timeout: @timeout)
|
76
|
+
Commander.new(Application.new(@definition_path, **options)).deploy(force: @force, tag: @tag, dry_run: @dry_run, timeout: @timeout)
|
77
77
|
end
|
78
78
|
|
79
79
|
DEFAULT_TIMEOUT = 1200 # 20 minutes
|
@@ -121,7 +121,7 @@ module Hako
|
|
121
121
|
else
|
122
122
|
{}
|
123
123
|
end
|
124
|
-
Commander.new(Application.new(@definition_path, options)).rollback(dry_run: @dry_run)
|
124
|
+
Commander.new(Application.new(@definition_path, **options)).rollback(dry_run: @dry_run)
|
125
125
|
end
|
126
126
|
|
127
127
|
def parse!(argv)
|
@@ -164,7 +164,7 @@ module Hako
|
|
164
164
|
else
|
165
165
|
{}
|
166
166
|
end
|
167
|
-
Commander.new(Application.new(@definition_path, options)).oneshot(@argv, tag: @tag, containers: @containers, env: @env, dry_run: @dry_run, no_wait: @no_wait, overrides: @overrides)
|
167
|
+
Commander.new(Application.new(@definition_path, **options)).oneshot(@argv, tag: @tag, containers: @containers, env: @env, dry_run: @dry_run, no_wait: @no_wait, overrides: @overrides)
|
168
168
|
end
|
169
169
|
|
170
170
|
def parse!(argv)
|
data/lib/hako/commander.rb
CHANGED
@@ -18,7 +18,7 @@ module Hako
|
|
18
18
|
# @param [String, nil] tag
|
19
19
|
# @param [Boolean] dry_run
|
20
20
|
# @return [nil]
|
21
|
-
def deploy(force: false,
|
21
|
+
def deploy(tag:, timeout:, force: false, dry_run: false)
|
22
22
|
containers = load_containers(tag, dry_run: dry_run)
|
23
23
|
scripts = @app.definition.fetch('scripts', []).map { |config| load_script(config, dry_run: dry_run) }
|
24
24
|
volumes = @app.definition.fetch('volumes', {})
|
@@ -126,7 +126,7 @@ module Hako
|
|
126
126
|
# @param [Boolean] dry_run
|
127
127
|
# @param [Integer] timeout
|
128
128
|
# @return [Scheduler]
|
129
|
-
def load_scheduler(scheduler_definition, scripts, volumes: {}, force: false,
|
129
|
+
def load_scheduler(scheduler_definition, scripts, dry_run:, volumes: {}, force: false, timeout: nil)
|
130
130
|
Loader.new(Hako::Schedulers, 'hako/schedulers').load(scheduler_definition.fetch('type')).new(@app.id, scheduler_definition, volumes: volumes, scripts: scripts, force: force, dry_run: dry_run, timeout: timeout)
|
131
131
|
end
|
132
132
|
|
@@ -7,7 +7,7 @@ module Hako
|
|
7
7
|
class File < EnvProvider
|
8
8
|
# @param [Pathname] root_path
|
9
9
|
# @param [Hash<String, Object>] options
|
10
|
-
def initialize(root_path, options)
|
10
|
+
def initialize(root_path, options) # rubocop:disable Lint/MissingSuper
|
11
11
|
unless options['path']
|
12
12
|
validation_error!('path must be set')
|
13
13
|
end
|
@@ -8,7 +8,7 @@ module Hako
|
|
8
8
|
class Yaml < EnvProvider
|
9
9
|
# @param [Pathname] root_path
|
10
10
|
# @param [Hash<String, Object>] options
|
11
|
-
def initialize(root_path, options)
|
11
|
+
def initialize(root_path, options) # rubocop:disable Lint/MissingSuper
|
12
12
|
unless options['path']
|
13
13
|
validation_error!('path must be set')
|
14
14
|
end
|
data/lib/hako/schedulers/ecs.rb
CHANGED
@@ -72,6 +72,14 @@ module Hako
|
|
72
72
|
@execution_role_arn = options.fetch('execution_role_arn', nil)
|
73
73
|
@cpu = options.fetch('cpu', nil)
|
74
74
|
@memory = options.fetch('memory', nil)
|
75
|
+
if options.key?('ephemeral_storage')
|
76
|
+
ephemeral_storage = options.fetch('ephemeral_storage')
|
77
|
+
if ephemeral_storage.key?('size_in_gi_b')
|
78
|
+
@ephemeral_storage = {
|
79
|
+
size_in_gi_b: ephemeral_storage.fetch('size_in_gi_b')
|
80
|
+
}
|
81
|
+
end
|
82
|
+
end
|
75
83
|
@requires_compatibilities = options.fetch('requires_compatibilities', nil)
|
76
84
|
@launch_type = options.fetch('launch_type', nil)
|
77
85
|
if options.key?('capacity_provider_strategy')
|
@@ -515,7 +523,11 @@ module Hako
|
|
515
523
|
if actual_definition.requires_compatibilities != @requires_compatibilities
|
516
524
|
return true
|
517
525
|
end
|
518
|
-
|
526
|
+
if actual_definition.ephemeral_storage != @ephemeral_storage
|
527
|
+
return true
|
528
|
+
end
|
529
|
+
|
530
|
+
actual_tags_set = Set.new(actual_tags.map { |t| { key: t.key, value: t.value } })
|
519
531
|
tags_set = Set.new(@tags)
|
520
532
|
if actual_tags_set != tags_set
|
521
533
|
return true
|
@@ -556,6 +568,7 @@ module Hako
|
|
556
568
|
requires_compatibilities: @requires_compatibilities,
|
557
569
|
cpu: @cpu,
|
558
570
|
memory: @memory,
|
571
|
+
ephemeral_storage: @ephemeral_storage,
|
559
572
|
tags: @tags.empty? ? nil : @tags,
|
560
573
|
).task_definition
|
561
574
|
[true, new_task_definition]
|
@@ -576,38 +589,37 @@ module Hako
|
|
576
589
|
# @return [Array<Boolean, Aws::ECS::Types::TaskDefinition]
|
577
590
|
def register_task_definition_for_oneshot(definitions)
|
578
591
|
10.times do |i|
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
end
|
592
|
+
family = "#{@app_id}-oneshot"
|
593
|
+
current_task_definition = describe_task_definition(family)
|
594
|
+
if current_task_definition
|
595
|
+
current_tags = ecs_client.list_tags_for_resource(resource_arn: current_task_definition.task_definition_arn).tags
|
596
|
+
end
|
597
|
+
if task_definition_changed?(definitions, current_task_definition, current_tags)
|
598
|
+
new_task_definition = ecs_client.register_task_definition(
|
599
|
+
family: family,
|
600
|
+
task_role_arn: @task_role_arn,
|
601
|
+
execution_role_arn: @execution_role_arn,
|
602
|
+
network_mode: @network_mode,
|
603
|
+
container_definitions: definitions,
|
604
|
+
volumes: volumes_definition,
|
605
|
+
requires_compatibilities: @requires_compatibilities,
|
606
|
+
cpu: @cpu,
|
607
|
+
memory: @memory,
|
608
|
+
ephemeral_storage: @ephemeral_storage,
|
609
|
+
tags: @tags.empty? ? nil : @tags,
|
610
|
+
).task_definition
|
611
|
+
return [true, new_task_definition]
|
612
|
+
else
|
613
|
+
return [false, current_task_definition]
|
614
|
+
end
|
615
|
+
rescue Aws::ECS::Errors::ClientException => e
|
616
|
+
if e.message.include?('Too many concurrent attempts to create a new revision of the specified family')
|
617
|
+
Hako.logger.error(e.message)
|
618
|
+
interval = 2**i + rand(0.0..10.0)
|
619
|
+
Hako.logger.error("Retrying register_task_definition_for_oneshot after #{interval} seconds")
|
620
|
+
sleep(interval)
|
621
|
+
else
|
622
|
+
raise e
|
611
623
|
end
|
612
624
|
end
|
613
625
|
raise Error.new('Unable to register task definition for oneshot due to too many client errors')
|
@@ -917,7 +929,7 @@ module Hako
|
|
917
929
|
warn_placement_policy_change(current_service)
|
918
930
|
warn_service_registries_change(current_service)
|
919
931
|
if service_changed?(current_service, params)
|
920
|
-
ecs_client.update_service(params).service
|
932
|
+
ecs_client.update_service(**params).service
|
921
933
|
else
|
922
934
|
:noop
|
923
935
|
end
|
@@ -953,7 +965,7 @@ module Hako
|
|
953
965
|
@service_discovery.apply
|
954
966
|
params[:service_registries] = @service_discovery.service_registries
|
955
967
|
end
|
956
|
-
ecs_client.create_service(params).service
|
968
|
+
ecs_client.create_service(**params).service
|
957
969
|
end
|
958
970
|
|
959
971
|
# @param [Aws::ECS::Types::Service] service
|
@@ -1323,7 +1335,7 @@ module Hako
|
|
1323
1335
|
when 'NONE'
|
1324
1336
|
cmd << '--no-healthcheck'
|
1325
1337
|
when 'CMD', 'CMD-SHELL'
|
1326
|
-
health_check_command = definition[:health_check][:command][1
|
1338
|
+
health_check_command = definition[:health_check][:command][1..].join(' ')
|
1327
1339
|
cmd << '--health-cmd' << health_check_command.inspect
|
1328
1340
|
else
|
1329
1341
|
raise "Health check command type #{health_check_command_type} is not supported. CMD, CMD-SHELL and NONE are supported."
|
@@ -162,9 +162,7 @@ module Hako
|
|
162
162
|
end
|
163
163
|
|
164
164
|
class Policy
|
165
|
-
attr_reader :policy_type
|
166
|
-
attr_reader :alarms, :cooldown, :adjustment_type, :scaling_adjustment, :metric_interval_lower_bound, :metric_interval_upper_bound, :metric_aggregation_type
|
167
|
-
attr_reader :target_value, :predefined_metric_type, :scale_out_cooldown, :scale_in_cooldown, :disable_scale_in
|
165
|
+
attr_reader :policy_type, :alarms, :cooldown, :adjustment_type, :scaling_adjustment, :metric_interval_lower_bound, :metric_interval_upper_bound, :metric_aggregation_type, :target_value, :predefined_metric_type, :scale_out_cooldown, :scale_in_cooldown, :disable_scale_in
|
168
166
|
|
169
167
|
# @param [Hash] options
|
170
168
|
def initialize(options)
|
@@ -89,13 +89,22 @@ module Hako
|
|
89
89
|
target_type: @elb_v2_config.fetch('target_type', nil),
|
90
90
|
).target_groups[0]
|
91
91
|
else
|
92
|
+
matcher =
|
93
|
+
if @elb_v2_config.key?('matcher')
|
94
|
+
{
|
95
|
+
http_code: @elb_v2_config.fetch('matcher')['http_code'],
|
96
|
+
grpc_code: @elb_v2_config.fetch('matcher')['grpc_code'],
|
97
|
+
}
|
98
|
+
end
|
92
99
|
elb_client.create_target_group(
|
93
100
|
name: target_group_name,
|
94
101
|
port: 80,
|
95
102
|
protocol: 'HTTP',
|
103
|
+
protocol_version: @elb_v2_config.fetch('protocol_version', 'HTTP1'),
|
96
104
|
vpc_id: @elb_v2_config.fetch('vpc_id'),
|
97
105
|
health_check_path: @elb_v2_config.fetch('health_check_path', nil),
|
98
106
|
target_type: @elb_v2_config.fetch('target_type', nil),
|
107
|
+
matcher: matcher,
|
99
108
|
).target_groups[0]
|
100
109
|
end
|
101
110
|
|
@@ -118,7 +127,7 @@ module Hako
|
|
118
127
|
end
|
119
128
|
|
120
129
|
unless listener_ports.include?(params[:port])
|
121
|
-
listener = elb_client.create_listener(params).listeners[0]
|
130
|
+
listener = elb_client.create_listener(**params).listeners[0]
|
122
131
|
Hako.logger.info("Created listener #{listener.listener_arn}")
|
123
132
|
end
|
124
133
|
end
|
@@ -134,7 +134,7 @@ module Hako
|
|
134
134
|
condition: 'EQ',
|
135
135
|
],
|
136
136
|
}
|
137
|
-
services = service_discovery_client.list_services(params).flat_map(&:services)
|
137
|
+
services = service_discovery_client.list_services(**params).flat_map(&:services)
|
138
138
|
services.find { |service| service.name == service_name }
|
139
139
|
end
|
140
140
|
|
@@ -146,7 +146,7 @@ module Hako
|
|
146
146
|
# @param [Hash] service
|
147
147
|
# @return [Aws::ServiceDiscovery::Types::Service]
|
148
148
|
def create_service(service)
|
149
|
-
service_discovery_client.create_service(create_service_params(service)).service
|
149
|
+
service_discovery_client.create_service(**create_service_params(service)).service
|
150
150
|
end
|
151
151
|
|
152
152
|
# @param [Hash] service
|
@@ -10,7 +10,7 @@ module Hako
|
|
10
10
|
class NginxFront < Script
|
11
11
|
S3Config = Struct.new(:region, :bucket, :prefix) do
|
12
12
|
# @param [Hash] options
|
13
|
-
def initialize(options)
|
13
|
+
def initialize(options) # rubocop:disable Lint/MissingSuper
|
14
14
|
self.region = options.fetch('region')
|
15
15
|
self.bucket = options.fetch('bucket')
|
16
16
|
self.prefix = options.fetch('prefix', nil)
|
@@ -107,7 +107,7 @@ module Hako
|
|
107
107
|
|
108
108
|
# @return [String]
|
109
109
|
def render
|
110
|
-
ERB.new(File.read(nginx_conf_erb),
|
110
|
+
ERB.new(File.read(nginx_conf_erb), trim_mode: '-').result(binding)
|
111
111
|
end
|
112
112
|
|
113
113
|
private
|
@@ -150,7 +150,7 @@ module Hako
|
|
150
150
|
# @param [Location] location
|
151
151
|
# @return [String]
|
152
152
|
def render_location(listen_spec, location)
|
153
|
-
ERB.new(File.read(nginx_location_conf_erb),
|
153
|
+
ERB.new(File.read(nginx_location_conf_erb), trim_mode: '-').result(binding).each_line.map do |line|
|
154
154
|
" #{line}"
|
155
155
|
end.join('')
|
156
156
|
end
|
data/lib/hako/version.rb
CHANGED
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.
|
4
|
+
version: 2.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kohei Suzuki
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-applicationautoscaling
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 1.54.0
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 1.54.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: aws-sdk-s3
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,20 +206,6 @@ dependencies:
|
|
206
206
|
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
|
-
- !ruby/object:Gem::Dependency
|
210
|
-
name: coveralls
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - ">="
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '0'
|
216
|
-
type: :development
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - ">="
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '0'
|
223
209
|
- !ruby/object:Gem::Dependency
|
224
210
|
name: rake
|
225
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -298,11 +284,11 @@ executables:
|
|
298
284
|
extensions: []
|
299
285
|
extra_rdoc_files: []
|
300
286
|
files:
|
287
|
+
- ".github/workflows/ci.yml"
|
301
288
|
- ".gitignore"
|
302
289
|
- ".rspec"
|
303
290
|
- ".rubocop.yml"
|
304
291
|
- ".rubocop_todo.yml"
|
305
|
-
- ".travis.yml"
|
306
292
|
- ".yardopts"
|
307
293
|
- CHANGELOG.md
|
308
294
|
- Gemfile
|
@@ -321,6 +307,7 @@ files:
|
|
321
307
|
- examples/hello-cap-add-app.jsonnet
|
322
308
|
- examples/hello-fargate-batch.jsonnet
|
323
309
|
- examples/hello-fargate.jsonnet
|
310
|
+
- examples/hello-grpc.jsonnet
|
324
311
|
- examples/hello-internal-nlb.jsonnet
|
325
312
|
- examples/hello-lb-v2.jsonnet
|
326
313
|
- examples/hello-lb.jsonnet
|
@@ -382,7 +369,7 @@ homepage: https://github.com/eagletmt/hako
|
|
382
369
|
licenses:
|
383
370
|
- MIT
|
384
371
|
metadata: {}
|
385
|
-
post_install_message:
|
372
|
+
post_install_message:
|
386
373
|
rdoc_options: []
|
387
374
|
require_paths:
|
388
375
|
- lib
|
@@ -390,15 +377,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
390
377
|
requirements:
|
391
378
|
- - ">="
|
392
379
|
- !ruby/object:Gem::Version
|
393
|
-
version: 2.
|
380
|
+
version: 2.6.0
|
394
381
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
395
382
|
requirements:
|
396
383
|
- - ">="
|
397
384
|
- !ruby/object:Gem::Version
|
398
385
|
version: '0'
|
399
386
|
requirements: []
|
400
|
-
rubygems_version: 3.1
|
401
|
-
signing_key:
|
387
|
+
rubygems_version: 3.0.3.1
|
388
|
+
signing_key:
|
402
389
|
specification_version: 4
|
403
390
|
summary: Deploy Docker container
|
404
391
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
rvm:
|
4
|
-
- 2.3.8
|
5
|
-
- 2.4.6
|
6
|
-
- 2.5.5
|
7
|
-
- 2.6.3
|
8
|
-
- ruby-head
|
9
|
-
before_install:
|
10
|
-
- gem update --system # https://github.com/rubygems/rubygems/pull/1819
|
11
|
-
- gem install bundler
|
12
|
-
matrix:
|
13
|
-
allow_failures:
|
14
|
-
- rvm: ruby-head
|