Discourse 在内网安装 - bootstrap 失败,退出代码 17

您好,

我正在内网环境中安装 Discourse。在重建过程中,有时会遇到此错误:

Pups::ExecError: cd /var/www/discourse && su discourse -c ‘bundle install --retry 3 --jobs 4’ failed with return #<Process::Status: pid 645 exit 17>
位置:/usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn’
exec failed with the params {“cd”=>“$home”, “hook”=>“bundle_exec”, “cmd”=>[“su discourse -c ‘bundle config --local deployment true’”, “su discourse -c ‘bundle config --local without \"development test\"’”, “su discourse -c ‘bundle install --retry 3 --jobs 4’”]}
bootstrap failed with exit code 17
** 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.
6ef3d42536c82021bdb1f24980cbd860572869f207e4eb2001e59e8923b182cf
root@wpyb3816:/var/discourse# cat /etc/docker/daemon.json

有人知道可能是什么原因吗?
谢谢。

您的构建日志中是否还有其他错误消息?

3 个赞

I, [2024-03-29T14:58:21.260866 #1] INFO – :
I, [2024-03-29T14:58:21.261079 #1] INFO – : > su postgres -c ‘createdb discourse’ || true
2024-03-29 14:58:21.298 UTC [55] postgres@postgres ERROR: database “discourse” already exists
2024-03-29 14:58:21.298 UTC [55] postgres@postgres STATEMENT: CREATE DATABASE discourse;
createdb: error: database creation failed: ERROR: database “discourse” already exists
I, [2024-03-29T14:58:21.299606 #1] INFO – :
I, [2024-03-29T14:58:21.299710 #1] INFO – : > su postgres -c ‘psql discourse -c “create user discourse;”’ || true
2024-03-29 14:58:21.334 UTC [59] postgres@discourse ERROR: role “discourse” already exists
2024-03-29 14:58:21.334 UTC [59] postgres@discourse STATEMENT: create user discourse;
ERROR: role “discourse” already exists

and then another error before the crash …

[2024-03-29T14:59:48.410149 #1] INFO – : > cd /var/www/discourse && su discourse -c ‘bundle install --retry 3 --jobs 4’
Retrying fetcher due to error (2/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn’t have the CA certificates needed for verification. For information about OpenSSL certificates, see OpenSSL Errors and Rails – Certificate Verify Failed · RailsApps.
Retrying fetcher due to error (3/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn’t have the CA certificates needed for verification. For information about OpenSSL certificates, see OpenSSL Errors and Rails – Certificate Verify Failed · RailsApps.
Retrying fetcher due to error (4/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn’t have the CA certificates needed for verification. For information about OpenSSL certificates, see OpenSSL Errors and Rails – Certificate Verify Failed · RailsApps.
Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most
likely your system doesn’t have the CA certificates needed for verification. For
information about OpenSSL certificates, see
OpenSSL Errors and Rails – Certificate Verify Failed · RailsApps.
I, [2024-03-29T14:59:49.328710 #1] INFO – : Fetching source index from https://rubygems.org/

这是问题所在。看起来您的互联网正在阻止访问 rubygems。

Discourse 需要 https,并且标准的安装需要可以通过公共 IP 访问才能获取证书。您很可能也会因此遇到麻烦。

1 个赞

好的,我已经发送了内部请求来打开这个 URL……因为在内部网环境中,所有 URL 默认都是关闭的。
一旦完成,我会告知您结果。谢谢。

打开 https://rubygems.org/ 时出现相同的错误……

如果无法将服务器开放给所有站点,那么您将不得不自己阅读消息,并逐个打开加载的每个站点。以 6 天的周转时间来看,我预计这需要一到两个月的时间。

让 Discourse 在无法访问互联网的私有内网上运行并不真正受支持。您可能可以在其他地方构建一个镜像,然后尝试在您的内网上启动它。您仍然需要自己解决获取 https 证书的方法。

1 个赞

你好,

这是我所做的:

  • 我在我的 PC 上创建了一个来自公司外部网络的镜像
  • 我已将其上传到仓库
  • 我已在公司内部网络上拉取了该镜像,然后启动了一个容器
    ./launcher start app --run-image my image

容器运行正常,但端口 80/443 似乎无法访问(我已经用 nmap 检查过,它们是打开的!)。我无法从浏览器访问该应用程序。当我输入:curl -v localhost:80 时,我收到此错误。

* 使用代理环境变量 no_proxy == 'localhost,127.0.0.1,.laposte.fr'
*   正在尝试连接 127.0.0.1:80...
* 已连接到 localhost (127.0.0.1) 80 端口 (#0)

> GET / HTTP/1.1
> Host: localhost
> User-Agent: curl/7.81.0
> Accept: */*
> 
* 接收失败:连接被对端重置
* 关闭连接 0
curl: (56) 接收失败:连接被对端重置

我猜你没有证书,nginx 正在失败。你需要移除 ssl 和 let’s encrypt 模板并构建一个新镜像。然后你需要一个带有证书的反向代理。

你也可以使用你自己生成的证书。我想还有一个关于如何做到这一点的帖子(在 let’s encrypt 出现之前)。

你可以查看 nginx 日志来查看错误。

我尚未在我的 app.yml 文件中激活 letsencrypt 模板,因此我不必担心此移除请求,对吗?我使用的是带有自己证书的前端 VIP。