編集:さて、18時間かかりましたが、DISCOURSE_CDN_URL を定義すると、少なくともこのサイトがリストア後に再構築や機能しなくなるようです。次にテストするのは、DISCOURSE_CDN_URL を設定せずにビルドし、その後その環境変数を設定してコンテナを起動することでしょう。
私が以前知っていたこと
昨日もこの問題が発生しましたが、解消したかと思っていました。しかし、実は1ヶ月前のデータベースをリストアしていたことが判明しました。最新のデータベースをリストアするとサイトがダウンしてしまいます。
サイトはゼロからビルドできたので、コードや標準プラグインに問題はありません。ただし、データベースをリストアするとサイトがダウンし、データベースを削除しても再構築できません。つまり、問題の原因は JavaScript を圧縮する際に読み込まれるファイルの中にあると思われます。
onebox.scss 内の background: image-url をすべて削除しようと試みました。これによりサイトは再構築できるようになりましたが、表示が崩れてしまいました。つまり、これらのエラーは原因ではなく症状に過ぎません。
データベース(およびファイル)をリストアした後、または再構築時に、Rails ログに以下のようなエラーが表示されます。
I, [2019-12-22T21:21:25.532604 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
NOTE: Inheriting Faraday::Error::ClientError is deprecated; use Faraday::ClientError instead. It will be removed in or after version 1.0
Faraday::Error::ClientError.inherited called from /var/www/discourse/plugins/discourse-github/gems/2.6.5/gems/octokit-4.14.0/lib/octokit/middleware/follow_redirects.rb:14.
> Seeding dark and light themes
[SassC::FunctionsHandler] undefined method `protocol' for nil:NilClass
rake aborted!
Discourse::ScssError: Error: error in C function image-url: undefined method `protocol' for nil:NilClass
on line 90 of app/assets/stylesheets/common/base/onebox.scss, in function `image-url`
from line 90 of app/assets/stylesheets/common/base/onebox.scss, in mixin `onebox-favicon`
from line 110 of app/assets/stylesheets/common/base/onebox.scss
from line 34 of app/assets/stylesheets/common.scss
from line 1 of desktop.scss
>>> background: image-url("favicons/#{$image}.png") no-repeat 0% 50%;
----------------^
/var/www/discourse/lib/stylesheet/manager.rb:183:in `rescue in compile'
/var/www/discourse/lib/stylesheet/manager.rb:171:in `compile'
/var/www/discourse/lib/stylesheet/manager.rb:80:in `block (2 levels) in stylesheet_details'
/var/www/discourse/lib/stylesheet/manager.rb:66:in `each'
/var/www/discourse/lib/stylesheet/manager.rb:66:in `block in stylesheet_details'
/var/www/discourse/lib/stylesheet/manager.rb:64:in `synchronize'
/var/www/discourse/lib/stylesheet/manager.rb:64:in `stylesheet_details'
/var/www/discourse/lib/stylesheet/manager.rb:34:in `stylesheet_data'
/var/www/discourse/app/models/theme.rb:280:in `block in refresh_message_for_targets'
/var/www/discourse/app/models/theme.rb:279:in `map'
/var/www/discourse/app/models/theme.rb:279:in `refresh_message_for_targets'
/var/www/discourse/app/models/theme.rb:267:in `notify_theme_change'
/var/www/discourse/app/models/theme.rb:275:in `notify_theme_change'
/var/www/discourse/app/models/theme.rb:61:in `block in <class:Theme>'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:429:in `instance_exec'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:429:in `block in make_lambda'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:239:in `block in halting_and_conditional'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.r