重建因 yarn 错误而失败

在 Ubuntu 22.04 上使用 ./launcher rebuild app 升级我的实例时,我遇到了一个错误。据我所知,问题是从这里开始的:

error /var/www/discourse/app/assets/javascripts/node_modules/discourse: Command failed.
Exit code: 1
Command: yarn --silent --cwd .. patch-package
Arguments: 
Directory: /var/www/discourse/app/assets/javascripts/node_modules/discourse
Output:
error Command "patch-package" not found.
error Command failed with exit code 1.

在此之前有几个“_ has unmet peer dependency”警告,但这是第一个错误(除了设置数据库时出现的“_ already exists”,但我认为这是预期行为)。

不幸的是,出现此问题的升级恰好在我休家庭公路旅行的前一天,所以我当时有点匆忙,没有时间进行故障排除。但我现在一直遇到这个问题。主机已完全更新,我不记得对设置做过任何特别独特的操作。大约 3 个月前,我将 /var/discourse 放在了一个单独的 Digital Ocean 卷上(我知道这对于性能来说不是推荐的做法™,但对于拥有数千用户的论坛,我认为这是值得的权衡),但在此更改之后,据我所知,它运行正常。

1 个赞

我认为那些都只是警告。

如果网站没有恢复,您可以尝试

./launcher start app

我运行了 ./launcher start app,现在出现 HTTP 502 错误。从 ./launcher logs app 中,我看到:

[Wed 19 Jul 2023 10:18:34 PM UTC] Run reload cmd: sv reload nginx
fail: nginx: runsv not running
[Wed 19 Jul 2023 10:18:34 PM UTC] Reload error for :
Started runsvdir, PID is 530
ok: run: redis: (pid 542) 0s
ok: run: postgres: (pid 543) 0s
supervisor pid: 538 unicorn pid: 569
Could not find rtlcss-0.2.1, mini_racer-0.8.0, puma-6.3.0, msgpack-1.7.1, libv8-node-18.16.0.0-x86_64-linux in locally installed gems
Run `bundle install` to install missing gems.
config/unicorn_launcher: line 71: kill: (569) - No such process
config/unicorn_launcher: line 15: kill: (569) - No such process
(538) exiting

这会重复很多次。

也许运行 bundle install

为此,我必须进入容器。我这样做了,之后启动容器时,Web 界面显示

糟糕
为该讨论论坛提供支持的软件遇到了意外问题。很抱歉给您带来不便。

有关错误的详细信息已记录,并生成了自动通知。我们会对其进行检查。

无需进一步操作。但是,如果错误状况持续存在,您可以通过在站点的反馈类别中发布讨论主题来提供更多详细信息,包括重现错误的步骤。

./launcher logs app 显示

[Wed 19 Jul 2023 11:52:05 PM UTC] 域名未更改。
[Wed 19 Jul 2023 11:52:05 PM UTC] 跳过,下次续订时间为:2023-08-21T00:34:21Z
[Wed 19 Jul 2023 11:52:05 PM UTC] 添加 '--force' 以强制续订。
[Wed 19 Jul 2023 11:52:05 PM UTC] 安装密钥到:/shared/ssl/distroleaders.club_ecc.key
[Wed 19 Jul 2023 11:52:05 PM UTC] 安装完整链到:/shared/ssl/distroleaders.club_ecc.cer
[Wed 19 Jul 2023 11:52:05 PM UTC] 运行重新加载命令:sv reload nginx
失败:nginx:runsv 未运行
[Wed 19 Jul 2023 11:52:05 PM UTC] 重新加载错误:
启动了 runsvdir,PID 为 530
ok:run:redis:(pid 544) 0s
ok:run:postgres:(pid 543) 0s
supervisor pid:538 unicorn pid:575

如果我再次进入容器,我可以成功运行 sv reload nginx,但这并不能改变行为。

另外,如果我重新运行 ./launcher rebuild app,那么我必须再次进入容器来运行 bundle install

那里还有另一个错误。请包含整个日志。

您是否有任何非标准插件?

我不记得有(除非 @mattdm 在我没注意的时候偷偷添加了一些 :smile:)。discourse-doctor 也显示“未检测到非官方插件”。

1 个赞

我指的是从重建中获取的完整日志。

抱歉。这是重建的输出。这是您想要的吗?

第二行说明了全部情况

fatal: not a git repository (or any parent up to mount point /var)

您的 /var/discourse 目录不是一个 git 仓库,这会破坏我们 launcher 的自动更新以及我们用于引导 Discourse 的工具,进而导致您被困在旧的 docker 镜像中。

您需要撤销导致此问题的更改。

3 个赞

当您将文件复制到卷时,您未能复制 .git,因此您需要克隆它并将其他东西复制进去。

您可能应该让您的卷只包含上传文件,我假设这是占用大部分空间的内容,然后您可以让卷只包含上传文件和备份。

1 个赞

我的天哪。我敢打赌我能猜到我具体做了什么,这涉及到 * 在 rsync 命令中不匹配 .git 的事实。这也不是我第一次因为使用 rsync 而让事情变得更复杂。感谢您发现这个问题!

有没有技术原因导致重建不能在那时退出?这会让故障排除更容易(尽管从顶部而不是底部开始也会更容易)。

2 个赞

Thankfully, I still have the pre-migration tarball because I haven’t lost all of my sysadmin skills over the years. :smile:

This is on the smallest Digital Ocean droplet, so it’s mostly the system that is taking up space. Uploads and backups together are ~100MB. I think what I’ll probably end up doing, if I make a change, is to move to a larger droplet that has more disk space.

Thanks for the help, I really appreciate it!

2 个赞

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