From 22cd2314e52373d8fbe84a082c3ed058dfea8d40 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 20 Aug 2019 20:38:42 +0100 Subject: [PATCH] Update to rails 6.0.1 --- Gemfile | 14 +- Gemfile.lock | 138 ++++++++++-------- bin/setup | 12 +- config/environments/development.rb | 7 +- config/environments/production.rb | 35 ++++- config/environments/test.rb | 18 ++- config/initializers/active_storage.rb | 6 +- config/initializers/assets.rb | 2 - .../initializers/content_security_policy.rb | 5 + config/initializers/cors.rb | 4 +- config/initializers/field_error.rb | 2 +- .../new_framework_defaults_5_2.rb | 38 +++++ .../new_framework_defaults_6_0.rb | 45 ++++++ config/initializers/wrap_parameters.rb | 2 +- config/puma.rb | 10 +- db/structure.sql | 4 +- .../controllers/api/traces_controller_test.rb | 2 +- test/controllers/traces_controller_test.rb | 2 +- 18 files changed, 236 insertions(+), 110 deletions(-) create mode 100644 config/initializers/new_framework_defaults_5_2.rb create mode 100644 config/initializers/new_framework_defaults_6_0.rb diff --git a/Gemfile b/Gemfile index fb5d56f24..8ccc5026b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" # Require rails -gem "rails", "5.2.3" +gem "rails", "6.0.1" # Require things which have moved to gems in ruby 1.9 gem "bigdecimal", "~> 1.1.0", :platforms => :ruby_19 @@ -21,9 +21,6 @@ gem "sassc-rails" # Use Uglifier as compressor for JavaScript assets gem "uglifier", ">= 1.3.0" -# Use CoffeeScript for .js.coffee assets and views -gem "coffee-rails", "~> 4.2" - # Use jquery as the JavaScript library gem "jquery-rails" @@ -31,7 +28,7 @@ gem "jquery-rails" gem "jbuilder", "~> 2.7" # Reduces boot times through caching; required in config/boot.rb -gem "bootsnap", ">= 1.1.0", :require => false +gem "bootsnap", ">= 1.4.2", :require => false # Use R2 for RTL conversion gem "r2", "~> 0.2.7" @@ -46,7 +43,7 @@ gem "image_optim_rails" gem "active_record_union" gem "activerecord-import" gem "cancancan" -gem "composite_primary_keys", "~> 11.1.0" +gem "composite_primary_keys", "~> 12.0.0" gem "config" gem "delayed_job_active_record" gem "dynamic_form" @@ -151,10 +148,11 @@ end # Needed in development as well so rake can see konacha tasks group :development, :test do - gem "capybara", "~> 2.13" + gem "capybara", ">= 2.15" gem "coveralls", :require => false gem "erb_lint", :require => false gem "factory_bot_rails" gem "poltergeist" - gem "puma", "~> 3.7" + gem "puma", "~> 3.11" + gem "selenium-webdriver" end diff --git a/Gemfile.lock b/Gemfile.lock index 7d06ac98d..e9dd8af4b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,57 +4,70 @@ GEM SystemTimer (1.2.3) aasm (5.0.6) concurrent-ruby (~> 1.0) - actioncable (5.2.3) - actionpack (= 5.2.3) + actioncable (6.0.1) + actionpack (= 6.0.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.3) - actionpack (= 5.2.3) - actionview (= 5.2.3) - activejob (= 5.2.3) + actionmailbox (6.0.1) + actionpack (= 6.0.1) + activejob (= 6.0.1) + activerecord (= 6.0.1) + activestorage (= 6.0.1) + activesupport (= 6.0.1) + mail (>= 2.7.1) + actionmailer (6.0.1) + actionpack (= 6.0.1) + actionview (= 6.0.1) + activejob (= 6.0.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.3) - actionview (= 5.2.3) - activesupport (= 5.2.3) + actionpack (6.0.1) + actionview (= 6.0.1) + activesupport (= 6.0.1) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.3) - activesupport (= 5.2.3) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.1) + actionpack (= 6.0.1) + activerecord (= 6.0.1) + activestorage (= 6.0.1) + activesupport (= 6.0.1) + nokogiri (>= 1.8.5) + actionview (6.0.1) + activesupport (= 6.0.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) + rails-html-sanitizer (~> 1.1, >= 1.2.0) active_record_union (1.3.0) activerecord (>= 4.0) - activejob (5.2.3) - activesupport (= 5.2.3) + activejob (6.0.1) + activesupport (= 6.0.1) globalid (>= 0.3.6) - activemodel (5.2.3) - activesupport (= 5.2.3) - activerecord (5.2.3) - activemodel (= 5.2.3) - activesupport (= 5.2.3) - arel (>= 9.0) + activemodel (6.0.1) + activesupport (= 6.0.1) + activerecord (6.0.1) + activemodel (= 6.0.1) + activesupport (= 6.0.1) activerecord-import (1.0.3) activerecord (>= 3.2) - activestorage (5.2.3) - actionpack (= 5.2.3) - activerecord (= 5.2.3) + activestorage (6.0.1) + actionpack (= 6.0.1) + activejob (= 6.0.1) + activerecord (= 6.0.1) marcel (~> 0.3.1) - activesupport (5.2.3) + activesupport (6.0.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + zeitwerk (~> 2.2) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) annotate (3.0.3) activerecord (>= 3.2, < 7.0) rake (>= 10.4, < 14.0) - arel (9.0.0) ast (2.4.0) autoprefixer-rails (8.6.5) execjs @@ -98,24 +111,19 @@ GEM cancancan (3.0.1) canonical-rails (0.2.6) rails (>= 4.1, < 6.1) - capybara (2.18.0) + capybara (3.29.0) addressable mini_mime (>= 0.1.3) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (>= 2.0, < 4.0) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (~> 1.5) + xpath (~> 3.2) + childprocess (3.0.0) cliver (0.3.2) coderay (1.1.2) - coffee-rails (4.2.2) - coffee-script (>= 2.2.0) - railties (>= 4.0.0) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.12.2) - composite_primary_keys (11.1.0) - activerecord (~> 5.2.1) + composite_primary_keys (12.0.0) + activerecord (~> 6.0.0) concurrent-ruby (1.1.5) config (2.0.0) activesupport (>= 4.2) @@ -326,18 +334,20 @@ GEM rack-test (1.1.0) rack (>= 1.0, < 3) rack-uri_sanitizer (0.0.2) - rails (5.2.3) - actioncable (= 5.2.3) - actionmailer (= 5.2.3) - actionpack (= 5.2.3) - actionview (= 5.2.3) - activejob (= 5.2.3) - activemodel (= 5.2.3) - activerecord (= 5.2.3) - activestorage (= 5.2.3) - activesupport (= 5.2.3) + rails (6.0.1) + actioncable (= 6.0.1) + actionmailbox (= 6.0.1) + actionmailer (= 6.0.1) + actionpack (= 6.0.1) + actiontext (= 6.0.1) + actionview (= 6.0.1) + activejob (= 6.0.1) + activemodel (= 6.0.1) + activerecord (= 6.0.1) + activestorage (= 6.0.1) + activesupport (= 6.0.1) bundler (>= 1.3.0) - railties (= 5.2.3) + railties (= 6.0.1) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.4) actionpack (>= 5.0.1.x) @@ -351,17 +361,18 @@ GEM rails-i18n (4.0.2) i18n (~> 0.6) rails (>= 4.0) - railties (5.2.3) - actionpack (= 5.2.3) - activesupport (= 5.2.3) + railties (6.0.1) + actionpack (= 6.0.1) + activesupport (= 6.0.1) method_source rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) + thor (>= 0.20.3, < 2.0) rainbow (3.0.0) rake (13.0.1) rb-fsevent (0.10.3) rb-inotify (0.10.0) ffi (~> 1.0) + regexp_parser (1.6.0) request_store (1.4.1) rack (>= 1.4) rinku (2.0.6) @@ -381,6 +392,7 @@ GEM rubocop (>= 0.72.0) ruby-openid (2.9.2) ruby-progressbar (1.10.1) + rubyzip (2.0.0) safe_yaml (1.0.5) sanitize (5.1.0) crass (~> 1.0.2) @@ -395,6 +407,9 @@ GEM sprockets-rails tilt secure_headers (6.1.1) + selenium-webdriver (3.142.6) + childprocess (>= 0.5, < 4.0) + rubyzip (>= 1.2.2) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) @@ -433,6 +448,7 @@ GEM websocket-extensions (0.1.4) xpath (3.2.0) nokogiri (~> 1.8) + zeitwerk (2.2.1) PLATFORMS ruby @@ -448,14 +464,13 @@ DEPENDENCIES better_errors bigdecimal (~> 1.1.0) binding_of_caller - bootsnap (>= 1.1.0) + bootsnap (>= 1.4.2) browser bzip2-ffi cancancan canonical-rails - capybara (~> 2.13) - coffee-rails (~> 4.2) - composite_primary_keys (~> 11.1.0) + capybara (>= 2.15) + composite_primary_keys (~> 12.0.0) config coveralls dalli @@ -496,12 +511,12 @@ DEPENDENCIES pg poltergeist psych - puma (~> 3.7) + puma (~> 3.11) quad_tile (~> 1.0.1) r2 (~> 0.2.7) rack-cors rack-uri_sanitizer - rails (= 5.2.3) + rails (= 6.0.1) rails-controller-testing rails-i18n (~> 4.0.0) rinku (>= 2.0.6) @@ -512,6 +527,7 @@ DEPENDENCIES sanitize sassc-rails secure_headers + selenium-webdriver strong_migrations uglifier (>= 1.3.0) validates_email_format_of (>= 1.5.1) diff --git a/bin/setup b/bin/setup index ebdfd0277..9944e82a3 100755 --- a/bin/setup +++ b/bin/setup @@ -1,6 +1,5 @@ #!/usr/bin/env ruby require "fileutils" -include FileUtils # path to your application root. APP_ROOT = File.expand_path("..", __dir__) @@ -9,24 +8,25 @@ def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end -chdir APP_ROOT do - # This script is a starting point to setup your application. +FileUtils.chdir APP_ROOT do + # This script is a way to setup or update your development environment automatically. + # This script is idempotent, so that you can run it at anytime and get an expectable outcome. # Add necessary setup steps to this file. puts "== Installing dependencies ==" system! "gem install bundler --conservative" system("bundle check") || system!("bundle install") - # Install JavaScript dependencies if using Yarn + # Install JavaScript dependencies # system('bin/yarn') # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' + # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" - system! "bin/rails db:setup" + system! "bin/rails db:prepare" puts "\n== Removing old logs and tempfiles ==" system! "bin/rails log:clear tmp:clear" diff --git a/config/environments/development.rb b/config/environments/development.rb index 9a3976f76..e54e3bf06 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,6 +16,7 @@ Rails.application.configure do # Run rails dev:cache to toggle caching. if Rails.root.join("tmp", "caching-dev.txt").exist? config.action_controller.perform_caching = true + config.action_controller.enable_fragment_cache_logging = true config.cache_store = :memory_store config.public_file_server.headers = { @@ -27,7 +28,7 @@ Rails.application.configure do config.cache_store = :null_store end - # Store uploaded files on the local file system (see config/storage.yml for options) + # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local # Don't care if the mailer can't send. @@ -52,10 +53,10 @@ Rails.application.configure do # Suppress logger output for asset requests. config.assets.quiet = true - # Export translations automatically + # Export translations automatically. config.middleware.use I18n::JS::Middleware - # Raises error for missing translations + # Raises error for missing translations. # config.action_view.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, diff --git a/config/environments/production.rb b/config/environments/production.rb index ba781e5af..4016be615 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -22,15 +22,12 @@ Rails.application.configure do # Apache or NGINX already handles this. config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? - # Compress JavaScripts and CSS. - config.assets.js_compressor = :uglifier + # Compress CSS using a preprocessor. # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' @@ -38,10 +35,10 @@ Rails.application.configure do # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - # Store uploaded files on the local file system (see config/storage.yml for options) + # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = Settings.storage_service.to_sym - # Mount Action Cable outside main process or domain + # Mount Action Cable outside main process or domain. # config.action_cable.mount_path = nil # config.action_cable.url = 'wss://example.com/cable' # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] @@ -62,9 +59,10 @@ Rails.application.configure do # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Use a real queuing backend for Active Job (and separate queues per environment) + # 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 = "openstreetmap_#{Rails.env}" + # config.active_job.queue_name_prefix = "openstreetmap_production" + config.action_mailer.perform_caching = false # Configure caching of static assets @@ -97,6 +95,27 @@ Rails.application.configure do # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false unless Settings.status == "database_offline" + # Inserts middleware to perform automatic connection switching. + # The `database_selector` hash is used to pass options to the DatabaseSelector + # middleware. The `delay` is used to determine how long to wait after a write + # to send a subsequent read to the primary. + # + # The `database_resolver` class is used by the middleware to determine which + # database is appropriate to use based on the time delay. + # + # The `database_resolver_context` class is used by the middleware to set + # timestamps for the last write to the primary. The resolver uses the context + # class timestamps to determine how long to wait before reading from the + # replica. + # + # By default Rails will store a last write timestamp in the session. The + # DatabaseSelector middleware is designed as such you can define your own + # strategy for connection switching and pass that into the middleware through + # these configuration options. + # config.active_record.database_selector = { delay: 2.seconds } + # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver + # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session + # Enable autoloading of dependencies. config.enable_dependency_loading = true diff --git a/config/environments/test.rb b/config/environments/test.rb index 38975deef..fad06fe51 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,10 +1,11 @@ +# The test environment is used exclusively to run your application's +# test suite. You never need to work with it otherwise. Remember that +# your test database is "scratch space" for the test suite and is wiped +# and recreated between test runs. Don't rely on the data there! + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! config.cache_classes = true # Do not eager load code on boot. This avoids loading your whole application @@ -21,6 +22,7 @@ Rails.application.configure do # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false + config.cache_store = :null_store # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false @@ -28,7 +30,7 @@ Rails.application.configure do # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false - # Store uploaded files on the local file system in a temporary directory + # Store uploaded files on the local file system in a temporary directory. config.active_storage.service = :test config.action_mailer.perform_caching = false @@ -41,12 +43,12 @@ Rails.application.configure do # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - # Export translations automatically + # Export translations automatically. config.middleware.use I18n::JS::Middleware - # Raises error for missing translations + # Raises error for missing translations. config.action_view.raise_on_missing_translations = true - # Use the test adapter for ActiveJob during testing + # Use the test adapter for ActiveJob during testing. config.active_job.queue_adapter = :test end diff --git a/config/initializers/active_storage.rb b/config/initializers/active_storage.rb index bc9091080..361e2edee 100644 --- a/config/initializers/active_storage.rb +++ b/config/initializers/active_storage.rb @@ -1,5 +1,5 @@ -Rails.application.config.active_storage.queue = :storage -Rails.application.config.active_storage.variable_content_types << "image/bmp" +Rails.application.config.active_storage.queues.analysis = :storage +Rails.application.config.active_storage.queues.purge = :storage Rails.configuration.after_initialize do require "active_storage/service/s3_service" @@ -32,5 +32,5 @@ Rails.configuration.after_initialize do ActiveStorage::Variant.prepend(OpenStreetMap::ActiveStorage::Variant) end - ActiveStorage::Service.url_expires_in = 1.week + ActiveStorage.service_urls_expire_in = 1.week end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 255ae108e..156449635 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -9,8 +9,6 @@ Rails.application.config.assets.manifest = Rails.root.join("tmp", "manifest.json # Add additional assets to the asset load path. Rails.application.config.assets.paths << Rails.root.join("config") -# Add additional assets to the asset load path. -# Rails.application.config.assets.paths << Emoji.images_path # Add Yarn node_modules folder to the asset load path. Rails.application.config.assets.paths << Rails.root.join("node_modules") diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index d3bcaa5ec..35d0f26fc 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -11,6 +11,8 @@ # policy.object_src :none # policy.script_src :self, :https # policy.style_src :self, :https +# # If you are using webpack-dev-server then specify webpack-dev-server host +# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? # # Specify URI for violation reports # # policy.report_uri "/csp-violation-report-endpoint" @@ -19,6 +21,9 @@ # If you are using UJS then enable automatic nonce generation # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } +# Set the nonce only to specific directives +# Rails.application.config.content_security_policy_nonce_directives = %w(script-src) + # Report CSP violations to a specified URI # For further information see the following documentation: # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index 2bd558d2f..7992ecdce 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,4 +1,4 @@ -require "rack/cors" +# Be sure to restart your server when you modify this file. # Mark CORS responses as uncacheable as we don't want a browser to # try and reuse a response that had a different origin, even with @@ -18,7 +18,7 @@ end # so browser-requests should be similarly permitted. (Though the API does not # require any custom headers, Ajax frameworks may automatically add headers # such as X-Requested-By to requests.) -Rails.configuration.middleware.use OpenStreetMap::Cors do +Rails.application.config.middleware.insert_before 0, OpenStreetMap::Cors do allow do origins "*" resource "/oauth/*", :headers => :any, :methods => [:get, :post] diff --git a/config/initializers/field_error.rb b/config/initializers/field_error.rb index a3e3d3aac..34b224296 100644 --- a/config/initializers/field_error.rb +++ b/config/initializers/field_error.rb @@ -4,6 +4,6 @@ ActionView::Base.field_error_proc = proc do |html_tag, _instance| if class_attr_index html_tag.insert class_attr_index + 7, "field_with_errors " else - html_tag.insert html_tag.index(%r{/?>}), ' class="field_with_errors"' + html_tag.insert html_tag.index(%r{/?>}), ' class="field_with_errors"'.html_safe end end diff --git a/config/initializers/new_framework_defaults_5_2.rb b/config/initializers/new_framework_defaults_5_2.rb new file mode 100644 index 000000000..c383d072b --- /dev/null +++ b/config/initializers/new_framework_defaults_5_2.rb @@ -0,0 +1,38 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.2 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make Active Record use stable #cache_key alongside new #cache_version method. +# This is needed for recyclable cache keys. +# Rails.application.config.active_record.cache_versioning = true + +# Use AES-256-GCM authenticated encryption for encrypted cookies. +# Also, embed cookie expiry in signed or encrypted cookies for increased security. +# +# This option is not backwards compatible with earlier Rails versions. +# It's best enabled when your entire app is migrated and stable on 5.2. +# +# Existing cookies will be converted on read then written with the new scheme. +# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true + +# Use AES-256-GCM authenticated encryption as default cipher for encrypting messages +# instead of AES-256-CBC, when use_authenticated_message_encryption is set to true. +# Rails.application.config.active_support.use_authenticated_message_encryption = true + +# Add default protection from forgery to ActionController::Base instead of in +# ApplicationController. +# Rails.application.config.action_controller.default_protect_from_forgery = true + +# Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and +# 'f' after migrating old data. +# Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true + +# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header. +# Rails.application.config.active_support.use_sha1_digests = true + +# Make `form_with` generate id attributes for any generated HTML tags. +# Rails.application.config.action_view.form_with_generates_ids = true diff --git a/config/initializers/new_framework_defaults_6_0.rb b/config/initializers/new_framework_defaults_6_0.rb new file mode 100644 index 000000000..92240ef5f --- /dev/null +++ b/config/initializers/new_framework_defaults_6_0.rb @@ -0,0 +1,45 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 6.0 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Don't force requests from old versions of IE to be UTF-8 encoded. +# Rails.application.config.action_view.default_enforce_utf8 = false + +# Embed purpose and expiry metadata inside signed and encrypted +# cookies for increased security. +# +# This option is not backwards compatible with earlier Rails versions. +# It's best enabled when your entire app is migrated and stable on 6.0. +# Rails.application.config.action_dispatch.use_cookies_with_metadata = true + +# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification. +# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false + +# Return false instead of self when enqueuing is aborted from a callback. +# Rails.application.config.active_job.return_false_on_aborted_enqueue = true + +# Send Active Storage analysis and purge jobs to dedicated queues. +# Rails.application.config.active_storage.queues.analysis = :active_storage_analysis +# Rails.application.config.active_storage.queues.purge = :active_storage_purge + +# When assigning to a collection of attachments declared via `has_many_attached`, replace existing +# attachments instead of appending. Use #attach to add new attachments without replacing existing ones. +# Rails.application.config.active_storage.replace_on_assign_to_many = true + +# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail. +# +# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob), +# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions. +# If you send mail in the background, job workers need to have a copy of +# MailDeliveryJob to ensure all delivery jobs are processed properly. +# Make sure your entire app is migrated and stable on 6.0 before using this setting. +# Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob" + +# Enable the same cache key to be reused when the object being cached of type +# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count) +# of the relation's cache key into the cache version to support recycling cache key. +# Rails.application.config.active_record.collection_cache_versioning = true diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index cf733efd1..bbfc3961b 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -10,5 +10,5 @@ end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true +# self.include_root_in_json = true # end diff --git a/config/puma.rb b/config/puma.rb index a5eccf816..5ed443774 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -4,8 +4,9 @@ # 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. # -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } -threads threads_count, threads_count +max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } +min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } +threads min_threads_count, max_threads_count # Specifies the `port` that Puma will listen on to receive requests; default is 3000. # @@ -15,8 +16,11 @@ port ENV.fetch("PORT") { 3000 } # environment ENV.fetch("RAILS_ENV") { "development" } +# Specifies the `pidfile` that Puma will use. +pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } + # Specifies the number of `workers` to boot in clustered mode. -# Workers are forked webserver processes. If using threads and workers together +# 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). diff --git a/db/structure.sql b/db/structure.sql index 78e58d4be..d0e8c21e3 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -320,8 +320,8 @@ ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage CREATE TABLE public.ar_internal_metadata ( key character varying NOT NULL, value character varying, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL ); diff --git a/test/controllers/api/traces_controller_test.rb b/test/controllers/api/traces_controller_test.rb index 820829aad..cc191c083 100644 --- a/test/controllers/api/traces_controller_test.rb +++ b/test/controllers/api/traces_controller_test.rb @@ -337,7 +337,7 @@ module Api assert_response :success assert_equal digest, Digest::MD5.hexdigest(response.body) assert_equal content_type, response.content_type - assert_equal "attachment; filename=\"#{trace.id}.#{extension}\"", @response.header["Content-Disposition"] + assert_equal "attachment; filename=\"#{trace.id}.#{extension}\"; filename*=UTF-8''#{trace.id}.#{extension}", @response.header["Content-Disposition"] end ## diff --git a/test/controllers/traces_controller_test.rb b/test/controllers/traces_controller_test.rb index 84a655794..c27d3c3db 100644 --- a/test/controllers/traces_controller_test.rb +++ b/test/controllers/traces_controller_test.rb @@ -737,7 +737,7 @@ class TracesControllerTest < ActionController::TestCase assert_response :success assert_equal digest, Digest::MD5.hexdigest(response.body) assert_equal content_type, response.content_type - assert_equal "attachment; filename=\"#{trace.id}.#{extension}\"", @response.header["Content-Disposition"] + assert_equal "attachment; filename=\"#{trace.id}.#{extension}\"; filename*=UTF-8''#{trace.id}.#{extension}", @response.header["Content-Disposition"] end def check_trace_picture(trace) -- 2.39.5