diff --git a/Gemfile b/Gemfile index abf0bc78..90dd3a05 100644 --- a/Gemfile +++ b/Gemfile @@ -22,7 +22,7 @@ gem 'json' gem 'kaminari' gem 'lograge' gem 'marc' -gem 'mitlibraries-theme', git: 'https://github.com/mitlibraries/mitlibraries-theme', tag: 'v1.4' +gem 'mitlibraries-theme', git: 'https://github.com/mitlibraries/mitlibraries-theme', tag: 'v1.5' gem 'net-imap', require: false gem 'net-pop', require: false gem 'net-smtp', require: false @@ -30,7 +30,7 @@ gem 'omniauth-rails_csrf_protection' gem 'omniauth-saml' gem 'paper_trail' gem 'puma' -gem 'rails', '~> 7.2.0' +gem 'rails', '~> 8.1.0' gem 'rubyzip' gem 'sass-rails' gem 'sentry-rails' @@ -55,7 +55,6 @@ group :development, :test do end group :development do - gem 'annotate' gem 'dotenv-rails' gem 'letter_opener' gem 'listen' diff --git a/Gemfile.lock b/Gemfile.lock index 1c148640..40806512 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,88 +1,89 @@ GIT remote: https://github.com/mitlibraries/mitlibraries-theme - revision: ba5bdc9840ef817ba0b92e522b92da3f52669fc3 - tag: v1.4 + revision: 135390daff870937212f1d9020abb6aea53c87d9 + tag: v1.5 specs: - mitlibraries-theme (1.0.2) - rails (>= 6, < 8) + mitlibraries-theme (1.1.0) + rails (>= 6, < 9) sassc-rails (~> 2) GEM remote: https://rubygems.org/ specs: - actioncable (7.2.3.1) - actionpack (= 7.2.3.1) - activesupport (= 7.2.3.1) + action_text-trix (2.1.19) + railties + actioncable (8.1.3) + actionpack (= 8.1.3) + activesupport (= 8.1.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.3.1) - actionpack (= 7.2.3.1) - activejob (= 7.2.3.1) - activerecord (= 7.2.3.1) - activestorage (= 7.2.3.1) - activesupport (= 7.2.3.1) + actionmailbox (8.1.3) + actionpack (= 8.1.3) + activejob (= 8.1.3) + activerecord (= 8.1.3) + activestorage (= 8.1.3) + activesupport (= 8.1.3) mail (>= 2.8.0) - actionmailer (7.2.3.1) - actionpack (= 7.2.3.1) - actionview (= 7.2.3.1) - activejob (= 7.2.3.1) - activesupport (= 7.2.3.1) + actionmailer (8.1.3) + actionpack (= 8.1.3) + actionview (= 8.1.3) + activejob (= 8.1.3) + activesupport (= 8.1.3) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.3.1) - actionview (= 7.2.3.1) - activesupport (= 7.2.3.1) - cgi + actionpack (8.1.3) + actionview (= 8.1.3) + activesupport (= 8.1.3) nokogiri (>= 1.8.5) - racc - rack (>= 2.2.4, < 3.3) + rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (7.2.3.1) - actionpack (= 7.2.3.1) - activerecord (= 7.2.3.1) - activestorage (= 7.2.3.1) - activesupport (= 7.2.3.1) + actiontext (8.1.3) + action_text-trix (~> 2.1.15) + actionpack (= 8.1.3) + activerecord (= 8.1.3) + activestorage (= 8.1.3) + activesupport (= 8.1.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.3.1) - activesupport (= 7.2.3.1) + actionview (8.1.3) + activesupport (= 8.1.3) builder (~> 3.1) - cgi erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.3.1) - activesupport (= 7.2.3.1) + activejob (8.1.3) + activesupport (= 8.1.3) globalid (>= 0.3.6) - activemodel (7.2.3.1) - activesupport (= 7.2.3.1) - activerecord (7.2.3.1) - activemodel (= 7.2.3.1) - activesupport (= 7.2.3.1) + activemodel (8.1.3) + activesupport (= 8.1.3) + activerecord (8.1.3) + activemodel (= 8.1.3) + activesupport (= 8.1.3) timeout (>= 0.4.0) - activestorage (7.2.3.1) - actionpack (= 7.2.3.1) - activejob (= 7.2.3.1) - activerecord (= 7.2.3.1) - activesupport (= 7.2.3.1) + activestorage (8.1.3) + actionpack (= 8.1.3) + activejob (= 8.1.3) + activerecord (= 8.1.3) + activesupport (= 8.1.3) marcel (~> 1.0) - activesupport (7.2.3.1) + activesupport (8.1.3) base64 - benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + json logger (>= 1.4.2) - minitest (>= 5.1, < 6) + minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) addressable (2.9.0) public_suffix (>= 2.0.2, < 8.0) administrate (1.0.0) @@ -90,9 +91,6 @@ GEM actionview (>= 6.0, < 9.0) activerecord (>= 6.0, < 9.0) kaminari (~> 1.2.2) - annotate (3.2.0) - activerecord (>= 3.2, < 8.0) - rake (>= 10.4, < 14.0) ansi (1.6.0) ast (2.4.3) aws-eventstream (1.4.0) @@ -122,7 +120,6 @@ GEM aws-eventstream (~> 1, >= 1.0.2) base64 (0.3.0) bcrypt (3.1.22) - benchmark (0.5.0) bigdecimal (4.1.2) bindex (0.8.1) bootsnap (1.24.6) @@ -143,7 +140,6 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - cgi (0.5.2) childprocess (5.1.0) logger (~> 1.5) climate_control (1.2.0) @@ -172,7 +168,7 @@ GEM dotenv (= 3.2.0) railties (>= 6.1) drb (2.2.3) - erb (6.0.4) + erb (6.0.5) erubi (1.13.1) execjs (2.10.1) ffi (1.17.3) @@ -228,10 +224,10 @@ GEM activesupport (>= 4) railties (>= 4) request_store (~> 1.0) - loofah (2.25.1) + loofah (2.25.2) crass (~> 1.0.2) nokogiri (>= 1.12.0) - mail (2.9.0) + mail (2.9.1) logger mini_mime (>= 0.1.1) net-imap @@ -304,33 +300,32 @@ GEM rack (>= 1.3) rackup (2.3.1) rack (>= 3) - rails (7.2.3.1) - actioncable (= 7.2.3.1) - actionmailbox (= 7.2.3.1) - actionmailer (= 7.2.3.1) - actionpack (= 7.2.3.1) - actiontext (= 7.2.3.1) - actionview (= 7.2.3.1) - activejob (= 7.2.3.1) - activemodel (= 7.2.3.1) - activerecord (= 7.2.3.1) - activestorage (= 7.2.3.1) - activesupport (= 7.2.3.1) + rails (8.1.3) + actioncable (= 8.1.3) + actionmailbox (= 8.1.3) + actionmailer (= 8.1.3) + actionpack (= 8.1.3) + actiontext (= 8.1.3) + actionview (= 8.1.3) + activejob (= 8.1.3) + activemodel (= 8.1.3) + activerecord (= 8.1.3) + activestorage (= 8.1.3) + activesupport (= 8.1.3) bundler (>= 1.15.0) - railties (= 7.2.3.1) + railties (= 8.1.3) rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.7.0) - loofah (~> 2.25) + rails-html-sanitizer (1.7.1) + loofah (~> 2.25, >= 2.25.2) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) rails-mermaid_erd (0.8.0) rails (>= 5.2) - railties (7.2.3.1) - actionpack (= 7.2.3.1) - activesupport (= 7.2.3.1) - cgi + railties (8.1.3) + actionpack (= 8.1.3) + activesupport (= 8.1.3) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -443,6 +438,7 @@ GEM unicode-emoji (~> 4.1) unicode-emoji (4.2.0) uniform_notifier (1.18.0) + uri (1.1.1) useragent (0.16.11) warden (1.2.9) rack (>= 2.0.9) @@ -470,7 +466,6 @@ PLATFORMS DEPENDENCIES administrate (~> 1.0.0) - annotate aws-sdk-rails aws-sdk-s3 aws-sdk-sqs @@ -505,7 +500,7 @@ DEPENDENCIES paper_trail pg puma - rails (~> 7.2.0) + rails (~> 8.1.0) rails-mermaid_erd rubocop rubocop-rails diff --git a/app/models/active_storage_attachment_extension.rb b/app/models/active_storage_attachment_extension.rb index 279c2db6..190dcf58 100644 --- a/app/models/active_storage_attachment_extension.rb +++ b/app/models/active_storage_attachment_extension.rb @@ -7,7 +7,7 @@ module ActiveStorageAttachmentExtension extend ActiveSupport::Concern included do - enum purpose: %i[thesis_pdf thesis_source thesis_supplementary_file - proquest_form signature_page] + enum :purpose, %i[thesis_pdf thesis_source thesis_supplementary_file + proquest_form signature_page] end end diff --git a/app/models/archivematica_payload.rb b/app/models/archivematica_payload.rb index f59fd70c..42922131 100644 --- a/app/models/archivematica_payload.rb +++ b/app/models/archivematica_payload.rb @@ -32,7 +32,7 @@ class ArchivematicaPayload < ApplicationRecord before_create :set_metadata_csv, :set_payload_json - enum preservation_status: %i[unpreserved preserved] + enum :preservation_status, %i[unpreserved preserved] private diff --git a/app/models/hold.rb b/app/models/hold.rb index 666fd692..3d1a19fb 100644 --- a/app/models/hold.rb +++ b/app/models/hold.rb @@ -21,7 +21,7 @@ class Hold < ApplicationRecord belongs_to :hold_source has_many :users, through: :thesis - enum status: %i[active expired released] + enum :status, %i[active expired released] validates :date_requested, presence: true validates :date_start, presence: true diff --git a/app/models/report.rb b/app/models/report.rb index 1440b102..a5a341a2 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -4,7 +4,7 @@ class Report def card_empty_theses(collection) { 'value' => collection.count, - 'verb' => 'has', + 'verb' => ['has', 'have'], 'label' => 'no attached files' } end @@ -13,7 +13,7 @@ def card_files(collection, term) subset = collection.joins(:files_attachments) { 'value' => subset.pluck(:id).uniq.count, - 'verb' => 'has', + 'verb' => ['has', 'have'], 'label' => 'files attached', 'note' => 'Only theses with a status of "Not ready for publication" and "Publication review" will be visible ' \ 'in the processing queue.', @@ -35,7 +35,7 @@ def card_issues(collection) def card_multiple_authors(collection) { 'value' => collection.joins(:authors).group('theses.id').having('COUNT(authors.id) > 1').length, - 'verb' => 'has', + 'verb' => ['has', 'have'], 'label' => 'multiple authors' } end @@ -43,7 +43,7 @@ def card_multiple_authors(collection) def card_multiple_degrees(collection) { 'value' => collection.joins(:degrees).group('theses.id').having('COUNT(degrees.id) > 1').length, - 'verb' => 'has', + 'verb' => ['has', 'have'], 'label' => 'multiple degrees' } end @@ -51,7 +51,7 @@ def card_multiple_degrees(collection) def card_multiple_departments(collection) { 'value' => collection.joins(:departments).group('theses.id').having('COUNT(departments.id) > 1').length, - 'verb' => 'has', + 'verb' => ['has', 'have'], 'label' => 'multiple departments' } end @@ -60,7 +60,7 @@ def card_overall(collection, term) searchterm = term if term != 'all' { 'value' => collection.count, - 'verb' => 'thesis record', + 'verb' => ['thesis record', 'thesis records'], 'link' => { 'url' => url_helpers.admin_theses_path(search: searchterm), 'text' => 'See all in admin dashboard' @@ -71,7 +71,7 @@ def card_overall(collection, term) def card_student_contributions(collection) { 'value' => collection.map(&:student_contributed?).count(true), - 'verb' => 'has', + 'verb' => ['has', 'have'], 'label' => 'had metadata contributed by students' } end diff --git a/app/models/submission_information_package.rb b/app/models/submission_information_package.rb index f440e5dc..216ecfc0 100644 --- a/app/models/submission_information_package.rb +++ b/app/models/submission_information_package.rb @@ -35,7 +35,7 @@ class SubmissionInformationPackage < ApplicationRecord before_create :set_metadata, :set_bag_declaration, :set_manifest, :set_bag_name - enum preservation_status: %i[unpreserved preserved] + enum :preservation_status, %i[unpreserved preserved] def data file_locations = {} diff --git a/app/models/thesis.rb b/app/models/thesis.rb index 27408949..af8217ad 100644 --- a/app/models/thesis.rb +++ b/app/models/thesis.rb @@ -148,7 +148,7 @@ class Thesis < ApplicationRecord } scope :ready_for_proquest_export, -> { partial_proquest_export + full_proquest_export } - enum proquest_exported: ['Not exported', 'Full harvest', 'Partial harvest'] + enum :proquest_exported, ['Not exported', 'Full harvest', 'Partial harvest'] # Looks up the thesis' accession number based on its degree period. def accession_number diff --git a/app/views/admin/theses/show.html.erb b/app/views/admin/theses/show.html.erb index 726528ec..169fa8cd 100644 --- a/app/views/admin/theses/show.html.erb +++ b/app/views/admin/theses/show.html.erb @@ -17,7 +17,7 @@ as well as a link to its edit page. %> <% content_for(:title) { t("administrate.actions.show_resource", name: page.page_title) } %> -<% content_for(:custom_stylesheets) { stylesheet_link_tag "administrate" } %> +<% content_for(:custom_stylesheets) { stylesheet_link_tag "administrate/application" } %>

