From ee68da7eebc8d01a9510328a0f64abca692f1552 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Thu, 21 Jul 2022 03:33:08 +0200 Subject: [PATCH 1/2] Don't eager load active storage in production We don't use active storage, but eager loading it tries to read the config/storage.yml, which doesn't exist, because we don't need it. https://github.com/rails/rails/blob/571b4d5fb9cd254db79e93370d7b208b6d0fd1e4/activestorage/lib/active_storage/engine.rb#L137 https://github.com/rails/rails/blob/571b4d5fb9cd254db79e93370d7b208b6d0fd1e4/activestorage/app/models/active_storage/blob.rb#L354 closes #8371 --- config/environments/production.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/environments/production.rb b/config/environments/production.rb index f3f927a8f..ff5ec75b7 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -15,6 +15,11 @@ Rails.application.configure do config.eager_load = true config.eager_load_paths += %W[#{config.root}/lib] + # diaspora* does not use ActiveStroage. But eager loading then loads active_storage/blob.rb, + # which then fails if there isn't a config/storage.yml + # This can be removed if we ever want to use ActiveStorage and a storage.yml exists + config.eager_load_namespaces.delete(ActiveStorage::Engine) + # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true From 3cf84c838f58316a574b8ab69ba81a2d214c8fb2 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Thu, 21 Jul 2022 03:43:45 +0200 Subject: [PATCH 2/2] Disable export_concurrent to prevent segfault during precompile See https://github.com/sass/sassc-ruby/issues/207 closes #8372 --- config/initializers/assets.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 81c84e115..5cae6d59f 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -31,3 +31,9 @@ Rails.application.config.assets.version = "1.0" # Rails.application.config.assets.precompile += %w( admin.js admin.css ) Rails.application.config.public_file_server.enabled = AppConfig.environment.assets.serve? + +# assets:precompile can sometimes fail with a Segmentation fault. +# Disabling export_concurrent is a workaround. See: https://github.com/sass/sassc-ruby/issues/207 +Rails.application.config.assets.configure do |env| + env.export_concurrent = false +end