diff --git a/mysql-ruby-lambda/Dockerfile b/mysql-ruby-lambda/Dockerfile index 254bfae3..6d8d792c 100644 --- a/mysql-ruby-lambda/Dockerfile +++ b/mysql-ruby-lambda/Dockerfile @@ -14,14 +14,7 @@ RUN yum -y update && yum -y upgrade # UC3 ruby code pulls a common gem from github for use in Lambda code. RUN yum -y install mysql-devel gcc make git -RUN gem update bundler && \ - git clone https://github.com/cdluc3/uc3-ssm.git && \ - cd uc3-ssm && \ - # pull a particular branch in order to build it - git checkout main && \ - gem build uc3-ssm.gemspec && \ - gem install uc3-ssm*.gem && \ - cd .. +RUN gem update bundler # Start with a Gemfile containing only MySQL COPY * ./ @@ -29,8 +22,7 @@ COPY * ./ RUN bundle config --local build.mysql2 --with-mysql2-config=/usr/lib64/mysql/mysql_config && \ bundle config --local silence_root_warning true && \ bundle config set path 'vendor/bundle' && \ - bundle install && \ - gem install uc3-ssm/uc3-ssm*.gem --install-dir vendor/bundle/ruby/3.2.0 + bundle install # This structure assumes the following: # lambda_function.rb contains a module name LambdaFunctions which contains a class Handler diff --git a/mysql-ruby-lambda/lambda_function.rb b/mysql-ruby-lambda/lambda_function.rb index 0e13a1bd..022aa111 100644 --- a/mysql-ruby-lambda/lambda_function.rb +++ b/mysql-ruby-lambda/lambda_function.rb @@ -1,5 +1,11 @@ # frozen_string_literal: true +# Docs say that the LambdaLayer gems are found mounted as /opt/ruby/gems but an inspection +# of the $LOAD_PATH shows that only /opt/ruby/lib is available. So we add what we want here +# and indicate exactly which folders contain the *.rb files +my_gem_path = Dir['/var/task/vendor/bundle/ruby/**/bundler/gems/**/lib/'] +$LOAD_PATH.unshift(*my_gem_path) + require 'json' require 'uc3-ssm' require 'mysql2' diff --git a/src-admintool/test.rb b/src-admintool/test.rb index 8f21a909..8992bbf5 100644 --- a/src-admintool/test.rb +++ b/src-admintool/test.rb @@ -4,6 +4,12 @@ # docker build -t x . # docker run --rm -it --entrypoint 'bundle' -e SSM_ROOT_PATH=... x exec ruby test.rb +# Docs say that the LambdaLayer gems are found mounted as /opt/ruby/gems but an inspection +# of the $LOAD_PATH shows that only /opt/ruby/lib is available. So we add what we want here +# and indicate exactly which folders contain the *.rb files +my_gem_path = Dir['/var/task/vendor/bundle/ruby/3.2.0/bundler/gems/**/lib/'] +$LOAD_PATH.unshift(*my_gem_path) + require 'json' require 'yaml' require 'uc3-ssm' diff --git a/src-colladmin/config/ssm.registry.yml b/src-colladmin/config/ssm.registry.yml index 4d8b2f32..0408b10c 100644 --- a/src-colladmin/config/ssm.registry.yml +++ b/src-colladmin/config/ssm.registry.yml @@ -311,6 +311,8 @@ ui: description: Byte count file size limit for direct upload through the Merritt UI upload-limit-message: description: Human readable byte count file size limit for direct upload through the Merritt UI + port: + description: Microservice port integ-tests: skip: true for-stage: &inttest diff --git a/src-common/lambda_base.rb b/src-common/lambda_base.rb index 76b51f26..aada06e0 100644 --- a/src-common/lambda_base.rb +++ b/src-common/lambda_base.rb @@ -1,5 +1,11 @@ # frozen_string_literal: true +# Docs say that the LambdaLayer gems are found mounted as /opt/ruby/gems but an inspection +# of the $LOAD_PATH shows that only /opt/ruby/lib is available. So we add what we want here +# and indicate exactly which folders contain the *.rb files +my_gem_path = Dir['/var/task/vendor/bundle/ruby/**/bundler/gems/**/lib/'] +$LOAD_PATH.unshift(*my_gem_path) + require 'time' require 'json' require 'yaml'