Most plugins carry all the code they need and have a simple install. Those two you tried to use need to fetch gems (libraries) from the internet to able to function.
do you know where in the code those ruby gem fetches for plugins happen? I tried looking for it but haven’t found the right place yet.
I’m thinking maybe instead of using cached gems maybe it would be more elegant to run a rubygems mirror on the isolated host, i found a tutorial here and it looks like you can configure extra system-wide gem sources
当社の内部 Discourse は、長い間同じバージョンで順調に稼働していましたが、ついに IE9 のサポートを終了することになったため、アップグレードは遅れすぎていると言えます。
このガイドは、Discourse の最新バージョンでもまだ有効であることをお伝えできます。RHEL 7 ではなく RHEL 8 を使っている場合でも問題ありません ![]()
実験の中で、追加の依存関係がある場合でも、discourse-prometheus および discourse-calendar プラグインをオフライン環境でも動作させる方法を発見しました。そのコツは、ビルドサーバーのプラグインディレクトリから Ruby Gems を取得し、さらに /var/www/discourse/vendor/bundle/ruby 内の Gems も取得することでした。
docker run -it -v ~/local/rubygems.org:/local-rubygems local_discourse/app /bin/bash -c "cp -rv /var/www/discourse/vendor/bundle/ruby /local-rubygems"
docker run -it -v ~/local/rubygems.org/plugin-gems/discourse-calendar:/local-rubygems local_discourse/app /bin/bash -c "cp -rv /var/www/discourse/plugins/discourse-calendar/gems /local-rubygems"
docker run -it -v ~/local/rubygems.org/plugin-gems/discourse-prometheus:/local-rubygems local_discourse/app /bin/bash -c "cp -rv /var/www/discourse/plugins/discourse-prometheus/gems /local-rubygems"
その後、/templates/web.template.yml 内で以下のように設定します:
- exec:
cd: $home
hook: bundle_exec
cmd:
# ローカル Ruby キャッシュをコピー
- cp -rv /local-rubygems.org/ruby/* $home/vendor/bundle/ruby/
- cp -rv /local-rubygems.org/plugin-gems/* $home/plugins/
- su discourse -c 'bundle install --local --deployment --retry 3 --jobs 4 --verbose --without test development'
余談ですが、Active Directory IIS SSO に関するトピックがどこかで失われたようですが、コードは GitHub - laktak/discourse-sso: Single Sign On for Discourse with Active Directory · GitHub でまだ利用可能であり、現在 DiscourseConnect SSO に改名されたものとも正常に動作します。
アップグレードを試したところ、web.template.yml に新しい yarn install セクションが追加され、それが分離された環境内で問題を引き起こしているようです。
- exec:
cd: $home
cmd:
- "[ ! -d 'node_modules' ] || su discourse -c 'yarn install --production && yarn cache list'"
古いコンテナと新しいコンテナの内容を比較すると、新しいコンテナの /usr/local/share/.cache/yarn/v6 には多くのキャッシュされた yarn パッケージがありますが、古いコンテナには何もありません。おそらく、必要な node.js は以前はベースイメージに含まれていましたが、現在は再構築中に更新されているのではないでしょうか?
yarn キャッシュを ruby キャッシュと同じ方法でコピーアウトして、yarn がビルドボックスからキャッシュされたパッケージを使用できるようにするかどうか実験してみます。