Browse Source

[rails] Upgrade to Rails 7.2 (#9209)

Update to latest release.
- Remove YJIT initializer as YJIT is enabled by Rails by default.
- Updated config with bin/rails app:update
Petrik de Heus 1 year ago
parent
commit
e05436e96c

+ 1 - 1
frameworks/Ruby/rails/.ruby-version

@@ -1 +1 @@
-3.1.0
+3.3.0

+ 1 - 1
frameworks/Ruby/rails/Gemfile

@@ -3,7 +3,7 @@ source 'https://rubygems.org'
 gem 'oj', '~> 3.16'
 gem 'oj', '~> 3.16'
 gem 'pg', '~> 1.5', group: :postgresql
 gem 'pg', '~> 1.5', group: :postgresql
 gem 'puma', '~> 6.4'
 gem 'puma', '~> 6.4'
-gem 'rails', '~> 7.1.3'
+gem 'rails', '~> 7.2.0'
 gem 'redis', '~> 5.0'
 gem 'redis', '~> 5.0'
 gem 'trilogy', '~> 2.8.1', group: :mysql
 gem 'trilogy', '~> 2.8.1', group: :mysql
 gem 'tzinfo-data'
 gem 'tzinfo-data'

+ 85 - 85
frameworks/Ruby/rails/Gemfile.lock

@@ -1,97 +1,94 @@
 GEM
 GEM
   remote: https://rubygems.org/
   remote: https://rubygems.org/
   specs:
   specs:
-    actioncable (7.1.3.4)
-      actionpack (= 7.1.3.4)
-      activesupport (= 7.1.3.4)
+    actioncable (7.2.0)
+      actionpack (= 7.2.0)
+      activesupport (= 7.2.0)
       nio4r (~> 2.0)
       nio4r (~> 2.0)
       websocket-driver (>= 0.6.1)
       websocket-driver (>= 0.6.1)
       zeitwerk (~> 2.6)
       zeitwerk (~> 2.6)
-    actionmailbox (7.1.3.4)
-      actionpack (= 7.1.3.4)
-      activejob (= 7.1.3.4)
-      activerecord (= 7.1.3.4)
-      activestorage (= 7.1.3.4)
-      activesupport (= 7.1.3.4)
-      mail (>= 2.7.1)
-      net-imap
-      net-pop
-      net-smtp
-    actionmailer (7.1.3.4)
-      actionpack (= 7.1.3.4)
-      actionview (= 7.1.3.4)
-      activejob (= 7.1.3.4)
-      activesupport (= 7.1.3.4)
-      mail (~> 2.5, >= 2.5.4)
-      net-imap
-      net-pop
-      net-smtp
+    actionmailbox (7.2.0)
+      actionpack (= 7.2.0)
+      activejob (= 7.2.0)
+      activerecord (= 7.2.0)
+      activestorage (= 7.2.0)
+      activesupport (= 7.2.0)
+      mail (>= 2.8.0)
+    actionmailer (7.2.0)
+      actionpack (= 7.2.0)
+      actionview (= 7.2.0)
+      activejob (= 7.2.0)
+      activesupport (= 7.2.0)
+      mail (>= 2.8.0)
       rails-dom-testing (~> 2.2)
       rails-dom-testing (~> 2.2)
-    actionpack (7.1.3.4)
-      actionview (= 7.1.3.4)
-      activesupport (= 7.1.3.4)
+    actionpack (7.2.0)
+      actionview (= 7.2.0)
+      activesupport (= 7.2.0)
       nokogiri (>= 1.8.5)
       nokogiri (>= 1.8.5)
       racc
       racc
-      rack (>= 2.2.4)
+      rack (>= 2.2.4, < 3.2)
       rack-session (>= 1.0.1)
       rack-session (>= 1.0.1)
       rack-test (>= 0.6.3)
       rack-test (>= 0.6.3)
       rails-dom-testing (~> 2.2)
       rails-dom-testing (~> 2.2)
       rails-html-sanitizer (~> 1.6)
       rails-html-sanitizer (~> 1.6)
-    actiontext (7.1.3.4)
-      actionpack (= 7.1.3.4)
-      activerecord (= 7.1.3.4)
-      activestorage (= 7.1.3.4)
-      activesupport (= 7.1.3.4)
+      useragent (~> 0.16)
+    actiontext (7.2.0)
+      actionpack (= 7.2.0)
+      activerecord (= 7.2.0)
+      activestorage (= 7.2.0)
+      activesupport (= 7.2.0)
       globalid (>= 0.6.0)
       globalid (>= 0.6.0)
       nokogiri (>= 1.8.5)
       nokogiri (>= 1.8.5)
-    actionview (7.1.3.4)
-      activesupport (= 7.1.3.4)
+    actionview (7.2.0)
+      activesupport (= 7.2.0)
       builder (~> 3.1)
       builder (~> 3.1)
       erubi (~> 1.11)
       erubi (~> 1.11)
       rails-dom-testing (~> 2.2)
       rails-dom-testing (~> 2.2)
       rails-html-sanitizer (~> 1.6)
       rails-html-sanitizer (~> 1.6)
-    activejob (7.1.3.4)
-      activesupport (= 7.1.3.4)
+    activejob (7.2.0)
+      activesupport (= 7.2.0)
       globalid (>= 0.3.6)
       globalid (>= 0.3.6)
-    activemodel (7.1.3.4)
-      activesupport (= 7.1.3.4)
-    activerecord (7.1.3.4)
-      activemodel (= 7.1.3.4)
-      activesupport (= 7.1.3.4)
+    activemodel (7.2.0)
+      activesupport (= 7.2.0)
+    activerecord (7.2.0)
+      activemodel (= 7.2.0)
+      activesupport (= 7.2.0)
       timeout (>= 0.4.0)
       timeout (>= 0.4.0)
-    activestorage (7.1.3.4)
-      actionpack (= 7.1.3.4)
-      activejob (= 7.1.3.4)
-      activerecord (= 7.1.3.4)
-      activesupport (= 7.1.3.4)
+    activestorage (7.2.0)
+      actionpack (= 7.2.0)
+      activejob (= 7.2.0)
+      activerecord (= 7.2.0)
+      activesupport (= 7.2.0)
       marcel (~> 1.0)
       marcel (~> 1.0)
-    activesupport (7.1.3.4)
+    activesupport (7.2.0)
       base64
       base64
       bigdecimal
       bigdecimal
-      concurrent-ruby (~> 1.0, >= 1.0.2)
+      concurrent-ruby (~> 1.0, >= 1.3.1)
       connection_pool (>= 2.2.5)
       connection_pool (>= 2.2.5)
       drb
       drb
       i18n (>= 1.6, < 2)
       i18n (>= 1.6, < 2)
+      logger (>= 1.4.2)
       minitest (>= 5.1)
       minitest (>= 5.1)
-      mutex_m
-      tzinfo (~> 2.0)
+      securerandom (>= 0.3)
+      tzinfo (~> 2.0, >= 2.0.5)
     base64 (0.2.0)
     base64 (0.2.0)
     bigdecimal (3.1.8)
     bigdecimal (3.1.8)
-    builder (3.2.4)
-    concurrent-ruby (1.3.1)
+    builder (3.3.0)
+    concurrent-ruby (1.3.4)
     connection_pool (2.4.1)
     connection_pool (2.4.1)
     crass (1.0.6)
     crass (1.0.6)
     date (3.3.4)
     date (3.3.4)
     drb (2.2.1)
     drb (2.2.1)
-    erubi (1.12.0)
+    erubi (1.13.0)
     globalid (1.2.1)
     globalid (1.2.1)
       activesupport (>= 6.1)
       activesupport (>= 6.1)
     i18n (1.14.5)
     i18n (1.14.5)
       concurrent-ruby (~> 1.0)
       concurrent-ruby (~> 1.0)
     io-console (0.7.2)
     io-console (0.7.2)
-    irb (1.13.1)
+    irb (1.14.0)
       rdoc (>= 4.0.0)
       rdoc (>= 4.0.0)
       reline (>= 0.4.2)
       reline (>= 0.4.2)
+    logger (1.6.0)
     loofah (2.22.0)
     loofah (2.22.0)
       crass (~> 1.0.2)
       crass (~> 1.0.2)
       nokogiri (>= 1.12.0)
       nokogiri (>= 1.12.0)
@@ -103,9 +100,8 @@ GEM
     marcel (1.0.4)
     marcel (1.0.4)
     mini_mime (1.1.5)
     mini_mime (1.1.5)
     mini_portile2 (2.8.7)
     mini_portile2 (2.8.7)
-    minitest (5.23.1)
-    mutex_m (0.2.0)
-    net-imap (0.4.11)
+    minitest (5.24.1)
+    net-imap (0.4.14)
       date
       date
       net-protocol
       net-protocol
     net-pop (0.1.2)
     net-pop (0.1.2)
@@ -115,22 +111,24 @@ GEM
     net-smtp (0.5.0)
     net-smtp (0.5.0)
       net-protocol
       net-protocol
     nio4r (2.7.3)
     nio4r (2.7.3)
-    nokogiri (1.16.5)
+    nokogiri (1.16.7)
       mini_portile2 (~> 2.8.2)
       mini_portile2 (~> 2.8.2)
       racc (~> 1.4)
       racc (~> 1.4)
-    nokogiri (1.16.5-arm64-darwin)
+    nokogiri (1.16.7-arm64-darwin)
       racc (~> 1.4)
       racc (~> 1.4)
-    nokogiri (1.16.5-x86_64-linux)
+    nokogiri (1.16.7-x86_64-linux)
       racc (~> 1.4)
       racc (~> 1.4)
-    oj (3.16.3)
+    oj (3.16.5)
       bigdecimal (>= 3.0)
       bigdecimal (>= 3.0)
-    pg (1.5.6)
+      ostruct (>= 0.2)
+    ostruct (0.6.0)
+    pg (1.5.7)
     psych (5.1.2)
     psych (5.1.2)
       stringio
       stringio
     puma (6.4.2)
     puma (6.4.2)
       nio4r (~> 2.0)
       nio4r (~> 2.0)
-    racc (1.8.0)
-    rack (3.0.11)
+    racc (1.8.1)
+    rack (3.1.7)
     rack-session (2.0.0)
     rack-session (2.0.0)
       rack (>= 3.0.0)
       rack (>= 3.0.0)
     rack-test (2.1.0)
     rack-test (2.1.0)
@@ -138,20 +136,20 @@ GEM
     rackup (2.1.0)
     rackup (2.1.0)
       rack (>= 3)
       rack (>= 3)
       webrick (~> 1.8)
       webrick (~> 1.8)
-    rails (7.1.3.4)
-      actioncable (= 7.1.3.4)
-      actionmailbox (= 7.1.3.4)
-      actionmailer (= 7.1.3.4)
-      actionpack (= 7.1.3.4)
-      actiontext (= 7.1.3.4)
-      actionview (= 7.1.3.4)
-      activejob (= 7.1.3.4)
-      activemodel (= 7.1.3.4)
-      activerecord (= 7.1.3.4)
-      activestorage (= 7.1.3.4)
-      activesupport (= 7.1.3.4)
+    rails (7.2.0)
+      actioncable (= 7.2.0)
+      actionmailbox (= 7.2.0)
+      actionmailer (= 7.2.0)
+      actionpack (= 7.2.0)
+      actiontext (= 7.2.0)
+      actionview (= 7.2.0)
+      activejob (= 7.2.0)
+      activemodel (= 7.2.0)
+      activerecord (= 7.2.0)
+      activestorage (= 7.2.0)
+      activesupport (= 7.2.0)
       bundler (>= 1.15.0)
       bundler (>= 1.15.0)
-      railties (= 7.1.3.4)
+      railties (= 7.2.0)
     rails-dom-testing (2.2.0)
     rails-dom-testing (2.2.0)
       activesupport (>= 5.0.0)
       activesupport (>= 5.0.0)
       minitest
       minitest
@@ -159,24 +157,25 @@ GEM
     rails-html-sanitizer (1.6.0)
     rails-html-sanitizer (1.6.0)
       loofah (~> 2.21)
       loofah (~> 2.21)
       nokogiri (~> 1.14)
       nokogiri (~> 1.14)
-    railties (7.1.3.4)
-      actionpack (= 7.1.3.4)
-      activesupport (= 7.1.3.4)
-      irb
+    railties (7.2.0)
+      actionpack (= 7.2.0)
+      activesupport (= 7.2.0)
+      irb (~> 1.13)
       rackup (>= 1.0.0)
       rackup (>= 1.0.0)
       rake (>= 12.2)
       rake (>= 12.2)
       thor (~> 1.0, >= 1.2.2)
       thor (~> 1.0, >= 1.2.2)
       zeitwerk (~> 2.6)
       zeitwerk (~> 2.6)
     rake (13.2.1)
     rake (13.2.1)
-    rdoc (6.6.3.1)
+    rdoc (6.7.0)
       psych (>= 4.0.0)
       psych (>= 4.0.0)
     redis (5.2.0)
     redis (5.2.0)
       redis-client (>= 0.22.0)
       redis-client (>= 0.22.0)
     redis-client (0.22.2)
     redis-client (0.22.2)
       connection_pool
       connection_pool
-    reline (0.5.7)
+    reline (0.5.9)
       io-console (~> 0.5)
       io-console (~> 0.5)
-    stringio (3.1.0)
+    securerandom (0.3.1)
+    stringio (3.1.1)
     thor (1.3.1)
     thor (1.3.1)
     timeout (0.4.1)
     timeout (0.4.1)
     trilogy (2.8.1)
     trilogy (2.8.1)
@@ -184,11 +183,12 @@ GEM
       concurrent-ruby (~> 1.0)
       concurrent-ruby (~> 1.0)
     tzinfo-data (1.2024.1)
     tzinfo-data (1.2024.1)
       tzinfo (>= 1.0.0)
       tzinfo (>= 1.0.0)
+    useragent (0.16.10)
     webrick (1.8.1)
     webrick (1.8.1)
     websocket-driver (0.7.6)
     websocket-driver (0.7.6)
       websocket-extensions (>= 0.1.0)
       websocket-extensions (>= 0.1.0)
     websocket-extensions (0.1.5)
     websocket-extensions (0.1.5)
-    zeitwerk (2.6.14)
+    zeitwerk (2.6.17)
 
 
 PLATFORMS
 PLATFORMS
   arm64-darwin-20
   arm64-darwin-20
@@ -199,7 +199,7 @@ DEPENDENCIES
   oj (~> 3.16)
   oj (~> 3.16)
   pg (~> 1.5)
   pg (~> 1.5)
   puma (~> 6.4)
   puma (~> 6.4)
-  rails (~> 7.1.3)
+  rails (~> 7.2.0)
   redis (~> 5.0)
   redis (~> 5.0)
   trilogy (~> 2.8.1)
   trilogy (~> 2.8.1)
   tzinfo-data
   tzinfo-data

+ 7 - 6
frameworks/Ruby/rails/config/application.rb

@@ -8,9 +8,10 @@ require "active_record/railtie"
 # require "active_storage/engine"
 # require "active_storage/engine"
 require "action_controller/railtie"
 require "action_controller/railtie"
 # require "action_mailer/railtie"
 # require "action_mailer/railtie"
+# require "action_mailbox/engine"
+# require "action_text/engine"
 require "action_view/railtie"
 require "action_view/railtie"
 # require "action_cable/engine"
 # require "action_cable/engine"
-# require "sprockets/railtie"
 # require "rails/test_unit/railtie"
 # require "rails/test_unit/railtie"
 
 
 # Require the gems listed in Gemfile, including any gems
 # Require the gems listed in Gemfile, including any gems
@@ -20,12 +21,12 @@ Bundler.require(*Rails.groups)
 module Hello
 module Hello
   class Application < Rails::Application
   class Application < Rails::Application
     # Initialize configuration defaults for originally generated Rails version.
     # Initialize configuration defaults for originally generated Rails version.
-    config.load_defaults 7.1
+    config.load_defaults 7.2
 
 
-    # Settings in config/environments/* take precedence over those specified here.
-    # Application configuration can go into files in config/initializers
-    # -- all .rb files in that directory are automatically loaded after loading
-    # the framework and any gems in your application.
+    # Please, add to the `ignore` list any other `lib` subdirectories that do
+    # not contain `.rb` files, or that should not be reloaded or eager loaded.
+    # Common ones are `templates`, `generators`, or `middleware`, for example.
+    config.autoload_lib(ignore: %w[assets tasks])
 
 
     config.action_dispatch.default_headers.merge!('Server' => 'WebServer')
     config.action_dispatch.default_headers.merge!('Server' => 'WebServer')
 
 

+ 8 - 11
frameworks/Ruby/rails/config/environments/development.rb

@@ -6,7 +6,7 @@ Rails.application.configure do
   # In the development environment your application's code is reloaded any time
   # In the development environment your application's code is reloaded any time
   # it changes. This slows down response time but is perfect for development
   # it changes. This slows down response time but is perfect for development
   # since you don't have to restart the web server when you make code changes.
   # since you don't have to restart the web server when you make code changes.
-  config.cache_classes = false
+  config.enable_reloading = true
 
 
   # Do not eager load code on boot.
   # Do not eager load code on boot.
   config.eager_load = false
   config.eager_load = false
@@ -14,7 +14,7 @@ Rails.application.configure do
   # Show full error reports.
   # Show full error reports.
   config.consider_all_requests_local = true
   config.consider_all_requests_local = true
 
 
-  # Enable server timing
+  # Enable server timing.
   config.server_timing = true
   config.server_timing = true
 
 
   # Enable/disable caching. By default caching is disabled.
   # Enable/disable caching. By default caching is disabled.
@@ -24,9 +24,7 @@ Rails.application.configure do
     config.action_controller.enable_fragment_cache_logging = true
     config.action_controller.enable_fragment_cache_logging = true
 
 
     config.cache_store = :memory_store
     config.cache_store = :memory_store
-    config.public_file_server.headers = {
-      "Cache-Control" => "public, max-age=#{2.days.to_i}"
-    }
+    config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
   else
   else
     config.action_controller.perform_caching = false
     config.action_controller.perform_caching = false
 
 
@@ -48,16 +46,15 @@ Rails.application.configure do
   # Highlight code that triggered database queries in logs.
   # Highlight code that triggered database queries in logs.
   config.active_record.verbose_query_logs = true
   config.active_record.verbose_query_logs = true
 
 
-
   # Raises error for missing translations.
   # Raises error for missing translations.
   # config.i18n.raise_on_missing_translations = true
   # config.i18n.raise_on_missing_translations = true
 
 
   # Annotate rendered view with file names.
   # Annotate rendered view with file names.
-  # config.action_view.annotate_rendered_view_with_filenames = true
-
-  # Uncomment if you wish to allow Action Cable access from any origin.
-  # config.action_cable.disable_request_forgery_protection = true
+  config.action_view.annotate_rendered_view_with_filenames = true
 
 
-  # Raise error when a before_action's only/except options reference missing actions
+  # Raise error when a before_action's only/except options reference missing actions.
   config.action_controller.raise_on_missing_callback_actions = true
   config.action_controller.raise_on_missing_callback_actions = true
+
+  # Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
+  # config.generators.apply_rubocop_autocorrect_after_generate!
 end
 end

+ 25 - 27
frameworks/Ruby/rails/config/environments/production.rb

@@ -4,7 +4,7 @@ Rails.application.configure do
   # Settings specified here will take precedence over those in config/application.rb.
   # Settings specified here will take precedence over those in config/application.rb.
 
 
   # Code is not reloaded between requests.
   # Code is not reloaded between requests.
-  config.cache_classes = true
+  config.enable_reloading = false
 
 
   # Eager load code on boot. This eager loads most of Rails and
   # Eager load code on boot. This eager loads most of Rails and
   # your application in memory, allowing both threaded web servers
   # your application in memory, allowing both threaded web servers
@@ -13,16 +13,15 @@ Rails.application.configure do
   config.eager_load = true
   config.eager_load = true
 
 
   # Full error reports are disabled and caching is turned on.
   # Full error reports are disabled and caching is turned on.
-  config.consider_all_requests_local       = false
+  config.consider_all_requests_local = false
   config.action_controller.perform_caching = true
   config.action_controller.perform_caching = true
 
 
-  # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
-  # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
+  # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
+  # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
   # config.require_master_key = true
   # config.require_master_key = true
 
 
-  # Disable serving static files from the `/public` folder by default since
-  # Apache or NGINX already handles this.
-  config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
+  # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
+  # config.public_file_server.enabled = false
 
 
   # Enable serving of images, stylesheets, and JavaScripts from an asset server.
   # Enable serving of images, stylesheets, and JavaScripts from an asset server.
   # config.asset_host = "http://assets.example.com"
   # config.asset_host = "http://assets.example.com"
@@ -31,16 +30,24 @@ Rails.application.configure do
   # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
   # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
   # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
   # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
 
 
+  # Assume all access to the app is happening through a SSL-terminating reverse proxy.
+  # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
+  # config.assume_ssl = true
+
   # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
   # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
   # config.force_ssl = true
   # config.force_ssl = true
 
 
-  # Include generic and useful information about system operation, but avoid logging too much
-  # information to avoid inadvertent exposure of personally identifiable information (PII).
-  config.log_level = :info
+  # Skip http-to-https redirect for the default health check endpoint.
+  # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
 
 
   # Prepend all log lines with the following tags.
   # Prepend all log lines with the following tags.
   config.log_tags = [ :request_id ]
   config.log_tags = [ :request_id ]
 
 
+  # "info" includes generic and useful information about system operation, but avoids logging too much
+  # information to avoid inadvertent exposure of personally identifiable information (PII). If you
+  # want to log everything, set the level to "debug".
+  config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
+
   # Use a different cache store in production.
   # Use a different cache store in production.
   config.cache_store = :redis_cache_store, {
   config.cache_store = :redis_cache_store, {
     url: ENV['REDIS_URL'],
     url: ENV['REDIS_URL'],
@@ -54,10 +61,6 @@ Rails.application.configure do
     }
     }
   }
   }
 
 
-  # Use a real queuing backend for Active Job (and separate queues per environment).
-  # config.active_job.queue_adapter     = :resque
-  # config.active_job.queue_name_prefix = "hello_production"
-
   # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
   # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
   # the I18n.default_locale when a translation cannot be found).
   # the I18n.default_locale when a translation cannot be found).
   config.i18n.fallbacks = true
   config.i18n.fallbacks = true
@@ -65,19 +68,14 @@ Rails.application.configure do
   # Don't log any deprecations.
   # Don't log any deprecations.
   config.active_support.report_deprecations = false
   config.active_support.report_deprecations = false
 
 
-  # Use default logging formatter so that PID and timestamp are not suppressed.
-  config.log_formatter = ::Logger::Formatter.new
-
-  # Use a different logger for distributed setups.
-  # require "syslog/logger"
-  # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
-
-  if ENV["RAILS_LOG_TO_STDOUT"].present?
-    logger           = ActiveSupport::Logger.new(STDOUT)
-    logger.formatter = config.log_formatter
-    config.logger    = ActiveSupport::TaggedLogging.new(logger)
-  end
-
   # Do not dump schema after migrations.
   # Do not dump schema after migrations.
   config.active_record.dump_schema_after_migration = false
   config.active_record.dump_schema_after_migration = false
+
+  # Enable DNS rebinding protection and other `Host` header attacks.
+  # config.hosts = [
+  #   "example.com",     # Allow requests from example.com
+  #   /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
+  # ]
+  # Skip DNS rebinding protection for the default health check endpoint.
+  # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
 end
 end

+ 11 - 13
frameworks/Ruby/rails/config/environments/test.rb

@@ -8,27 +8,25 @@ require "active_support/core_ext/integer/time"
 Rails.application.configure do
 Rails.application.configure do
   # Settings specified here will take precedence over those in config/application.rb.
   # Settings specified here will take precedence over those in config/application.rb.
 
 
-  # Turn false under Spring and add config.action_view.cache_template_loading = true.
-  config.cache_classes = true
+  # While tests run files are not watched, reloading is not necessary.
+  config.enable_reloading = false
 
 
-  # Eager loading loads your whole application. When running a single test locally,
-  # this probably isn't necessary. It's a good idea to do in a continuous integration
-  # system, or in some way before deploying your code.
+  # Eager loading loads your entire application. When running a single test locally,
+  # this is usually not necessary, and can slow down your test suite. However, it's
+  # recommended that you enable it in continuous integration systems to ensure eager
+  # loading is working properly before deploying your code.
   config.eager_load = ENV["CI"].present?
   config.eager_load = ENV["CI"].present?
 
 
   # Configure public file server for tests with Cache-Control for performance.
   # Configure public file server for tests with Cache-Control for performance.
-  config.public_file_server.enabled = true
-  config.public_file_server.headers = {
-    "Cache-Control" => "public, max-age=#{1.hour.to_i}"
-  }
+  config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" }
 
 
   # Show full error reports and disable caching.
   # Show full error reports and disable caching.
-  config.consider_all_requests_local       = true
+  config.consider_all_requests_local = true
   config.action_controller.perform_caching = false
   config.action_controller.perform_caching = false
   config.cache_store = :null_store
   config.cache_store = :null_store
 
 
-  # Raise exceptions instead of rendering exception templates.
-  config.action_dispatch.show_exceptions = false
+  # Render exception templates for rescuable exceptions and raise for other exceptions.
+  config.action_dispatch.show_exceptions = :rescuable
 
 
   # Disable request forgery protection in test environment.
   # Disable request forgery protection in test environment.
   config.action_controller.allow_forgery_protection = false
   config.action_controller.allow_forgery_protection = false
@@ -48,6 +46,6 @@ Rails.application.configure do
   # Annotate rendered view with file names.
   # Annotate rendered view with file names.
   # config.action_view.annotate_rendered_view_with_filenames = true
   # config.action_view.annotate_rendered_view_with_filenames = true
 
 
-  # Raise error when a before_action's only/except options reference missing actions
+  # Raise error when a before_action's only/except options reference missing actions.
   config.action_controller.raise_on_missing_callback_actions = true
   config.action_controller.raise_on_missing_callback_actions = true
 end
 end

+ 0 - 11
frameworks/Ruby/rails/config/initializers/enable_yjit.rb

@@ -1,11 +0,0 @@
-# Automatically enable YJIT as of Ruby 3.3, as it bring very
-# sizeable performance improvements.
-
-# If you are deploying to a memory constrained environment
-# you may want to delete this file, but otherwise it's free
-# performance.
-if defined? RubyVM::YJIT.enable
-  Rails.application.config.after_initialize do
-    RubyVM::YJIT.enable
-  end
-end

+ 29 - 38
frameworks/Ruby/rails/config/puma.rb

@@ -1,49 +1,40 @@
-require_relative 'auto_tune'
+# This configuration file will be evaluated by Puma. The top-level methods that
+# are invoked here are part of Puma's configuration DSL. For more information
+# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
 
 
-# FWBM only... use the puma_auto_tune gem in production!
-tuned_num_workers, tuned_num_threads = auto_tune
+require_relative 'auto_tune'
 
 
-# Puma can serve each request in a thread from an internal thread pool.
-# The `threads` method setting takes two numbers: a minimum and maximum.
-# Any libraries that use thread pools should be configured to match
-# the maximum value specified for Puma. Default is set to 5 threads for minimum
-# and maximum; this matches the default thread size of Active Record.
+# Puma starts a configurable number of processes (workers) and each process
+# serves each request in a thread from an internal thread pool.
 #
 #
