From eb47b85bc81b28cfd5b743809653e052ee8fa464 Mon Sep 17 00:00:00 2001 From: guidojw <35309288+guidojw@users.noreply.github.com> Date: Fri, 13 Oct 2023 21:53:56 +0200 Subject: [PATCH 1/6] refactor: upgrade rails --- Gemfile | 2 +- Gemfile.lock | 201 ++++++++++++++++++------------ config/environments/production.rb | 2 +- 3 files changed, 121 insertions(+), 84 deletions(-) diff --git a/Gemfile b/Gemfile index be4788b4..4c37be5d 100644 --- a/Gemfile +++ b/Gemfile @@ -32,7 +32,7 @@ gem 'puma', '~> 6.0' gem 'pundit', '~> 2.0' gem 'rack-attack', '~> 6.0' gem 'rack-cors', '~> 2.0', '>= 2.0.1', require: 'rack/cors' -gem 'rails', '~> 7.0', '>= 7.0.4.3' +gem 'rails', '~> 7.1.0' gem 'rails-i18n', '~> 7.0' gem 'redis', '~> 4.0' gem 'roo', '~> 2.9' diff --git a/Gemfile.lock b/Gemfile.lock index 0e227f8e..8d0616dc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -22,81 +22,92 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.0.4.3) - actionpack (= 7.0.4.3) - activesupport (= 7.0.4.3) + actioncable (7.1.0) + actionpack (= 7.1.0) + activesupport (= 7.1.0) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4.3) - actionpack (= 7.0.4.3) - activejob (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + zeitwerk (~> 2.6) + actionmailbox (7.1.0) + actionpack (= 7.1.0) + activejob (= 7.1.0) + activerecord (= 7.1.0) + activestorage (= 7.1.0) + activesupport (= 7.1.0) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.4.3) - actionpack (= 7.0.4.3) - actionview (= 7.0.4.3) - activejob (= 7.0.4.3) - activesupport (= 7.0.4.3) + actionmailer (7.1.0) + actionpack (= 7.1.0) + actionview (= 7.1.0) + activejob (= 7.1.0) + activesupport (= 7.1.0) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.4.3) - actionview (= 7.0.4.3) - activesupport (= 7.0.4.3) - rack (~> 2.0, >= 2.2.0) + rails-dom-testing (~> 2.2) + actionpack (7.1.0) + actionview (= 7.1.0) + activesupport (= 7.1.0) + nokogiri (>= 1.8.5) + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.4.3) - actionpack (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.0) + actionpack (= 7.1.0) + activerecord (= 7.1.0) + activestorage (= 7.1.0) + activesupport (= 7.1.0) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.4.3) - activesupport (= 7.0.4.3) + actionview (7.1.0) + activesupport (= 7.1.0) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.4.3) - activesupport (= 7.0.4.3) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.1.0) + activesupport (= 7.1.0) globalid (>= 0.3.6) - activemodel (7.0.4.3) - activesupport (= 7.0.4.3) - activerecord (7.0.4.3) - activemodel (= 7.0.4.3) - activesupport (= 7.0.4.3) - activestorage (7.0.4.3) - actionpack (= 7.0.4.3) - activejob (= 7.0.4.3) - activerecord (= 7.0.4.3) - activesupport (= 7.0.4.3) + activemodel (7.1.0) + activesupport (= 7.1.0) + activerecord (7.1.0) + activemodel (= 7.1.0) + activesupport (= 7.1.0) + timeout (>= 0.4.0) + activestorage (7.1.0) + actionpack (= 7.1.0) + activejob (= 7.1.0) + activerecord (= 7.1.0) + activesupport (= 7.1.0) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.4.3) + activesupport (7.1.0) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) ast (2.4.2) awesome_print (1.9.2) + base64 (0.1.1) bcrypt (3.1.17) bcrypt (3.1.17-java) better_errors (2.9.1) coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) + bigdecimal (3.1.4) + bigdecimal (3.1.4-java) binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) bootsnap (1.11.1) @@ -155,6 +166,8 @@ GEM dotenv-rails (2.7.6) dotenv (= 2.7.6) railties (>= 3.2) + drb (2.1.1) + ruby2_keywords erubi (1.12.0) et-orbi (1.2.7) tzinfo @@ -187,8 +200,8 @@ GEM fuubar (2.5.1) rspec-core (~> 3.0) ruby-progressbar (~> 1.4) - globalid (1.1.0) - activesupport (>= 5.0) + globalid (1.2.1) + activesupport (>= 6.1) guard (2.18.0) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) @@ -227,8 +240,14 @@ GEM ruby-vips (>= 2.0.17, < 3) improvmx (0.2) rest-client (~> 2.0) + io-console (0.6.0) + io-console (0.6.0-java) + irb (1.8.1) + rdoc + reline (>= 0.3.8) isbn_validation (1.2.2) activerecord (>= 3) + jar-dependencies (0.4.1) jsonapi-authorization (3.0.2) jsonapi-resources (~> 0.9.0) pundit (>= 1.0.0, < 3.0.0) @@ -242,9 +261,9 @@ GEM llhttp-ffi (0.4.0) ffi-compiler (~> 1.0) rake (~> 13.0) - loofah (2.20.0) + loofah (2.21.4) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) lumberjack (1.2.8) mail (2.8.1) mini_mime (>= 0.1.1) @@ -267,15 +286,16 @@ GEM minitest (5.18.0) msgpack (1.4.5) msgpack (1.4.5-java) + mutex_m (0.1.2) nenv (0.3.0) - net-imap (0.3.4) + net-imap (0.4.1) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.1) timeout - net-smtp (0.3.3) + net-smtp (0.4.0) net-protocol netrc (0.11.0) nio4r (2.5.8) @@ -297,8 +317,8 @@ GEM activerecord (>= 6.0) request_store (~> 1.4) parallel (1.22.1) - paranoia (2.6.0) - activerecord (>= 5.1, < 7.1) + paranoia (2.6.3) + activerecord (>= 5.1, < 7.2) parser (3.1.1.0) ast (~> 2.4.1) pg (1.3.5) @@ -317,6 +337,10 @@ GEM pry (~> 0.13.0) pry-rails (0.3.9) pry (>= 0.10.4) + psych (5.1.1) + stringio + psych (5.1.1-java) + jar-dependencies (>= 0.1.7) public_suffix (4.0.6) puma (6.0.0) nio4r (~> 2.0) @@ -334,45 +358,57 @@ GEM rack (>= 2.0.0) rack-mini-profiler (3.0.0) rack (>= 1.2.0) + rack-session (1.0.1) + rack (< 3) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.4.3) - actioncable (= 7.0.4.3) - actionmailbox (= 7.0.4.3) - actionmailer (= 7.0.4.3) - actionpack (= 7.0.4.3) - actiontext (= 7.0.4.3) - actionview (= 7.0.4.3) - activejob (= 7.0.4.3) - activemodel (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + rackup (1.0.0) + rack (< 3) + webrick + rails (7.1.0) + actioncable (= 7.1.0) + actionmailbox (= 7.1.0) + actionmailer (= 7.1.0) + actionpack (= 7.1.0) + actiontext (= 7.1.0) + actionview (= 7.1.0) + activejob (= 7.1.0) + activemodel (= 7.1.0) + activerecord (= 7.1.0) + activestorage (= 7.1.0) + activesupport (= 7.1.0) bundler (>= 1.15.0) - railties (= 7.0.4.3) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + railties (= 7.1.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.5.0) - loofah (~> 2.19, >= 2.19.1) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) rails-i18n (7.0.3) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.0.4.3) - actionpack (= 7.0.4.3) - activesupport (= 7.0.4.3) - method_source + railties (7.1.0) + actionpack (= 7.1.0) + activesupport (= 7.1.0) + irb + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.0.6) rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) rb-readline (0.5.5) + rdoc (6.5.0) + psych (>= 4.0.0) redis (4.8.1) regexp_parser (2.2.1) + reline (0.3.9) + io-console (~> 0.5) request_store (1.5.1) rack (>= 1.4) rest-client (2.1.0) @@ -484,12 +520,13 @@ GEM listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) ssrf_filter (1.0.7) + stringio (3.0.8) terminal-notifier-guard (1.7.0) - thor (1.2.1) + thor (1.2.2) tilt (2.1.0) timecop (0.9.5) timeliness (0.4.5) - timeout (0.3.2) + timeout (0.4.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) tzinfo-data (1.2022.1) @@ -516,9 +553,9 @@ GEM crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) webrick (1.7.0) - websocket-driver (0.7.5) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) - websocket-driver (0.7.5-java) + websocket-driver (0.7.6-java) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) zeitwerk (2.6.8) @@ -579,7 +616,7 @@ DEPENDENCIES rack-attack (~> 6.0) rack-cors (~> 2.0, >= 2.0.1) rack-mini-profiler - rails (~> 7.0, >= 7.0.4.3) + rails (~> 7.1.0) rails-i18n (~> 7.0) rb-readline redis (~> 4.0) @@ -609,4 +646,4 @@ DEPENDENCIES webmock BUNDLED WITH - 2.2.33 + 2.4.14 diff --git a/config/environments/production.rb b/config/environments/production.rb index cd2b9bed..f3304dd2 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -2,7 +2,7 @@ # Settings specified here will take precedence over those in config/application.rb. # Require master key for secrets - config.require_master_key = true + # config.require_master_key = true # Code is not reloaded between requests. config.cache_classes = true From 989841afcd134b861a5a1716628d26f77ee1e11c Mon Sep 17 00:00:00 2001 From: guidojw <35309288+guidojw@users.noreply.github.com> Date: Fri, 22 Nov 2024 00:56:13 +0100 Subject: [PATCH 2/6] refactor(ci): remove RAILS_MASTER_KEY --- .github/workflows/continuous-delivery.yml | 2 -- .github/workflows/continuous-integration.yml | 32 +++++++++++--------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 2ad00a5d..0dfd7a71 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -105,8 +105,6 @@ jobs: uses: csvalpha/amber-api/.github/workflows/continuous-integration.yml@staging with: sha: ${{ needs.merge.outputs.sha }} - secrets: - rails_master_key: ${{ secrets.RAILS_MASTER_KEY }} publish_image: name: Publish Image diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 9752cc19..acc24e62 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -11,10 +11,6 @@ on: description: The commit SHA to run the workflow on required: false type: string - secrets: - rails_master_key: - description: The Rails master key - required: true jobs: build: @@ -72,14 +68,20 @@ jobs: name: app - name: Lint - env: - RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} run: | EXIT_STATUS=0 - ./actionlint -ignore 'property "gh_app_private_key" is not defined' -ignore 'SC2153:' \ - -ignore 'property "sha" is not defined in object type {}' || EXIT_STATUS=$? - docker run -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_HOST=localhost -e \ - RAILS_MASTER_KEY --network=host app bin/ci.sh lint || EXIT_STATUS=$? + ./actionlint \ + -ignore 'property "gh_app_private_key" is not defined' \ + -ignore 'SC2153:' \ + -ignore 'property "sha" is not defined in object type {}' || \ + EXIT_STATUS=$? + docker run \ + -e POSTGRES_USER=postgres \ + -e POSTGRES_PASSWORD=postgres \ + -e POSTGRES_HOST=localhost \ + --network=host \ + app bin/ci.sh lint || \ + EXIT_STATUS=$? exit $EXIT_STATUS test: @@ -115,8 +117,10 @@ jobs: name: app - name: Test - env: - RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} run: | - docker run -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_HOST=localhost -e \ - RAILS_MASTER_KEY --network=host app bin/ci.sh spec + docker run \ + -e POSTGRES_USER=postgres \ + -e POSTGRES_PASSWORD=postgres \ + -e POSTGRES_HOST=localhost \ + --network=host \ + app bin/ci.sh spec From 78b6002591f73feffb0d8857e463ce499c709033 Mon Sep 17 00:00:00 2001 From: guidojw <35309288+guidojw@users.noreply.github.com> Date: Fri, 22 Nov 2024 01:09:57 +0100 Subject: [PATCH 3/6] chore(deps): update bullet --- Gemfile.lock | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 223930ba..f04788c9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -99,22 +99,22 @@ GEM public_suffix (>= 2.0.2, < 5.0) ast (2.4.2) awesome_print (1.9.2) - base64 (0.1.1) + base64 (0.2.0) bcrypt (3.1.17) bcrypt (3.1.17-java) better_errors (2.9.1) coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) - bigdecimal (3.1.4) - bigdecimal (3.1.4-java) + bigdecimal (3.1.8) + bigdecimal (3.1.8-java) binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) bootsnap (1.11.1) msgpack (~> 1.2) brakeman (5.2.1) builder (3.2.4) - bullet (7.0.1) + bullet (8.0.0) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.3) @@ -138,8 +138,8 @@ GEM activesupport coderay (1.1.3) colorize (0.8.1) - concurrent-ruby (1.2.2) - connection_pool (2.3.0) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) consistency_fail (0.3.7) counter_culture (3.2.1) activerecord (>= 4.2) @@ -166,8 +166,7 @@ GEM dotenv-rails (2.7.6) dotenv (= 2.7.6) railties (>= 3.2) - drb (2.1.1) - ruby2_keywords + drb (2.2.1) erubi (1.12.0) et-orbi (1.2.7) tzinfo @@ -229,7 +228,7 @@ GEM http_router (0.11.2) rack (>= 1.0.0) url_mount (~> 0.2.1) - i18n (1.13.0) + i18n (1.14.6) concurrent-ruby (~> 1.0) iban-tools (1.1.0) icalendar (2.7.1) @@ -283,10 +282,10 @@ GEM mini_magick (4.11.0) mini_mime (1.1.2) mini_portile2 (2.8.2) - minitest (5.18.0) + minitest (5.25.2) msgpack (1.4.5) msgpack (1.4.5-java) - mutex_m (0.1.2) + mutex_m (0.3.0) nenv (0.3.0) net-imap (0.4.1) date From b0cc5df56b93196460cdd24744e57333435093c2 Mon Sep 17 00:00:00 2001 From: guidojw <35309288+guidojw@users.noreply.github.com> Date: Fri, 22 Nov 2024 02:26:52 +0100 Subject: [PATCH 4/6] refactor: try local camo --- .github/workflows/continuous-integration.yml | 9 +++++++++ config/application.rb | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f313c174..37b1d85d 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -92,7 +92,12 @@ jobs: name: Test runs-on: ubuntu-latest needs: build + env: + PORT: 9090 + CAMO_KEY: camo_key_123 services: + camo: + image: rx14/camo.cr:latest db: image: postgres:14.7 env: @@ -121,9 +126,13 @@ jobs: name: app - name: Test + env: + CAMO_HOST: localhost:${{ env.PORT }} run: | mkdir coverage docker run \ + -e CAMO_KEY \ + -e CAMO_HOST \ -e POSTGRES_USER=postgres \ -e POSTGRES_PASSWORD=postgres \ -e POSTGRES_HOST=localhost \ diff --git a/config/application.rb b/config/application.rb index 7158b5ae..230d2d94 100644 --- a/config/application.rb +++ b/config/application.rb @@ -72,8 +72,9 @@ class Application < Rails::Application config.x.sentry_dsn = credentials.dig(Rails.env.to_sym, :sentry_dsn) - config.x.camo_host = credentials.dig(Rails.env.to_sym, :camo_host) - config.x.camo_key = credentials.dig(Rails.env.to_sym, :camo_key) + config.x.camo_host = ENV.fetch('CAMO_HOST', credentials.dig(Rails.env.to_sym, :camo_host)) + config.x.camo_key = ENV.fetch('CAMO_KEY', credentials.dig(Rails.env.to_sym, :camo_key)) + config.x.daily_verse_user = credentials.dig(Rails.env.to_sym, :daily_verse_user) config.x.daily_verse_password = credentials.dig(Rails.env.to_sym, :daily_verse_password) From ed01b3574589e243467f0087843c1b33926082ac Mon Sep 17 00:00:00 2001 From: guidojw <35309288+guidojw@users.noreply.github.com> Date: Fri, 22 Nov 2024 02:32:49 +0100 Subject: [PATCH 5/6] fix: change PORT passing --- .github/workflows/continuous-integration.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 37b1d85d..8975e4c6 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -93,11 +93,12 @@ jobs: runs-on: ubuntu-latest needs: build env: - PORT: 9090 CAMO_KEY: camo_key_123 services: camo: image: rx14/camo.cr:latest + env: + PORT: 9090 db: image: postgres:14.7 env: @@ -127,7 +128,7 @@ jobs: - name: Test env: - CAMO_HOST: localhost:${{ env.PORT }} + CAMO_HOST: localhost:9090 run: | mkdir coverage docker run \ From 0d80c599cbfadc0f6f55e84a2e00d7c815b140dd Mon Sep 17 00:00:00 2001 From: guidojw <35309288+guidojw@users.noreply.github.com> Date: Fri, 22 Nov 2024 02:33:18 +0100 Subject: [PATCH 6/6] fix: service definition --- .github/workflows/continuous-integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 8975e4c6..c0ac46cd 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -97,8 +97,8 @@ jobs: services: camo: image: rx14/camo.cr:latest - env: - PORT: 9090 + env: + PORT: 9090 db: image: postgres:14.7 env: