Discourse论坛更新时出现问题


大家好!
我尝试使用管理员面板中发布的链接更新 Discourse 论坛,但遇到了这个错误。整个论坛都消失了。我现在该如何重置更新?如果有人能帮我,我将不胜感激。:sob:

1 个赞

事实上,这意味着您的论坛正在更新。——除非您在更新完成前中断它。

尝试访问您的论坛 https://yoursite.com/latest.json。如果它返回了某些内容,请等待 10 分钟,看看问题是否会自行解决。

1 个赞

感谢您的回复,我尝试了您提供的方法,但返回了 502 Bad Gateway nginx。

您可能需要运行 ./launcher rebuild app

我尝试运行 ./launcher rebuild app 时收到了以下错误消息:

FAILED

--------------------

Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle install --deployment --retry 3 --jobs 4 --verbose --without test development' failed with return #<Process::Status: pid 340 exit 5>

Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'

exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --retry 3 --jobs 4 --verbose --without test development'"]}

6e9e60bd6b6113cdcb001127fd2a24fe86f2a1658bf24500e5e2b720fd793510

** 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.

我向上滚动并找到了一些可能的错误日志:

1)200:M 25 Jun 2023 16:00:16.252 # Failed listening on port 6379 (TCP), aborting.

2)[DEPRECATED] The `--deployment` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local deployment 'true'`, and stop using this flag
[DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local without 'test development'`, and stop using this flag

3)Bundler::PathError: The path `/var/www/discourse/vendor/bundle/ruby/2.7.0/bundler/gems/sprockets-f4d3dae71ef2` does not exist.

4)Bundler::InstallError: sass-embedded-1.63.6-x86_64-linux requires rubygems version >= 3.3.22, which is incompatible with the current version, 3.2.18

最近是否有人遇到了类似问题,如果这有帮助的话?

非常感谢您的回复,但我想这不是同一个问题,我的服务器在德国。我使用的是 discourse docker 镜像作为我的服务器。如果 ./launcher rebuild app 不起作用,我该怎么办?

1 个赞

看起来与因 Ruby GEMS 不兼容导致重建失败相似

1 个赞

感谢您的帮助!是的,看起来很相似,我尝试了:

my server:/var/discourse**$ git pull

fatal: Not a git repository: ../.git/modules/discourse_docker

在运行 git pull 之前,我应该做什么吗?我之前是在我服务器的 /var/discourse 中操作的。

您似乎有一个不寻常的设置——这是标准安装吗?

1 个赞

我读了上一位程序员为我写的文档,其中提到由于许多 Web 服务都在 Nginx 后面运行,Discourse 也需要托管在 Nginx 后面。标准安装不适用于我的情况。

以下是他在文档中的说法以及他的做法:

Discourse 在 Docker 容器中运行。但是,它需要一种特殊的配置方式,而不是通过 docker-compose.yml 或 .conf 文件。

