mholt
(Matt)
2020 年12 月 29 日 19:49
1
我们正迁移至新的 DigitalOcean Droplet,并尝试使用市场镜像。但在运行设置脚本时,脚本过早失败,原因是我们的域名仍指向生产环境中的当前实例。
我需要先让新安装正常运行,以便恢复备份,然后再更新 DNS 记录。
错误信息如下:
正在检查您的域名 . . .
警告:计算机的 443 端口似乎无法通过主机名 x 访问。
警告:连接到 x(端口 80)也失败。
这表明 x 解析到了某个 IP 地址,但该地址无法访问您正在安装 Discourse 的这台机器。
首先,请确认 x 是否解析到了本服务器的 IP 地址。
通常您可以在购买域名的同一位置进行此操作。
如果您确定 IP 地址解析正确,则可能是防火墙问题。
在网络上搜索“开放端口 您的云服务提供商”可能会有所帮助。
实际上,该域名在 80 和 443 端口上确实有响应,因此这条错误信息似乎也不准确。
jomaxro
(Joshua Rosenfeld)
2020 年12 月 29 日 20:36
2
嘿,Matt,
我们(Discourse 团队)并不管理 DO 市场镜像,因此恐怕我们在这类具体问题上能提供的帮助有限。
jomaxro
(Joshua Rosenfeld)
2020 年12 月 29 日 20:48
4
是的,我们确实会处理这种情况。我没有查看代码,只是假设该检查来自市场镜像。
./discourse-setup 旨在提供一种简单的方式来设置 Discourse,从而在启动新的 Discourse 站点时避免手动编辑文本文件。您的使用场景并非该设置脚本处理的“典型”情况。
在这种情况下,您最好的办法可能是将当前服务器上的 containers/app.yml 文件复制到新服务器。或者,您也可以按照第 75/76 行的建议手动编辑该文件:
mholt
(Matt)
2020 年12 月 29 日 20:53
5
我在哪里可以找到默认的 app.yml?我想从全新的默认安装开始。
另外,如果不使用设置脚本,该如何启动服务器?由于无法运行设置脚本,访问 IP 地址仍然无响应。
jomaxro
(Joshua Rosenfeld)
2020 年12 月 29 日 21:02
6
默认文件位于 samples/standalone.yml。也可在 GitHub 上查看 。
假设你正在遵循官方安装指南,在完成“安装 Discourse”部分的命令后,请执行以下操作:
将默认的 YAML 文件从 samples 目录复制到 containers 目录:
cp samples/standalone.yml containers/app.yml
手动编辑该文件:
nano containers/app.yml
引导并启动 Discourse:
./launcher rebuild app
mholt
(Matt)
2020 年12 月 29 日 21:24
7
谢谢,这让我更接近目标了。
但现在我无法导入备份,因为我无法激活我的临时管理员账户:
(6) 拒绝加载脚本’‘,因为它违反了以下内容安全策略(Content Security Policy)指令:“script-src ”。请注意,未明确设置’script-src-elem’,因此将使用’script-src’作为备用。
是否有直接的方法从备份恢复,或者在此之前禁用 CSP?
jomaxro
(Joshua Rosenfeld)
2020 年12 月 29 日 21:33
8
mholt:
是否有直接的方法从备份恢复?
This guide explains how to restore a Discourse backup from the command line without using the Discourse web UI.
Required user level: Administrator
Console access required
Here’s how to restore a Discourse backup from the command line, without ever booting the Discourse web UI. This is handy when you’re moving servers.
Prerequisites
Before you start, make sure you complete the following steps:
Download the latest backup file from the source Disco…
mholt:
在此期间禁用 CSP 吗?
SSH 登录到你的服务器,然后执行:
cd /var/discourse
sudo ./launcher enter app
rails c
SiteSetting.content_security_policy = false
exit
exit
请注意,建议先尝试通过命令行恢复备份——这能解决你面临的实际问题(恢复备份),而不是当前的阻碍(CSP)。
mholt
(Matt)
2020 年12 月 29 日 21:45
9
感谢指点。
运行恢复时,我得到以下错误:
ERROR: 无法创建唯一索引 "index_incoming_referers_on_path_and_incoming_domain_id"
DETAIL: 键 (path, incoming_domain_id)=(/s/free+proxy+hideip.me, 1009) 重复。
EXCEPTION: psql 失败:DETAIL: 键 (path, incoming_domain_id)=(/s/free+proxy+hideip.me, 1009) 重复。
/var/www/discourse/lib/backup_restore/database_restorer.rb:87:in `restore_dump'
/var/www/discourse/lib/backup_restore/database_restorer.rb:26:in `restore'
/var/www/discourse/lib/backup_restore/restorer.rb:51:in `run'
script/discourse:143:in `restore'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
script/discourse:284:in `<top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/cli/exec.rb:63:in `load'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/cli/exec.rb:63:in `kernel_load'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/cli.rb:497:in `exec'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/cli.rb:30:in `dispatch'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/cli.rb:24:in `start'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/exe/bundle:49:in `block in <top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/exe/bundle:37:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
正在尝试回滚...
正在回滚...
正在清理内容...
正在从 discourse_functions 架构中删除函数...
正在删除临时目录 '/var/www/discourse/tmp/restores/default/2020-12-29-214249'...
正在取消暂停 sidekiq...
正在将恢复标记为已完成...
正在通知“system”恢复结束...
完成!
[失败]
恢复完成。
pfaffman
(Jay Pfaffman)
2020 年12 月 30 日 00:25
10
看起来您的索引已损坏。您是否对现有实例执行过升级?这或许能有所帮助。
somewhere 有一个主题介绍了如何从旧实例复制原始数据库(以及 Let’s Encrypt)文件。这大概是我会采取的做法。
mholt
(Matt)
2020 年12 月 30 日 00:46
11
pfaffman:
您是否对现有实例执行过升级?
“rub run”是什么意思?
对现有实例进行升级时不断出现错误(与当前错误不同),因此我决定迁移到新实例。