使用 RDS 启动时遇到问题 --- 无法打开证书文件

我有一个相当标准的安装,数据库在 RDS 上。它之前是 13.2 版本,我刚刚将其升级到 15.2 版本。现有的容器工作正常。

当我引导一个新镜像时,它会迁移数据库,预编译资产

然后


I, [2023-12-20T20:16:12.865112 #1]  INFO -- : cd /var/www/discourse & sudo -E -u discourse bundle exec rake s3:upload_assets
插件名称是 'discourse-linkedin-auth',但插件目录名为 'discourse-plugin-linkedin-auth'
插件名称是 'stemaway-experience-bbcodes',但插件目录名为 'experience-bbcodes'
插件名称是 'discourse-badge-search',但插件目录名为 'stemaway-badge-search'
插件名称是 'points-plugin',但插件目录名为 'tacks-plugin'
插件名称是 'discourse-group-assign-by-custom-field',但插件目录名为 'ucf-group-assignment'
rake aborted!
ActiveRecord::NoDatabaseError: 我们找不到您的数据库:discourse。可以在位于 config/database.yml 的数据库配置文件中找到。(ActiveRecord::NoDatabaseError)


然后稍后出现类似这样的情况:

Caused by:
PG::ConnectionBad: connection to server at "172.31.x.y", port 5432 failed: could not open certificate file "/root/.postgresql/postgresql.crt": Permission denied (PG::ConnectionBad)
connection to server at "172.31.x.y", port 5432 failed: FATAL:  no pg_hba.conf entry for host "172.31.x.y", user "postgres", database "discourse", no encryption
...Pups::ExecError: cd /var/www/discourse & sudo -E -u discourse bundle exec rake s3:upload_assets failed with return #<Process::Status: pid 7133 exit 1>

它能够迁移和预编译但无法上传资产,这(对我来说)没有意义。
如果我在构建过程中进入容器,我可以使用 ENV 中的凭据连接到 postgres。

我将设法从 tmux 中获取完整的日志。. .嗯,缓冲区不是很大,放不下。我将尝试创建一个更大的缓冲区,运行另一个引导程序,并将完整的日志放在某个地方。

2 个赞

原来,你需要

env:
  PGSSLCERT: /tmp/postgresql.crt

我不知道我是在哪里发现这个的,但它在暂存站点的 yml 中,却不在生产站点的 yml 中。而且它直到最近都运行得很好。这很奇怪,因为数据库迁移得很顺利,直到开始尝试预编译资源才失败。

3 个赞

此主题在上次回复后 30 天自动关闭。不再允许回复。