-max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 3 }
-min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
-threads min_threads_count, max_threads_count
-
-# Specifies the `worker_timeout` threshold that Puma will use to wait before
-# terminating a worker in development environments.
+# The ideal number of threads per worker depends both on how much time the
+# application spends waiting for IO operations and on how much you wish to
+# to prioritize throughput over latency.
 #
 #
-worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
-
-# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
+# As a rule of thumb, increasing the number of threads will increase how much
+# traffic a given process can handle (throughput), but due to CRuby's
+# Global VM Lock (GVL) it has diminishing returns and will degrade the
+# response time (latency) of the application.
 #
 #
-port ENV.fetch("PORT") { 3000 }
-
-# Specifies the `environment` that Puma will run in.
+# The default is set to 3 threads as it's deemed a decent compromise between
+# throughput and latency for the average Rails application.
 #
 #
-environment ENV.fetch("RAILS_ENV") { "development" }
+# Any libraries that use a connection pool or another resource pool should
+# be configured to provide at least as many connections as the number of
+# threads. This includes Active Record's `pool` parameter in `database.yml`.
+threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
+threads threads_count, threads_count
 
 
-# Specifies the `pidfile` that Puma will use.
-pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
+worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
 
 
-# Specifies the number of `workers` to boot in clustered mode.
-# Workers are forked web server processes. If using threads and workers together
-# the concurrency of the application would be max `threads` * `workers`.
-# Workers do not work on JRuby or Windows (both of which do not support
-# processes).
-#
-# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
-workers tuned_num_workers
+# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
+port ENV.fetch("PORT", 3000)
 
 
-# Use the `preload_app!` method when specifying a `workers` number.
-# This directive tells Puma to first boot the application and load code
-# before forking the application. This takes advantage of Copy On Write
-# process behavior so workers use less memory.
-#
-preload_app!
+tuned_num_workers, tuned_num_threads = auto_tune
+workers tuned_num_workers
 
 
-# Allow puma to be restarted by `rails restart` command.
+# Allow puma to be restarted by `bin/rails restart` command.
 plugin :tmp_restart
 plugin :tmp_restart
+
+# Only use a pidfile when requested
+pidfile ENV["PIDFILE"] if ENV["PIDFILE"]