diff --git a/app/views/layouts/admin/application.html.erb b/app/views/layouts/admin/application.html.erb index b524ffdd..75dbe7a5 100644 --- a/app/views/layouts/admin/application.html.erb +++ b/app/views/layouts/admin/application.html.erb @@ -22,7 +22,7 @@ By default, it renders: <%= content_for(:title) %> - <%= application_title %> <%= render "stylesheet" %> - <%= stylesheet_link_tag "administrate", data: { turbo_track: "reload" } %> + <%= stylesheet_link_tag "administrate/application", data: { turbo_track: "reload" } %> <%= csrf_meta_tags %> <%= csp_meta_tag if defined?(csp_meta_tag) %> diff --git a/app/views/report/_card.html.erb b/app/views/report/_card.html.erb index 72697362..2a1a5638 100644 --- a/app/views/report/_card.html.erb +++ b/app/views/report/_card.html.erb @@ -1,7 +1,7 @@

message <% end %>hero-text"> <% if card[1]["verb"] %> - <%= pluralize(card[1]["value"].to_i, card[1]["verb"]) %> <%= card[1]["label"] %> + <%= pluralize(card[1]["value"].to_i, card[1]["verb"][0], card[1]["verb"][1]) %> <%= card[1]["label"] %> <% else %> <%= card[1]["value"] %> <%= card[1]["label"] %> <% end %> diff --git a/bin/ci b/bin/ci new file mode 100755 index 00000000..4137ad5b --- /dev/null +++ b/bin/ci @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +require_relative "../config/boot" +require "active_support/continuous_integration" + +CI = ActiveSupport::ContinuousIntegration +require_relative "../config/ci.rb" diff --git a/bin/dev b/bin/dev new file mode 100755 index 00000000..5f91c205 --- /dev/null +++ b/bin/dev @@ -0,0 +1,2 @@ +#!/usr/bin/env ruby +exec "./bin/rails", "server", *ARGV diff --git a/bin/rubocop b/bin/rubocop index 40330c0f..5a205047 100755 --- a/bin/rubocop +++ b/bin/rubocop @@ -2,7 +2,7 @@ require "rubygems" require "bundler/setup" -# explicit rubocop config increases performance slightly while avoiding config confusion. +# Explicit RuboCop config increases performance slightly while avoiding config confusion. ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__)) load Gem.bin_path("rubocop", "rubocop") diff --git a/bin/setup b/bin/setup index 84c03f7d..81be011e 100755 --- a/bin/setup +++ b/bin/setup @@ -2,7 +2,6 @@ require "fileutils" APP_ROOT = File.expand_path("..", __dir__) -APP_NAME = "thing" def system!(*args) system(*args, exception: true) @@ -14,7 +13,6 @@ FileUtils.chdir APP_ROOT do # Add necessary setup steps to this file. puts "== Installing dependencies ==" - system! "gem install bundler --conservative" system("bundle check") || system!("bundle install") # puts "\n== Copying sample files ==" @@ -24,14 +22,14 @@ FileUtils.chdir APP_ROOT do puts "\n== Preparing database ==" system! "bin/rails db:prepare" + system! "bin/rails db:reset" if ARGV.include?("--reset") puts "\n== Removing old logs and tempfiles ==" system! "bin/rails log:clear tmp:clear" - puts "\n== Restarting application server ==" - system! "bin/rails restart" - - # puts "\n== Configuring puma-dev ==" - # system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}" - # system "curl -Is https://#{APP_NAME}.test/up | head -n 1" + unless ARGV.include?("--skip-server") + puts "\n== Starting development server ==" + STDOUT.flush # flush the output before exec(2) so that it displays + exec "bin/dev" + end end diff --git a/config/application.rb b/config/application.rb index 62772772..3dedb81f 100644 --- a/config/application.rb +++ b/config/application.rb @@ -17,7 +17,7 @@ class Application < Rails::Application config.flipflop.raise_strategy_errors = nil # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 7.2 + config.load_defaults 8.1 # 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. diff --git a/config/ci.rb b/config/ci.rb new file mode 100644 index 00000000..9014db21 --- /dev/null +++ b/config/ci.rb @@ -0,0 +1,22 @@ +# Run using bin/ci + +CI.run do + step "Setup", "bin/setup --skip-server" + + step "Style: Ruby", "bin/rubocop" + + # step "Security: Importmap vulnerability audit", "bin/importmap audit" + step "Tests: Rails", "bin/rails test" + step "Tests: Seeds", "env RAILS_ENV=test bin/rails db:seed:replant" + + # Optional: Run system tests + # step "Tests: System", "bin/rails test:system" + + # Optional: set a green GitHub commit status to unblock PR merge. + # Requires the `gh` CLI and `gh extension install basecamp/gh-signoff`. + # if success? + # step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff" + # else + # failure "Signoff: CI failed. Do not merge or deploy.", "Fix the issues and try again." + # end +end diff --git a/config/environments/development.rb b/config/environments/development.rb index 95c2be97..d9ccf12e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,6 +1,8 @@ require "active_support/core_ext/integer/time" Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + # Before filter for Flipflop dashboard. Replace with a lambda or method name # defined in ApplicationController to implement access control. config.flipflop.dashboard_access_filter = nil @@ -18,11 +20,7 @@ Bullet.add_footer = true end - # Settings specified here will take precedence over those in config/application.rb. - - # In the development environment your application's code is reloaded any time - # 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. + # Make code changes take effect immediately without server restart. config.enable_reloading = true # Do not eager load code on boot. @@ -34,20 +32,19 @@ # Enable server timing. config.server_timing = true - # Enable/disable caching. By default caching is disabled. - # Run rails dev:cache to toggle caching. + # Enable/disable Action Controller caching. By default Action Controller caching is disabled. + # Run rails dev:cache to toggle Action Controller 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 = { "Cache-Control" => "public, max-age=#{2.days.to_i}" } + config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false - - config.cache_store = :null_store end + # Change to :null_store to avoid any caching. + config.cache_store = :memory_store + # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local @@ -59,30 +56,30 @@ # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false - # Disable caching for Action Mailer templates even if Action Controller - # caching is enabled. + # Make template changes take effect immediately. config.action_mailer.perform_caching = false + # Set localhost to be used by links generated in mailer templates. config.action_mailer.default_url_options = { host: "localhost", port: 3000 } # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log - # Raise exceptions for disallowed deprecations. - config.active_support.disallowed_deprecation = :raise - - # Tell Active Support which deprecation messages to disallow. - config.active_support.disallowed_deprecation_warnings = [] - # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true + # Append comments with runtime information tags to SQL queries in logs. + config.active_record.query_log_tags_enabled = true + # Highlight code that enqueued background job in logs. config.active_job.verbose_enqueue_logs = true + # Highlight code that triggered redirect in logs. + config.action_dispatch.verbose_redirect_logs = true + # Suppress logger output for asset requests. config.assets.quiet = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 22243e71..5640fff3 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -6,49 +6,29 @@ # Code is not reloaded between requests. config.enable_reloading = false - # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both threaded web servers - # and those relying on copy on write to perform better. - # Rake tasks automatically ignore this option for performance. + # Eager load code on boot for better performance and memory savings (ignored by Rake tasks). config.eager_load = true - # Full error reports are disabled and caching is turned on. + # Full error reports are disabled. config.consider_all_requests_local = false - config.action_controller.perform_caching = true - # 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 + # Turn on fragment caching in view templates. + config.action_controller.perform_caching = true # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? - # Compress JavaScripts and CSS. - config.assets.js_compressor = :terser - # Compress CSS using a preprocessor. - # config.assets.css_compressor = :sass - - # Do not fall back to assets pipeline if a precompiled asset is missed. - config.assets.compile = false + # Cache assets for far-future expiry since they are all digest stamped. + config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" } # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.asset_host = "http://assets.example.com" - # Specifies the header that your server uses for sending files. - # 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 Amazon S3. config.active_storage.service = :amazon - # 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.*/ ] - # 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 + config.assume_ssl = true # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. config.force_ssl = true @@ -57,24 +37,25 @@ # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } } # Log to STDOUT by default + config.log_tags = [ :request_id ] config.logger = ActiveSupport::Logger.new(STDOUT) .tap { |logger| logger.formatter = ::Logger::Formatter.new } .then { |logger| ActiveSupport::TaggedLogging.new(logger) } - # Prepend all log lines with the following tags. - 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". + # Change to "debug" to log everything (including potentially personally-identifiable information!). config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") - # Use a different cache store in production. + # Prevent health checks from clogging up the logs. + config.silence_healthcheck_path = "/up" + + # Don't log any deprecations. + config.active_support.report_deprecations = false + + # Replace the default in-process memory cache store with a durable alternative. # config.cache_store = :mem_cache_store - # Use a real queuing backend for Active Job (and separate queues per environment). + # Replace the default in-process and non-durable queuing backend for Active Job. # config.active_job.queue_adapter = :resque - # config.active_job.queue_name_prefix = "thing_production" # Disable caching for Action Mailer templates even if Action Controller # caching is enabled. @@ -99,9 +80,6 @@ # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true - # Don't log any deprecations. - config.active_support.report_deprecations = false - # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false @@ -113,6 +91,7 @@ # "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 diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index da303aef..48732442 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -5,9 +5,3 @@ # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path - -# Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in the app/assets -# folder are already added. -# Rails.application.config.assets.precompile += %w( admin.js admin.css ) -Rails.application.config.assets.precompile += %w( administrate.css ) diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index b3076b38..d51d7139 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -20,6 +20,10 @@ # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } # config.content_security_policy_nonce_directives = %w(script-src style-src) # +# # Automatically add `nonce` to `javascript_tag`, `javascript_include_tag`, and `stylesheet_link_tag` +# # if the corresponding directives are specified in `content_security_policy_nonce_directives`. +# # config.content_security_policy_nonce_auto = true +# # # Report violations without enforcing the policy. # # config.content_security_policy_report_only = true # end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 18c00753..620a82dd 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -56,8 +56,8 @@ idp_sso_target_url: ENV['IDP_SSO_URL'], idp_cert: idp_metadata[:idp_cert], idp_cert_multi: idp_metadata[:idp_cert_multi], - certificate: Base64.strict_decode64(ENV['SP_CERTIFICATE']), - private_key: Base64.strict_decode64(ENV['SP_PRIVATE_KEY']), + certificate: Base64.strict_decode64(ENV.fetch('SP_CERTIFICATE', '')), + private_key: Base64.strict_decode64(ENV.fetch('SP_PRIVATE_KEY', '')), issuer: ENV['SP_ENTITY_ID'], request_attributes: {}, allowed_clock_drift: 2.seconds, diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index c010b83d..c0b717f7 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -4,5 +4,5 @@ # Use this to limit dissemination of sensitive information. # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. Rails.application.config.filter_parameters += [ - :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn + :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc ] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index a945b18d..3860f659 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -14,7 +14,3 @@ # ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.acronym "RESTful" # end - -ActiveSupport::Inflector.inflections(:en) do |inflect| - inflect.irregular "has", "have" -end diff --git a/config/puma.rb b/config/puma.rb index 03c166f4..38c4b865 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,13 +1,18 @@ # 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. - +# # Puma starts a configurable number of processes (workers) and each process # serves each request in a thread from an internal thread pool. # +# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You +# should only set this value when you want to run 2 or more workers. The +# default is already 1. You can set it to `auto` to automatically start a worker +# for each available processor. +# # 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. +# prioritize throughput over latency. # # 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 @@ -29,6 +34,9 @@ # Allow puma to be restarted by `bin/rails restart` command. plugin :tmp_restart +# Run the Solid Queue supervisor inside of Puma for single-server deployments. +plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"] + # Specify the PID file. Defaults to tmp/pids/server.pid in development. # In other environments, only set the PID file if requested. pidfile ENV["PIDFILE"] if ENV["PIDFILE"] diff --git a/config/routes.rb b/config/routes.rb index 7aa7b2c3..6bedbe2c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,8 @@ Rails.application.routes.draw do + # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. + # Can be used by load balancers and uptime monitors to verify that the app is live. + get "up" => "rails/health#show", as: :rails_health_check + mount Flipflop::Engine => "/flipflop" # For details see http://guides.rubyonrails.org/routing.html namespace :admin do diff --git a/public/400.html b/public/400.html new file mode 100644 index 00000000..640de033 --- /dev/null +++ b/public/400.html @@ -0,0 +1,135 @@ + + + + + + + The server cannot process the request due to a client error (400 Bad Request) + + + + + + + + + + + + + +

