这里有更多信息。在 gunicorn stderr 中,我看到:
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.7/lib/active_record/connection_adapters/postgresql_adapter.rb:87:in `rescue in new_client': connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory (ActiveRecord::ConnectionNotEstablished)
Is the server running locally and accepting connections on that socket?
在 PG 日志中,我看到:
2023-08-21 19:24:00.721 UTC [1681] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-08-21 19:24:00.728 UTC [1681] LOG: could not open configuration file "/etc/postgresql/13/main/pg_hba.conf": Permission denied
2023-08-21 19:24:00.728 UTC [1681] FATAL: could not load pg_hba.conf
2023-08-21 19:24:00.741 UTC [1681] LOG: database system is shut down
此外:
# ls -l /etc/postgresql/13/main/pg_hba.conf
-rw-r----- 1 root root 4846 Aug 21 19:05 /etc/postgresql/13/main/pg_hba.conf
Postgres 在容器内是以什么用户运行的?根据上述权限,它必须是 root 或属于 root 组的某人。
好的,我执行了 chmod o+r /etc/postgresql/13/main/pg_hba.conf,现在容器又启动了。
这一切有点令人担忧——为什么推荐的安装方法不能开箱即用?我的插件状态目前包括上面列出的插件,除了数据浏览器,我禁用了它,因为它上次导致了失败。
交叉链接到
其中报告了类似的症状。
更新:我已按照链接帖子中的描述,在 app.yml 文件的 cmd 部分更改了 git 命令以使用 sudo。
我将此故障声明为间歇性的。在 3 次尝试中(每次尝试之间我都完全清除了 shared 目录),有一次成功,两次失败。当它失败时,手动修复三个有问题的权限然后重新启动容器,似乎就能使系统正常工作。更好的日志记录和更好的自检功能将有助于检测容器启动失败。