./launcher rebuild app fails hard 'bundle exec rake db:migrate' github/master リポジトリからのauth/oath2_authenticator削除による問題の可能性

皆さん、助けを求めています…

長年稼働しているUbuntu 20.x ec2上のDiscourseの根本原因を突き止めようと試行錯誤してきました。これらはすべてAWS上で稼働しており、約3年間問題なく動作していました。しかし、突然、どれも再構築できなくなりました。app.ymlを非常にシンプルな状態まで絞り込みましたが、延々と検索しても解決策が見つかりません。現在の私の環境は、Postgres 13、Discourse 2.9.0 Beta 4(常に最新の状態に保っています)で、非常に標準的なコンテナ/Dockerベースのインストールを使用しており、特別な設定(他のソフトウェアの別コンテナやスタンドアロンインストールなど)は行っていません。これは多くの推測の1つに過ぎませんが、最近Discourseのコードベースでauth/oauth2_authenticatorが「ManagedAuthenticator and UserAssociatedAccount」にリネーム/削除されたことに気づきました。

以下で確認できます:DEV: Deprecate OAuth2Authenticator and OAuth2UserInfo (#15427) · discourse/discourse@78d0ec3 · GitHub
リポジトリでのこのコミットに関するコメント:
DEV: OAuth2AuthenticatorとOAuth2UserInfoを非推奨にする (#15427)

これらはManagedAuthenticatorとUserAssociatedAccountに置き換えられました。詳細については、Adding a new 'managed' authentication method to Discourse を参照してください。

以下は、失敗直前のログです(はい、discourse-doctorも実行しましたが、ほぼ同じ結果でした… NGINXも実行していません。これが一般的な問題であることはよく目にしますが)。

I, [2022-05-17T21:26:52.663629 #1]  INFO -- : > cd /var/www/discourse & su discourse -c 'LOAD_PLUGINS=0 bundle exec rake plugin:pull_compatible_all'
I, [2022-05-17T21:26:54.697333 #1]  INFO -- : discourse-chat-integration is already at latest compatible version
discourse-rss-polling is already at latest compatible version
discourse-assign is already at latest compatible version
discourse-azure-ad is already at latest compatible version
discourse-solved is already at latest compatible version
discourse-knowledge-explorer is already at latest compatible version
docker_manager is already at latest compatible version

I, [2022-05-17T21:26:54.697677 #1]  INFO -- : > cd /var/www/discourse & su discourse -c 'bundle exec rake db:migrate'
rake aborted!
LoadError: cannot load such file -- auth/oauth2_authenticator
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/dependencies/require_dependency.rb:21:in `require_dependency'
/var/www/discourse/lib/require_dependency_backward_compatibility.rb:18:in `require_dependency'
/var/www/discourse/plugins/discourse-azure-ad/plugin.rb:7:in `activate!'
/var/www/discourse/lib/plugin/instance.rb:679:in `instance_eval'
/var/www/discourse/lib/plugin/instance.rb:679:in `activate!'
/var/www/discourse/lib/discourse.rb:279:in `block in activate_plugins!'
/var/www/discourse/lib/discourse.rb:276:in `each'
/var/www/discourse/lib/discourse.rb:276:in `activate_plugins!'
/var/www/discourse/config/application.rb:222:in `block in <class:Application>'
/var/www/discourse/lib/plugin.rb:6:in `initialization_guard'
/var/www/discourse/config/application.rb:221:in `<class:Application>'
/var/www/discourse/config/application.rb:81:in `<module:Discourse>'
/var/www/discourse/config/application.rb:80:in `<top (required)>'
/var/www/discourse/Rakefile:7:in `require'
/var/www/discourse/Rakefile:7:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
(See full trace by running task with --trace)
I, [2022-05-17T21:26:55.807801 #1]  INFO -- :
I, [2022-05-17T21:26:55.808466 #1]  INFO -- : Terminating async processes
I, [2022-05-17T21:26:55.808709 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 44
I, [2022-05-17T21:26:55.808935 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 105
2022-05-17 21:26:55.808 UTC [44] LOG:  received fast shutdown request
105:signal-handler (1652822815) Received SIGTERM scheduling shutdown...
2022-05-17 21:26:55.810 UTC [44] LOG:  aborting any active transactions
2022-05-17 21:26:55.815 UTC [44] LOG:  background worker "logical replication launcher" (PID 53) exited with exit code 1
2022-05-17 21:26:55.816 UTC [48] LOG:  shutting down
2022-05-17 21:26:55.851 UTC [44] LOG:  database system is shut down
105:M 17 May 2022 21:26:55.894 # User requested shutdown...
105:M 17 May 2022 21:26:55.894 * Saving the final RDB snapshot before exiting.
105:M 17 May 2022 21:26:55.940 * DB saved on disk
105:M 17 May 2022 21:26:55.941 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse & su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 654 exit 1>
Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
c961e72970eba95a26f294e0f123987c40da1c350a4b1fe9621edf0bd665720c
「いいね!」 1

しかし、2年間更新されていないように見えますか?(または、間違ったものを参照したかもしれませんか?)したがって、これがあなたの問題である可能性が高いです。他に解決策があるのではないかと疑っています。

「いいね!」 1

はい、azure-ad プラグインはメンテナンスされておらず、GitHub でアーカイブされました。最善の代替案はおそらく次のとおりです。

(Azure AD の手順は、その投稿の最後にあります)

「いいね!」 4

これは非常に役立ちますが、同時に非常に残念でもあります。なぜなら、これはすでに多くのユーザーに使用され、展開されているからです。このプラグインは使いやすく、サードパーティ製ではないため、将来的に少なくとも半ばサポートされるソリューションになると確信していました。新しいファイルを追加するのではなく、リポジトリから auth/oauth2_authenticator を削除/改名しただけであれば、この問題は発生しなかったでしょう。

もちろん、OpenID Connect Authentication Plugin の使用を検討しますが、実装には多大な作業が必要です。

「いいね!」 1

公式コードであっても廃止される可能性があり、これはDiscourseに関する問題というよりも、むしろリリースプロセスに関する問題のように思われます。

「非常に多くのユーザー」がいる場合は、サイトのステージングコピーを通じてすべてのアップデートを実行することを検討すべきです。プロセスを最初に証明せずに、本番サーバーを盲目的にアップグレードするのは非常に危険です。

ありがとうございます。本番サーバーをいきなりアップグレードするつもりはありませんでした。:wink: まずは徹底的にテストする環境がたくさんあります。

それよりも、テスト後の変更点を伝え、新しいセットアップの違いを非常に綿密に調べることの方が重要です。

「いいね!」 1

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.