From 95617a567c08ddcc6e55340dab8b72b169cc1002 Mon Sep 17 00:00:00 2001 From: Taku Nakajima Date: Thu, 19 Sep 2024 14:04:17 +0900 Subject: [PATCH] Change log driver of runpack to json-file --- app/models/heritage_task_definition.rb | 10 ++++++- spec/models/heritage_task_definition_spec.rb | 29 ++++++++++++++++---- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/app/models/heritage_task_definition.rb b/app/models/heritage_task_definition.rb index 3d32f1d4..34fa8931 100644 --- a/app/models/heritage_task_definition.rb +++ b/app/models/heritage_task_definition.rb @@ -141,8 +141,16 @@ def run_pack_definition cpu: 1, memory: 16, essential: false, - image: "public.ecr.aws/degica/barcelona-run-pack" + image: "public.ecr.aws/degica/barcelona-run-pack", + log_configuration: { + log_driver: "json-file", + options: { + "max-size": "10m", + "max-file": "10" + } + } ) + end def reverse_proxy_definition_tcp diff --git a/spec/models/heritage_task_definition_spec.rb b/spec/models/heritage_task_definition_spec.rb index 9903b96d..66a4d65e 100644 --- a/spec/models/heritage_task_definition_spec.rb +++ b/spec/models/heritage_task_definition_spec.rb @@ -11,7 +11,24 @@ } } } - + let(:expected_log_configuration_for_runpack) { + { + log_driver: "json-file", + options: { + "max-size": "10m", + "max-file": "10" + } + } + } + let(:expected_log_configuration_for_runpack2) { + { + "LogDriver" => "json-file", + "Options" => { + "max-size": "10m", + "max-file": "10" + } + } + } describe ".service_definition" do subject { described_class.service_definition(service).to_task_definition } let(:district) { create :district } @@ -52,7 +69,7 @@ essential: false, image: "public.ecr.aws/degica/barcelona-run-pack", environment: [], - log_configuration: expected_log_configuration + log_configuration: expected_log_configuration_for_runpack } ] }) @@ -105,7 +122,7 @@ essential: false, image: "public.ecr.aws/degica/barcelona-run-pack", environment: [], - log_configuration: expected_log_configuration + log_configuration: expected_log_configuration_for_runpack }, { name: "#{service.service_name}-revpro", @@ -197,7 +214,7 @@ essential: false, image: "public.ecr.aws/degica/barcelona-run-pack", environment: [], - log_configuration: expected_log_configuration + log_configuration: expected_log_configuration_for_runpack }, { name: "#{service.service_name}-revpro", @@ -283,7 +300,7 @@ essential: false, image: "public.ecr.aws/degica/barcelona-run-pack", environment: [], - log_configuration: expected_log_configuration + log_configuration: expected_log_configuration_for_runpack } ] }) @@ -352,7 +369,7 @@ "Essential" => false, "Image" => "public.ecr.aws/degica/barcelona-run-pack", "Environment" => [], - "LogConfiguration" => expected_log_configuration + "LogConfiguration" => expected_log_configuration_for_runpack2 } ] })