今天在运行 ./launcher rebuild app 命令时(原因不明),我遇到了这个错误(另外,这是在我禁用了 app.yml 文件中的所有插件之后……)。非常感谢任何帮助!
error-log_2024-10-31_1.txt (44.1 KB)
以……结尾:
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 2096 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "tag"=>"migrate", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP **
1 个赞
david
(David Taylor)
2024 年10 月 31 日 17:13
2
日志的相关部分是
undefined method `+' for nil
/var/www/discourse/db/migrate/20241025045928_add_invites_link_to_sidebar.rb:44:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4.2/lib/active_record/migration.rb:989:in `public_send'
所以这似乎与 FEATURE: Add invite link to the sidebar (#29448) · discourse/discourse@19672fa · GitHub (cc @osama ) 有关
4 个赞
非常感谢(也感谢您的解释),我也看到了,并且想知道是不是这个原因!
1 个赞
Osama
2024 年10 月 31 日 18:02
4
@denvergeeks 我将修复迁移,但我有点好奇您的网站是如何变成这样的。您的网站侧边栏看起来是什么样的?您是否已从数据库中删除了默认侧边栏中的所有链接?
当然——我没有侧边栏或网站的截图,但除了在“更多…”中添加一些基本菜单项外,没有任何修改。
这只是我(非公开的)个人研究 Discourse 实例之一,如果你告诉我你想在命令行中做什么,我可以帮助调试。(如果对你有帮助,我有一个自己的专用服务器。)
1 个赞
Osama
2024 年10 月 31 日 18:37
6
您能告诉我以下查询在您的数据库中输出什么吗?
SELECT id FROM sidebar_sections WHERE section_type = 0;
SELECT linkable_type, linkable_id, position FROM sidebar_section_links WHERE sidebar_section_id IN (SELECT id FROM sidebar_sections WHERE section_type = 0);
SELECT id, segment FROM sidebar_urls WHERE id IN (SELECT linkable_id FROM sidebar_section_links WHERE sidebar_section_id IN (SELECT id FROM sidebar_sections WHERE section_type = 0));
当然可以 - 请提供从开始/提示符开始的命令?(我是 root 用户)
1 个赞
Osama
2024 年10 月 31 日 18:54
8
我无法立刻说出确切的命令,但在 Meta 中查看了一下,我认为这些命令会起作用:
./launcher enter app
su postgres
psql
在 psql 命令之后,您应该能够粘贴查询并运行它们以查看结果。如果命令不起作用,请告诉我。
root@JEN /var/discourse # ./launcher enter app101
su postgres
psql
x86_64 arch detected.
Error response from daemon: container 8ee36bdfa85b786ea149e6714f65048e136091fe31be2f5425be5fe04a852729 is not running
su: user postgres does not exist or the user entry does not contain all the required fields
Command 'psql' not found, but can be installed with:
apt install postgresql-client-common
Osama
2024 年10 月 31 日 19:08
10
看起来您的容器未在运行。您的网站目前是否已关闭?请尝试:
./launcher start app101
root@JEN /var/discourse # ./launcher start app101
检测到 x86_64 架构。
正在启动现有容器
+ /usr/bin/docker start app101
app101
root@JEN /var/discourse # ./launcher enter app101
su postgres
psql
检测到 x86_64 架构。
root@JEN-app101:/var/www/discourse# SELECT id FROM sidebar_sections WHERE section_type = 0;
bash: SELECT: command not found
root@JEN-app101:/var/www/discourse#
Osama
2024 年10 月 31 日 19:18
13
好的,现在明白了。迁移至少需要一个 ... more 之外的链接,但你一个都没有,所以它会失败。我将更新迁移以处理这种情况。
2 个赞
我在我的其他网站上也遇到了同样的错误(并停止了容器)。(但有些其他网站没有。)
**编辑:**是的,所以那个我发现有相同行为的其他网站也没有链接在 ... more 之外。
Osama
2024 年10 月 31 日 22:28
16
抱歉 @denvergeeks ,家里有急事,我不得不离开几小时。我已经准备好了一个修复 PR:
main ← fix/invite-sidebar-link-migration
opened 10:27PM - 31 Oct 24 UTC
Meta topic: https://meta.discourse.org/t/stumped-about-launcher-rebuild-app-erro… r-process-pid-2096/333876?u=osama.
Follow up to https://github.com/discourse/discourse/pull/29448.
The migration that adds the invite link to the sidebar determines the position of the link by looking up the max position that a primary link has and inserts the invite link at the max position plus 1. This approach works fine for most sites, however, sites that have deleted all primary links from the sidebar will fail because the max position will be `nil` which blows up the migration.
This PR addresses this edge case by falling back to looking up the min position of secondary links, or to zero if there're also no secondary links, and then inserts the invite link at the min position minus 1.
合并并通过测试后我会通知你。
3 个赞
Osama
2024 年11 月 1 日 07:50
17
@denvergeeks ,修复已推送到 tests-passed 分支。如果您现在重新构建,应该会成功。
3 个赞
system
(system)
关闭
2024 年12 月 1 日 07:50
18
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.