./launcher rebuild app 失败 'bundle exec rake db:migrate' 可能是因为 github/master 仓库移除了 auth/oath2_authenticator

大家好,这是求助信息……

我试图深入挖掘并找出我在 Discourse 的 Ubuntu 20.x ec2 上长期运行的问题根源。这些实例都在 AWS 上运行,并且已经完美运行了近 3 年。突然之间,它们都无法重建了。我已经将我的 app.yml 简化到最基本的状态……我搜索了无数次……我目前的安装是 Postgres 13,Discourse 2.9.0 Beta 4(我一直保持最新版本),并且我运行的是非常标准的容器/docker 安装,没有任何花哨的东西(没有单独的容器,也没有安装其他任何软件)。这只是我众多猜测中的一个,但我注意到 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 已是最新兼容版本
discourse-rss-polling 已是最新兼容版本
discourse-assign 已是最新兼容版本
discourse-azure-ad 已是最新兼容版本
discourse-solved 已是最新兼容版本
discourse-knowledge-explorer 已是最新兼容版本
docker_manager 已是最新兼容版本

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>'
(通过运行任务并带 --trace 来查看完整跟踪)
I, [2022-05-17T21:26:55.807801 #1]  INFO -- :
I, [2022-05-17T21:26:55.808466 #1]  INFO -- : 终止异步进程
I, [2022-05-17T21:26:55.808709 #1]  INFO -- : 发送 INT 到 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 -- : 发送 TERM 到 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:  收到快速关机请求
105:signal-handler (1652822815) 收到 SIGTERM,调度关机...
2022-05-17 21:26:55.810 UTC [44] LOG:  中止任何活动事务
2022-05-17 21:26:55.815 UTC [44] LOG:  后台工作进程“逻辑复制启动器”(PID 53)已退出,退出代码为 1
2022-05-17 21:26:55.816 UTC [48] LOG:  正在关闭
2022-05-17 21:26:55.851 UTC [44] LOG:  数据库系统已关闭
105:M 17 May 2022 21:26:55.894 # 用户请求关机...
105:M 17 May 2022 21:26:55.894 * 在退出前保存最终 RDB 快照。
105:M 17 May 2022 21:26:55.940 * DB 已保存到磁盘
105:M 17 May 2022 21:26:55.941 # Redis 现在已准备好退出,再见...


失败
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 654 exit 1>
失败位置:/usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec 失败,参数为 {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
引导失败,退出代码为 1
** 引导失败 ** 请向上滚动并查找更早的错误消息,可能不止一个。
./discourse-doctor 可能有助于诊断问题。
c961e72970eba95a26f294e0f123987c40da1c350a4b1fe9621edf0bd665720c
1 个赞

但是它看起来已经两年没有更新了?(或者我可能看错了?)所以这很可能是你的问题。我怀疑现在有其他解决方案了。

1 个赞

Right,azure-ad 插件不再维护,并且已在 GitHub 上归档。最佳替代方案可能是

(Azure AD 说明在该帖子的底部)

4 个赞

这非常有帮助,非常感谢您,但同时也非常令人失望,因为这已经被许多用户使用和推广了。这个插件使用简单,而且由于它不是第三方插件,我本来觉得它至少在未来会得到一定的支持。看起来,如果他们当初没有直接从仓库中移除/重命名 auth/oauth2_authenticator,而是仅仅添加一两个新文件然后继续下去,我就不会遇到这个问题了。

当然,我会研究使用 OpenID Connect Authentication Plugin,但这将是一项巨大的实施工作。

1 个赞

即使是官方代码也可能被弃用,这听起来更像是你的发布流程问题,而不是与 Discourse 有关的问题。

如果你有“大量用户”,你应该考虑在你的站点的暂存副本中运行所有更新。在未先证明流程的情况下盲目升级生产服务器是极其危险的。

谢谢,我不会盲目升级我的生产服务器;)。我有相当多的环境需要先进行彻底测试。

这更多的是关于在测试后沟通变更,并非常仔细地查找新设置中的差异。

1 个赞

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