diff --git a/personal/Gemfile b/personal/Gemfile index 9b7d06a..dc5e274 100644 --- a/personal/Gemfile +++ b/personal/Gemfile @@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby "3.4.1" # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" -gem "rails", "~> 7.2" +gem "rails", "~> 8.0.0" # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] gem "sprockets-rails" @@ -20,7 +20,7 @@ gem 'puma', github: 'puma/puma' # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] gem "importmap-rails" -gem "cssbundling-rails", "~> 1.1" +gem "cssbundling-rails" # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] gem "turbo-rails" @@ -78,7 +78,7 @@ gem "webauthn" # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] -gem "image_processing", "~> 1.2" +gem "image_processing" #, "~> 1.2" group :development, :test do # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem @@ -112,8 +112,8 @@ end -gem "pagy", "~> 6.0.4" -gem 'activerecord-postgis-adapter' +gem "pagy" +#gem 'activerecord-postgis-adapter' gem 'httparty' gem "pghero" gem "pg_query" @@ -123,6 +123,6 @@ gem 'ox', require: false gem "solid_cache", "~> 1.0" -gem "sqlite3", "~> 2.3" +gem "sqlite3" gem "solid_cable", "~> 3.0" diff --git a/personal/Gemfile.lock b/personal/Gemfile.lock index c2595a0..7f58a3c 100644 --- a/personal/Gemfile.lock +++ b/personal/Gemfile.lock @@ -28,69 +28,65 @@ GEM specs: action_policy (0.7.3) ruby-next-core (>= 1.0) - actioncable (7.2.2.1) - actionpack (= 7.2.2.1) - activesupport (= 7.2.2.1) + actioncable (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.2.1) - actionpack (= 7.2.2.1) - activejob (= 7.2.2.1) - activerecord (= 7.2.2.1) - activestorage (= 7.2.2.1) - activesupport (= 7.2.2.1) + actionmailbox (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) mail (>= 2.8.0) - actionmailer (7.2.2.1) - actionpack (= 7.2.2.1) - actionview (= 7.2.2.1) - activejob (= 7.2.2.1) - activesupport (= 7.2.2.1) + actionmailer (8.0.1) + actionpack (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activesupport (= 8.0.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.2.1) - actionview (= 7.2.2.1) - activesupport (= 7.2.2.1) + actionpack (8.0.1) + actionview (= 8.0.1) + activesupport (= 8.0.1) nokogiri (>= 1.8.5) - racc - rack (>= 2.2.4, < 3.2) + 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.2.1) - actionpack (= 7.2.2.1) - activerecord (= 7.2.2.1) - activestorage (= 7.2.2.1) - activesupport (= 7.2.2.1) + actiontext (8.0.1) + actionpack (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.2.1) - activesupport (= 7.2.2.1) + actionview (8.0.1) + activesupport (= 8.0.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.2.1) - activesupport (= 7.2.2.1) + activejob (8.0.1) + activesupport (= 8.0.1) globalid (>= 0.3.6) - activemodel (7.2.2.1) - activesupport (= 7.2.2.1) - activerecord (7.2.2.1) - activemodel (= 7.2.2.1) - activesupport (= 7.2.2.1) + activemodel (8.0.1) + activesupport (= 8.0.1) + activerecord (8.0.1) + activemodel (= 8.0.1) + activesupport (= 8.0.1) timeout (>= 0.4.0) - activerecord-postgis-adapter (10.0.1) - activerecord (~> 7.2.0) - rgeo-activerecord (~> 8.0.0) - activestorage (7.2.2.1) - actionpack (= 7.2.2.1) - activejob (= 7.2.2.1) - activerecord (= 7.2.2.1) - activesupport (= 7.2.2.1) + activestorage (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activesupport (= 8.0.1) marcel (~> 1.0) - activesupport (7.2.2.1) + activesupport (8.0.1) base64 benchmark (>= 0.3) bigdecimal @@ -102,6 +98,7 @@ GEM minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) aes_key_wrap (1.1.0) @@ -311,7 +308,7 @@ GEM ostruct (0.6.1) ox (2.14.19) bigdecimal (>= 3.0) - pagy (6.0.4) + pagy (9.3.3) parallel (1.26.3) parser (3.3.6.0) ast (~> 2.4.1) @@ -338,20 +335,20 @@ GEM rack (>= 1.3) rackup (2.2.1) rack (>= 3) - rails (7.2.2.1) - actioncable (= 7.2.2.1) - actionmailbox (= 7.2.2.1) - actionmailer (= 7.2.2.1) - actionpack (= 7.2.2.1) - actiontext (= 7.2.2.1) - actionview (= 7.2.2.1) - activejob (= 7.2.2.1) - activemodel (= 7.2.2.1) - activerecord (= 7.2.2.1) - activestorage (= 7.2.2.1) - activesupport (= 7.2.2.1) + rails (8.0.1) + actioncable (= 8.0.1) + actionmailbox (= 8.0.1) + actionmailer (= 8.0.1) + actionpack (= 8.0.1) + actiontext (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activemodel (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) bundler (>= 1.15.0) - railties (= 7.2.2.1) + railties (= 8.0.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -363,9 +360,9 @@ GEM json (>= 1.7, < 3) rails rubyzip (~> 2) - railties (7.2.2.1) - actionpack (= 7.2.2.1) - activesupport (= 7.2.2.1) + railties (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -390,10 +387,6 @@ GEM mime-types (>= 1.16, < 4.0) netrc (~> 0.8) rexml (3.4.0) - rgeo (3.0.1) - rgeo-activerecord (8.0.0) - activerecord (>= 7.0) - rgeo (>= 3.0) rubocop (1.69.2) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -526,7 +519,6 @@ PLATFORMS DEPENDENCIES action_policy - activerecord-postgis-adapter auto_strip_attributes awesome_print aws-sdk-cognitoidentityprovider @@ -536,7 +528,7 @@ DEPENDENCIES bullet capybara cognito_token_verifier! - cssbundling-rails (~> 1.1) + cssbundling-rails debug down friendly_id @@ -544,7 +536,7 @@ DEPENDENCIES high_voltage hiredis httparty - image_processing (~> 1.2) + image_processing importmap-rails jbuilder jwt @@ -554,13 +546,13 @@ DEPENDENCIES oauth2 oj ox - pagy (~> 6.0.4) + pagy pg pg_query pg_search pghero puma! - rails (~> 7.2) + rails (~> 8.0.0) rails_real_favicon redis rubocop @@ -576,7 +568,7 @@ DEPENDENCIES solid_cable (~> 3.0) solid_cache (~> 1.0) sprockets-rails - sqlite3 (~> 2.3) + sqlite3 stimulus-rails turbo-rails tzinfo-data diff --git a/personal/bin/setup b/personal/bin/setup index 6f3207f..be3db3c 100755 --- a/personal/bin/setup +++ b/personal/bin/setup @@ -2,7 +2,6 @@ require "fileutils" APP_ROOT = File.expand_path("..", __dir__) -APP_NAME = "personal" 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 ==" @@ -28,10 +26,9 @@ FileUtils.chdir APP_ROOT do 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/personal/config/application.rb b/personal/config/application.rb index ad70b08..aac561c 100644 --- a/personal/config/application.rb +++ b/personal/config/application.rb @@ -2,7 +2,6 @@ require "rails/all" - # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) @@ -12,12 +11,10 @@ class Application < Rails::Application require "utils/formatters/json" require "utils/formatters/lograge" require "custom_logger" - ActiveRecord::Tasks::DatabaseTasks.structure_dump_flags = ['--clean', '--if-exists'] # Initialize configuration defaults for originally generated Rails version. config.load_defaults 7.2 config.active_record.schema_format = :ruby config.active_record.dump_schemas = :all - config.generators do |g| g.orm :active_record, primary_key_type: :uuid end @@ -27,12 +24,6 @@ class Application < Rails::Application # Common ones are `templates`, `generators`, or `middleware`, for example. config.autoload_lib(ignore: %w[assets tasks]) - - - config.assets.gzip = false - config.active_job.queue_adapter = :sidekiq - - # Configuration for the application, engines, and railties goes here. # # These settings can be overridden in specific environments using the files @@ -44,5 +35,6 @@ class Application < Rails::Application end end + Credentials = Rails.application.credentials.config[Rails.env.to_sym] HOSTNAME = Socket.gethostname || 'unknown host' \ No newline at end of file diff --git a/personal/config/environments/development.rb b/personal/config/environments/development.rb index 1be57ad..4cc21c4 100644 --- a/personal/config/environments/development.rb +++ b/personal/config/environments/development.rb @@ -1,32 +1,10 @@ -require 'active_support/core_ext/integer/time' +require "active_support/core_ext/integer/time" Rails.application.configure do - config.after_initialize do - Bullet.enable = false - Bullet.alert = true - Bullet.bullet_logger = true - Bullet.console = true - Bullet.rails_logger = true - Bullet.add_footer = true - end - - # Specify AnyCable WebSocket server URL to use by JS client - # config.after_initialize do - # if true - # config.action_cable.url = ActionCable.server.config.url = ENV.fetch('CABLE_URL', '//anycable.personal.test/cable') - # end # AnyCable::Rails.enabled? - # end - #config.turbo.signed_stream_verifier_key = Credentials[:signed_stream_verifier_key] # Settings specified here will take precedence over those in config/application.rb. - config.hosts << 'personal.test' - config.hosts << 'www.personal.test' - config.hosts << 'romanchukopen.test' - config.hosts << 'www.romanchukopen.test' - # config.action_cable.allowed_request_origins = /(\.test$)|^localhost$/ - # 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. - config.cache_classes = false + + # Make code changes take effect immediately without server restart. + config.enable_reloading = true # Do not eager load code on boot. config.eager_load = false @@ -34,74 +12,61 @@ # Show full error reports. config.consider_all_requests_local = true - # Enable server timing + # Enable server timing. config.server_timing = true - # Enable/disable caching. By default caching is disabled. - # Run rails dev:cache to toggle caching. - if Rails.root.join('tmp/caching-dev.txt').exist? + # 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 = :solid_cache_store - - # config.cache_store = :redis_cache_store, { url: "redis://localhost:6379/0", - - # connect_timeout: 30, # Defaults to 20 seconds - # read_timeout: 0.2, # Defaults to 1 second - # write_timeout: 0.2, # Defaults to 1 second - # reconnect_attempts: 1, # Defaults to 0 - # expires_in: 3.months, - # error_handler: -> (method:, returning:, exception:) { - - # Sentry.capture_exception exception, level: 'warning', - # tags: { method: method, returning: returning } - # } - # } - 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 = :amazon + config.active_storage.service = :local # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false + # 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 - # Suppress logger output for asset requests. - config.assets.quiet = false + # Append comments with runtime information tags to SQL queries in logs. + config.active_record.query_log_tags_enabled = true - config.log_level = :debug + # Highlight code that enqueued background job in logs. + config.active_job.verbose_enqueue_logs = true # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true # Annotate rendered view with file names. - # config.action_view.annotate_rendered_view_with_filenames = true + 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_mailer.default_url_options = { host: 'personal.test' } - routes.default_url_options[:host] = 'localhost:3000' + + # Raise error when a before_action's only/except options reference missing actions. + 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 diff --git a/personal/config/environments/production.rb b/personal/config/environments/production.rb index 30dfac4..cbb0f0e 100644 --- a/personal/config/environments/production.rb +++ b/personal/config/environments/production.rb @@ -1,123 +1,89 @@ -# rubocop:disable all -require 'active_support/core_ext/integer/time' +require "active_support/core_ext/integer/time" Rails.application.configure do - # Specify AnyCable WebSocket server URL to use by JS client - # config.after_initialize do - # if AnyCable::Rails.enabled? - # config.action_cable.url = ActionCable.server.config.url = ENV.fetch('CABLE_URL', - # '/cable') - # end - # end - # config.turbo.signed_stream_verifier_key = Credentials[:signed_stream_verifier_key] # Settings specified here will take precedence over those in config/application.rb. # 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 - # 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. - config.consider_all_requests_local = false - 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). - # 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? + # Full error reports are disabled. + config.consider_all_requests_local = false - # Compress CSS using a preprocessor. - # config.assets.css_compressor = :sass + # Turn on fragment caching in view templates. + config.action_controller.perform_caching = true - # Do not fallback 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). - config.active_storage.service = :amazon + config.active_storage.service = :local - # 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. + config.assume_ssl = true # 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. - config.log_tags = [:request_id] + # Log to STDOUT with the current request id as a default log tag. + config.log_tags = [ :request_id ] + config.logger = ActiveSupport::TaggedLogging.logger(STDOUT) - # Use a different cache store in production. - config.cache_store = :solid_cache_store + # Change to "debug" to log everything (including potentially personally-identifiable information!) + config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") + # Prevent health checks from clogging up the logs. + config.silence_healthcheck_path = "/up" - # 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 = "personal_production" + # Don't log any deprecations. + config.active_support.report_deprecations = false - config.action_mailer.perform_caching = false + # Replace the default in-process memory cache store with a durable alternative. + # config.cache_store = :mem_cache_store + + # Replace the default in-process and non-durable queuing backend for Active Job. + # config.active_job.queue_adapter = :resque # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false + # Set host to be used by links generated in mailer templates. + config.action_mailer.default_url_options = { host: "romanch.uk" } + + # Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit. + # config.action_mailer.smtp_settings = { + # user_name: Rails.application.credentials.dig(:smtp, :user_name), + # password: Rails.application.credentials.dig(:smtp, :password), + # address: "smtp.example.com", + # port: 587, + # authentication: :plain + # } + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # 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 - - # Use default logging formatter so that PID and timestamp are not suppressed. - # config.log_formatter = ::Logger::Formatter.new - - # if true #ENV["RAILS_LOG_TO_STDOUT"].present? - # logger = ActiveSupport::Logger.new(STDOUT) - # logger.formatter = config.log_formatter - # config.logger = ActiveSupport::Logger.new(STDOUT) #ActiveSupport::TaggedLogging.new(logger) - # end - # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false - # config.logger = CustomLogger.logger - # config.log_formatter = Utils::Formatters::Json.new - logger = ActiveSupport::Logger.new(STDOUT) - logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) - config.lograge.enabled = true - #config.colorize_logging = false - config.lograge.ignore_actions = ['HomeController#status'] - #config.lograge.formatter = Utils::Formatters::Lograge.new - config.lograge.custom_options = lambda do |event| - { - url: event.payload[:url], - ua: event.payload[:ua], - host: event.payload[:host], - user_id: event.payload[:user_id] || event.payload[:amzn_oidc_identity], - host: event.payload[:host], - ip: event.payload[:remote_ip], - params: event.payload[:params] - } - end - # Only use :id for inspections in production. config.active_record.attributes_for_inspect = [ :id ] + + # 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 diff --git a/personal/config/environments/test.rb b/personal/config/environments/test.rb index 0c616a1..c2095b1 100644 --- a/personal/config/environments/test.rb +++ b/personal/config/environments/test.rb @@ -1,5 +1,3 @@ -require "active_support/core_ext/integer/time" - # 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 @@ -17,12 +15,11 @@ # loading is working properly before deploying your code. config.eager_load = ENV["CI"].present? - # Configure public file server for tests with Cache-Control for performance. - config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" } + # Configure public file server for tests with cache-control for performance. + config.public_file_server.headers = { "cache-control" => "public, max-age=3600" } - # Show full error reports and disable caching. + # Show full error reports. config.consider_all_requests_local = true - config.action_controller.perform_caching = false config.cache_store = :null_store # Render exception templates for rescuable exceptions and raise for other exceptions. @@ -34,28 +31,17 @@ # Store uploaded files on the local file system in a temporary directory. config.active_storage.service = :test - # Disable caching for Action Mailer templates even if Action Controller - # caching is enabled. - config.action_mailer.perform_caching = false - # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - # Unlike controllers, the mailer instance doesn't have any context about the - # incoming request so you'll need to provide the :host parameter yourself. - config.action_mailer.default_url_options = { host: "www.example.com" } + # Set host to be used by links generated in mailer templates. + config.action_mailer.default_url_options = { host: "example.com" } # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - # 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 = [] - # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true diff --git a/personal/config/initializers/assets.rb b/personal/config/initializers/assets.rb index bd5bcd2..4873244 100644 --- a/personal/config/initializers/assets.rb +++ b/personal/config/initializers/assets.rb @@ -5,8 +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 ] diff --git a/personal/config/initializers/filter_parameter_logging.rb b/personal/config/initializers/filter_parameter_logging.rb index c010b83..c0b717f 100644 --- a/personal/config/initializers/filter_parameter_logging.rb +++ b/personal/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/personal/config/puma.rb b/personal/config/puma.rb index daaf036..a248513 100644 --- a/personal/config/puma.rb +++ b/personal/config/puma.rb @@ -1,43 +1,41 @@ -# 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. +# 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. # -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 `worker_timeout` threshold that Puma will use to wait before -# terminating a worker in development environments. +# Puma starts a configurable number of processes (workers) and each process +# serves each request in a thread from an internal thread pool. # -worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" - -# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +# 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. # -port ENV.fetch("PORT") { 3000 } - -# Specifies the `environment` that Puma will run in. +# 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 +# prioritize throughput over latency. # -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 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). +# 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. # -# workers ENV.fetch("WEB_CONCURRENCY") { 2 } - -# 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. +# The default is set to 3 threads as it's deemed a decent compromise between +# throughput and latency for the average Rails application. # -# preload_app! +# 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 `port` that Puma will listen on to receive requests; default is 3000. +port ENV.fetch("PORT", 3000) # 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/personal/db/cable_schema.rb b/personal/db/cable_schema.rb index b70db2c..bb21f97 100644 --- a/personal/db/cable_schema.rb +++ b/personal/db/cable_schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_12_01_204654) do +ActiveRecord::Schema[8.0].define(version: 2024_12_01_204654) do create_table "solid_cable_messages", force: :cascade do |t| t.binary "channel", limit: 1024, null: false t.binary "payload", limit: 536870912, null: false diff --git a/personal/db/cache_schema.rb b/personal/db/cache_schema.rb index 7b5d919..2b5b203 100644 --- a/personal/db/cache_schema.rb +++ b/personal/db/cache_schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_11_24_234620) do +ActiveRecord::Schema[8.0].define(version: 2024_11_24_234620) do create_table "solid_cache_entries", force: :cascade do |t| t.binary "key", limit: 1024, null: false t.binary "value", limit: 536870912, null: false diff --git a/personal/db/ro_schema.rb b/personal/db/ro_schema.rb index f9d48d6..f3aca2b 100644 --- a/personal/db/ro_schema.rb +++ b/personal/db/ro_schema.rb @@ -10,10 +10,10 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2023_12_31_065908) do +ActiveRecord::Schema[8.0].define(version: 2023_12_31_065908) do # These are extensions that must be enabled in order to support this database + enable_extension "pg_catalog.plpgsql" enable_extension "pg_stat_statements" - enable_extension "plpgsql" create_table "active_storage_attachments", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name", null: false diff --git a/personal/db/ryan_romanchuk_schema.rb b/personal/db/ryan_romanchuk_schema.rb index 8f7b6c9..f01701e 100644 --- a/personal/db/ryan_romanchuk_schema.rb +++ b/personal/db/ryan_romanchuk_schema.rb @@ -10,10 +10,10 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_04_10_055524) do +ActiveRecord::Schema[8.0].define(version: 2024_04_10_055524) do # These are extensions that must be enabled in order to support this database + enable_extension "pg_catalog.plpgsql" enable_extension "pg_stat_statements" - enable_extension "plpgsql" create_table "active_storage_attachments", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name", null: false diff --git a/personal/db/schema.rb b/personal/db/schema.rb index 9f2c553..adec871 100644 --- a/personal/db/schema.rb +++ b/personal/db/schema.rb @@ -10,10 +10,10 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_12_01_014215) do +ActiveRecord::Schema[8.0].define(version: 2024_12_01_014215) do # These are extensions that must be enabled in order to support this database + enable_extension "pg_catalog.plpgsql" enable_extension "pg_stat_statements" - enable_extension "plpgsql" create_table "active_storage_attachments", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name", null: false diff --git a/personal/db/wx_schema.rb b/personal/db/wx_schema.rb index e2c49ef..d9ae7f8 100644 --- a/personal/db/wx_schema.rb +++ b/personal/db/wx_schema.rb @@ -10,10 +10,10 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_04_10_023029) do +ActiveRecord::Schema[8.0].define(version: 2024_04_10_023029) do # These are extensions that must be enabled in order to support this database + enable_extension "pg_catalog.plpgsql" enable_extension "pg_stat_statements" - enable_extension "plpgsql" enable_extension "postgis" create_table "spatial_ref_sys", primary_key: "srid", id: :integer, default: nil, force: :cascade do |t| diff --git a/personal/public/406-unsupported-browser.html b/personal/public/406-unsupported-browser.html index 7cf1e16..9532a9c 100644 --- a/personal/public/406-unsupported-browser.html +++ b/personal/public/406-unsupported-browser.html @@ -1,66 +1,114 @@ - - - - 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/personal/public/422.html b/personal/public/422.html index c08eac0..8bcf060 100644 --- a/personal/public/422.html +++ b/personal/public/422.html @@ -1,67 +1,114 @@ - - - - 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.

+
+
+ + +