From 25165379ab733ee93e12a72c321824d0d465f8d3 Mon Sep 17 00:00:00 2001 From: Brian Moses Hall Date: Thu, 5 Jun 2025 13:24:26 -0400 Subject: [PATCH 1/4] ETT-57 puma/rack displays "development" environment in Argo - Invoking the app via `rackup` allows Rack's defaults to clobber the APP_ENV we are trying to set in Puma. - Puma's "user defaults" come from Rack and override the less-privileged defaults coming from ENV and elsewhere. - Bypassing `rackup` and using `puma` for the entrypoint imitates the Holdings API. --- Dockerfile | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 383e9ec..2c19c37 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,4 +34,4 @@ RUN chown app:app /usr/src/app USER $UNAME RUN bundle install -CMD ["bundle", "exec", "rackup", "-p", "4567", "-o", "0.0.0.0"] +CMD ["bundle", "exec", "puma", "-p", "4567", "config.ru"] diff --git a/docker-compose.yml b/docker-compose.yml index af22c68..600e4bc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,7 @@ services: volumes: - .:/usr/src/app - gem_cache:/gems - command: bundle exec rackup --host 0.0.0.0 -p 4567 + command: bundle exec puma -p 4567 config.ru environment: RIGHTS_API_DATABASE_CONNECTION_STRING: "mysql2://ht_rights:ht_rights@mariadb/ht" RIGHTS_API_LOGGER_LEVEL: 1 # Logger::INFO From 5e7a9660300c89e6571bb17115287613f21d9b47 Mon Sep 17 00:00:00 2001 From: Brian Moses Hall Date: Thu, 5 Jun 2025 15:18:25 -0400 Subject: [PATCH 2/4] Set logging to true (that's what Holdings API is doing). --- lib/rights_api/app.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/rights_api/app.rb b/lib/rights_api/app.rb index 547e20e..f8c50a9 100644 --- a/lib/rights_api/app.rb +++ b/lib/rights_api/app.rb @@ -15,6 +15,8 @@ module RightsAPI class App < Sinatra::Base + set :logging, true + # Redirect to the current version get "/" do redirect(request.url + "v1/") From b4a028fd4c6ef78bea1d4dbbdd65d9486f1a58fe Mon Sep 17 00:00:00 2001 From: Brian Moses Hall Date: Thu, 5 Jun 2025 15:21:39 -0400 Subject: [PATCH 3/4] `bundle update` to address three Dependabots. --- Gemfile.lock | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f1561cd..92dd0c0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,15 +2,15 @@ GEM remote: https://rubygems.org/ specs: ast (2.4.3) - base64 (0.2.0) - bigdecimal (3.1.9) + base64 (0.3.0) + bigdecimal (3.2.2) canister (0.9.2) climate_control (1.2.0) coderay (1.1.3) - diff-lcs (1.6.1) + diff-lcs (1.6.2) docile (1.4.1) - json (2.11.3) - language_server-protocol (3.17.0.4) + json (2.12.2) + language_server-protocol (3.17.0.5) lint_roller (1.1.0) logger (1.7.0) method_source (1.1.0) @@ -30,12 +30,12 @@ GEM puma (6.6.0) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.13) + rack (3.1.16) rack-protection (4.1.1) base64 (>= 0.1.0) logger (>= 1.6.0) rack (>= 3.0.0, < 4) - rack-session (2.1.0) + rack-session (2.1.1) base64 (>= 0.1.0) rack (>= 3.0.0) rack-test (2.2.0) @@ -44,20 +44,20 @@ GEM rack (>= 3) rainbow (3.1.1) regexp_parser (2.10.0) - rspec (3.13.0) + rspec (3.13.1) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.3) + rspec-core (3.13.4) rspec-support (~> 3.13.0) - rspec-expectations (3.13.4) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.3) + rspec-mocks (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-support (3.13.3) - rubocop (1.75.5) + rspec-support (3.13.4) + rubocop (1.75.8) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -68,7 +68,7 @@ GEM rubocop-ast (>= 1.44.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.44.1) + rubocop-ast (1.45.0) parser (>= 3.3.7.2) prism (~> 1.4) rubocop-performance (1.25.0) @@ -77,7 +77,7 @@ GEM rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - sequel (5.92.0) + sequel (5.93.0) bigdecimal simplecov (0.22.0) docile (~> 1.1) @@ -99,10 +99,10 @@ GEM rack-protection (= 4.1.1) sinatra (= 4.1.1) tilt (~> 2.0) - standard (1.49.0) + standard (1.50.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.75.2) + rubocop (~> 1.75.5) standard-custom (~> 1.0.0) standard-performance (~> 1.8) standard-custom (1.0.2) From 25e32488e7ec7f93642fab27e9d1b69ace137a05 Mon Sep 17 00:00:00 2001 From: Brian Moses Hall Date: Thu, 5 Jun 2025 15:29:10 -0400 Subject: [PATCH 4/4] Add `benchmark` to Gemfile in anticipation of its removal from standard library in Ruby 3.5. --- Gemfile | 1 + Gemfile.lock | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index 27af929..96e9ccb 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,6 @@ source "https://rubygems.org" +gem "benchmark" gem "canister" gem "climate_control" gem "json" diff --git a/Gemfile.lock b/Gemfile.lock index 92dd0c0..dc7783d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,6 +3,7 @@ GEM specs: ast (2.4.3) base64 (0.3.0) + benchmark (0.4.1) bigdecimal (3.2.2) canister (0.9.2) climate_control (1.2.0) @@ -121,6 +122,7 @@ PLATFORMS x86_64-linux DEPENDENCIES + benchmark canister climate_control json