From dd2411613e32159343060d7fce6e2532b2734bca Mon Sep 17 00:00:00 2001 From: David Wilkie Date: Thu, 30 May 2024 19:40:17 +0700 Subject: [PATCH] Update services lambda --- .tool-versions | 2 +- components/services/.tool-versions | 1 - components/services/Dockerfile | 8 +-- components/services/Gemfile.lock | 26 ++++----- components/services/spec/support/aws.rb | 41 -------------- .../modules/somleng_switch/services.tf | 54 +++++++++---------- 6 files changed, 47 insertions(+), 85 deletions(-) delete mode 100644 components/services/.tool-versions delete mode 100644 components/services/spec/support/aws.rb diff --git a/.tool-versions b/.tool-versions index 2d76f1a75..dca91f501 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ terraform 1.5.6 -ruby 3.2.2 +ruby 3.3.1 golang 1.22.1 diff --git a/components/services/.tool-versions b/components/services/.tool-versions deleted file mode 100644 index f2a971aa7..000000000 --- a/components/services/.tool-versions +++ /dev/null @@ -1 +0,0 @@ -ruby 3.2.2 diff --git a/components/services/Dockerfile b/components/services/Dockerfile index 1a0bfa48a..8d319b935 100644 --- a/components/services/Dockerfile +++ b/components/services/Dockerfile @@ -1,6 +1,6 @@ ARG FUNCTION_DIR="/function" - -FROM ruby:3.2-alpine as build-image +ARG RUBY_VERSION=3.3 +FROM public.ecr.aws/docker/library/ruby:$RUBY_VERSION-alpine AS build-image RUN apk update && \ apk upgrade && \ @@ -30,7 +30,7 @@ COPY lib/ ${FUNCTION_DIR}/lib/ ############################# -FROM ruby:3.2-alpine +FROM public.ecr.aws/docker/library/ruby:$RUBY_VERSION-alpine ARG FUNCTION_DIR WORKDIR ${FUNCTION_DIR} @@ -44,5 +44,7 @@ RUN apk update && \ gem install bundler && \ gem install aws_lambda_ric +ENV RUBY_YJIT_ENABLE=true + ENTRYPOINT [ "/usr/local/bundle/bin/aws_lambda_ric" ] CMD [ "app.App::Handler.process" ] diff --git a/components/services/Gemfile.lock b/components/services/Gemfile.lock index 05f20d88a..8db0db5c2 100644 --- a/components/services/Gemfile.lock +++ b/components/services/Gemfile.lock @@ -2,37 +2,38 @@ GEM remote: https://rubygems.org/ specs: aws-eventstream (1.3.0) - aws-partitions (1.925.0) - aws-sdk-core (3.194.2) + aws-partitions (1.936.0) + aws-sdk-core (3.196.1) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.8) jmespath (~> 1, >= 1.6.1) - aws-sdk-ec2 (1.456.0) + aws-sdk-ec2 (1.458.0) aws-sdk-core (~> 3, >= 3.193.0) aws-sigv4 (~> 1.1) - aws-sdk-ecs (1.146.0) + aws-sdk-ecs (1.147.0) aws-sdk-core (~> 3, >= 3.193.0) aws-sigv4 (~> 1.1) - aws-sdk-ssm (1.168.0) + aws-sdk-ssm (1.169.0) aws-sdk-core (~> 3, >= 3.193.0) aws-sigv4 (~> 1.1) aws-sigv4 (1.8.0) aws-eventstream (~> 1, >= 1.0.2) - bigdecimal (3.1.7) + bigdecimal (3.1.8) coderay (1.1.3) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.1) diff-lcs (1.5.1) docile (1.4.0) jmespath (1.6.2) - method_source (1.0.0) + method_source (1.1.0) ox (2.14.18) pg (1.5.6) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) rake (13.2.1) - rexml (3.2.5) + rexml (3.2.8) + strscan (>= 3.0.9) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) @@ -42,10 +43,10 @@ GEM rspec-expectations (3.13.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.0) + rspec-mocks (3.13.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-support (3.13.0) + rspec-support (3.13.1) sentry-ruby (5.17.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -60,6 +61,7 @@ GEM simplecov (~> 0.19) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) + strscan (3.1.0) PLATFORMS ruby @@ -79,4 +81,4 @@ DEPENDENCIES simplecov-cobertura BUNDLED WITH - 2.4.12 + 2.5.11 diff --git a/components/services/spec/support/aws.rb b/components/services/spec/support/aws.rb deleted file mode 100644 index 261763885..000000000 --- a/components/services/spec/support/aws.rb +++ /dev/null @@ -1,41 +0,0 @@ -Aws.config[:ssm] = { - stub_responses: { - get_parameters: lambda { |context| - { - parameters: context.params[:names].map do |name| - Aws::SSM::Types::Parameter.new( - name:, - value: name.delete_prefix("ssm-parameter-name-") - ) - end - } - } - } -} - -Aws.config[:ecs] = { - stub_responses: { - describe_container_instances: lambda { |_context| - { - container_instances: [ - ec2_instance_id: "ec2-instance-id" - ] - } - } - } -} - -Aws.config[:ec2] = { - stub_responses: { - describe_instances: lambda { |_context| - { - reservations: [ - instances: [ - private_ip_address: "10.0.0.1", - public_ip_address: "54.251.92.249" - ] - ] - } - } - } -} diff --git a/infrastructure/modules/somleng_switch/services.tf b/infrastructure/modules/somleng_switch/services.tf index 80f078c58..911a56438 100644 --- a/infrastructure/modules/somleng_switch/services.tf +++ b/infrastructure/modules/somleng_switch/services.tf @@ -12,7 +12,7 @@ resource "docker_image" "services" { } resource "docker_registry_image" "services" { - name = docker_image.services.name + name = docker_image.services.name keep_remotely = true } @@ -29,7 +29,7 @@ resource "aws_ssm_parameter" "services_application_master_key" { # IAM resource "aws_iam_role" "services" { - name = local.services_function_name + name = local.services_function_name assume_role_policy = <