+
+ +
+
+

The server cannot process the request due to a client error. Please check the request and try again. If you're the application owner check the logs for more information.

+
+
+ + + + diff --git a/public/404.html b/public/404.html index 2be3af26..d7f0f142 100644 --- a/public/404.html +++ b/public/404.html @@ -1,67 +1,135 @@ - - - - The page you were looking for doesn't exist (404) - - - - - - -
-
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

-
-

If you are the application owner check the logs for more information.

-
- + + + + + + + The page you were looking for doesn't exist (404 Not found) + + + + + + + + + + + + + +
+
+ +
+
+

The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved. If you're the application owner check the logs for more information.

+
+
+ + + diff --git a/public/406-unsupported-browser.html b/public/406-unsupported-browser.html index 7cf1e168..43d2811e 100644 --- a/public/406-unsupported-browser.html +++ b/public/406-unsupported-browser.html @@ -1,66 +1,135 @@ - - - - Your browser is not supported (406) - - - - - - -
-
-

Your browser is not supported.

-

Please upgrade your browser to continue.

-
-
- + + + + + + + Your browser is not supported (406 Not Acceptable) + + + + + + + + + + + + + +
+
+ +
+
+

Your browser is not supported.
Please upgrade your browser to continue.

+
+
+ + + diff --git a/public/422.html b/public/422.html index c08eac0d..f12fb4aa 100644 --- a/public/422.html +++ b/public/422.html @@ -1,67 +1,135 @@ - - - - The change you wanted was rejected (422) - - - - - - -
-
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