可以在 此处 找到 discourse-project/ GitHub 存储库,用于 配置和构建 Docker 镜像。忽略他们提供的那个漂亮又诱人的“discourse-setup”程序,它在这里不起作用。我们需要自己配置应用程序。

  1. 将 discourse_docker 克隆到 /var/discourse:git clone https://github.com/discourse/discourse_docker.git /var/discourse
  2. 进入该文件夹并使用提供的示例配置文件:cd /var/discourse && cp samples/standalone.yml containers/app.yml
  3. 然后编辑 containers/app.yml 文件(例如使用 sudo nano
    • 对托管部分、邮件的 SMTP 设置以及 - 重要 - 暴露部分进行了更改,以便只向外部公开一个未使用的端口
    • 要在“/forum”之类的路径上运行 Discourse,还需要进行一些其他更改,如 此处 所述
    • 电子邮件身份验证也出现了一些问题:
      • 发送电子邮件的邮件在此处为“服务器的电子邮件”。但是,Discourse 希望邮件具有与其主机相同的域名,即“服务器的电子邮件”
        • 解决方案如 此处 所述
      • 另请使用“DISCOURSE_SMTP_AUTHENTICATION: login”作为另一个环境变量选项。为什么总是这样。。。
  4. 然后从 /var/discourse 目录使用 sudo ./launcher bootstrap app 构建应用程序。这需要相当长的时间
  5. 然后您可能可以使用 sudo ./launcher start app 来启动 Discourse 容器。
1 个赞

这些笔记很好。

git pull;./launcher rebuild app 应该可以工作。

您正在从哪个版本更新?

操作系统是否已过时?(cat /etc/issue

磁盘是否已满?(df - h

1 个赞

感谢您的回复!我正在从中更新的版本是 2.8.0.beta6,上次更新是在 2021 年 9 月 28 日。

运行 cat /etc/issue 后,我得到:
Debian GNU/Linux 9 \n \l

以下是根据 ./discourse-doctor 的信息:

==================== MEMORY INFORMATION ====================
RAM (MB): 4050

              total        used        free      shared  buff/cache   available
Mem:           3955         427        1152          63        2375        3182
Swap:             0           0           0

==================== DISK SPACE CHECK ====================
---------- OS Disk Space ----------
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        63G   27G   34G  45% /

==================== DISK INFORMATION ====================
Disk /dev/sda: 64 GiB, 68719476736 bytes, 134217728 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc0b6220c

Device     Boot Start       End   Sectors Size Id Type
/dev/sda1        2048 134217727 134215680  64G 83 Linux

您或许可以添加交换空间。

另外,请参阅 PostgreSQL 13 更新

您是否重建了不止一次?

另请参阅 Debian | endoflife.date

您真的需要将所有内容迁移到一个运行受支持操作系统的虚拟机上。因此,您还需要升级您正在运行的其他所有内容。

1 个赞

你好 Jammy,经过多次安装失败,我发现这是由服务器的内存限制和网络引起的,我建议你使用 4GB 内存的服务器,并正常访问 GitHub 和 Ruby。

这个错误困扰着我——你还看到它吗? Docker 容器现在应该运行 3.2.0 了。

但是,如果你的 /var/discourse 不是 git 目录,那么你所做的操作就与说明不同。这会阻止更新并导致 ruby 版本不匹配。对我来说:

/var/discourse# git status
On branch main
Your branch is up to date with 'origin/main'.

我们还看到了一个 .git 目录:

# ls -a /var/discourse/
.     .github     README.md  cids              discourse-setup  launcher     scripts    tests
..    .gitignore  bin        containers        image            rebuild.log  shared
.git  LICENSE     c          discourse-doctor  index.html       samples      templates

编辑:但确实如此,如果你使用的是过时的操作系统,你需要做一些工作,在新操作系统中安装 discourse 并恢复你的备份,同时还要为你自己的具体情况做所有可能需要的额外事情。

如果你的服务器除了运行 discourse 之外还在做其他事情,那么就会增加额外的复杂性。你可能需要本地专业知识。

3 个赞

我在 ruby gems 等方面也有类似的故障。
这是在新服务器上的全新安装。

感谢各位的帮助,我会逐一尝试你们的建议来解决问题。如果有任何反馈(无论好坏),我都会在论坛上发布。再次感谢!

1 个赞

我已成功安装新版本的 Discourse。我只是按照上面的文档中的说明操作,并且它对我有用。但现在我在从备份恢复时遇到了麻烦。
我尝试了 从命令行恢复备份,但得到了以下结果:

root@my_server:/var/www/discourse# discourse restore my_server-2023-06-20-033008-v20210922064213.tar.gz
Starting restore: my_server-2023-06-20-033008-v20210922064213.tar.gz
[STARTED]
'system' has started the restore!
Marking restore as running...
Making sure /var/www/discourse/tmp/restores/default/2023-06-29-113408 exists...
Copying archive to tmp directory...
Unzipping archive, this may take a while...
EXCEPTION: /var/www/discourse/lib/discourse.rb:137:in `exec': Failed to decompress archive.

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
/var/www/discourse/lib/discourse.rb:171:in `execute_command'
/var/www/discourse/lib/discourse.rb:137:in `exec'
/var/www/discourse/lib/discourse.rb:33:in `execute_command'
/var/www/discourse/lib/backup_restore/backup_file_handler.rb:78:in `decompress_archive'
/var/www/discourse/lib/backup_restore/backup_file_handler.rb:23:in `decompress'
/var/www/discourse/lib/backup_restore/restorer.rb:42:in `run'
script/discourse:149:in `restore'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
script/discourse:290:in `<top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:492:in `exec'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:28:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/exe/bundle:45:in `block in <top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/exe/bundle:33:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Trying to rollback...
There was no need to rollback
Cleaning stuff up...
Removing tmp '/var/www/discourse/tmp/restores/default/2023-06-29-113408' directory...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.

我现在该怎么办?

您的备份文件似乎有问题。它可能只是被截断了。

1 个赞