-
-

If you are the application owner check the logs for more information.

-
- + + + + + + + The change you wanted was rejected (422 Unprocessable Entity) + + + + + + + + + + + + + +
+
+ +
+
+

The change you wanted was rejected. Maybe you tried to change something you didn't have access to. If you're the application owner check the logs for more information.

+
+
+ + + diff --git a/public/500.html b/public/500.html index 78a030af..e4eb18a7 100644 --- a/public/500.html +++ b/public/500.html @@ -1,66 +1,135 @@ - - - - We're sorry, but something went wrong (500) - - - - - - -
-
-

We're sorry, but something went wrong.

-
-

If you are the application owner check the logs for more information.

-
- + + + + + + + We're sorry, but something went wrong (500 Internal Server Error) + + + + + + + + + + + + + +
+
+ +
+
+

We're sorry, but something went wrong.
If you're the application owner check the logs for more information.

+
+
+ + + diff --git a/public/icon.png b/public/icon.png index f3b5abcb..c4c9dbfb 100644 Binary files a/public/icon.png and b/public/icon.png differ diff --git a/public/icon.svg b/public/icon.svg index 78307ccd..04b34bf8 100644 --- a/public/icon.svg +++ b/public/icon.svg @@ -1,3 +1,3 @@ - - + + diff --git a/renovate.json b/renovate.json index f57cbf0b..59012a68 100644 --- a/renovate.json +++ b/renovate.json @@ -8,13 +8,13 @@ "matchPackageNames": [ "ruby" ], - "allowedVersions": "<3.5" + "allowedVersions": "<4" }, { "matchPackageNames": [ "rails" ], - "allowedVersions": "<8.0" + "allowedVersions": "<8.2" } ] }