重建时出现数据库系统未正确关闭的错误

==================== 严重问题!!!! ====================
应用程序未运行!
尝试重新构建
==================== 重新构建日志 ====================
确保启动器为最新版本
获取 origin
启动器已是最新版本
cd /pups && git pull && /pups/bin/pups --stdin
已是最新版本。
I, [2019-09-19T03:25:36.256661 #1]  INFO -- : 正在加载 --stdin
I, [2019-09-19T03:25:36.269059 #1]  INFO -- : > locale-gen $LANG && update-locale
I, [2019-09-19T03:25:36.322226 #1]  INFO -- : 正在生成区域设置(这可能需要一些时间)...
生成完成。

I, [2019-09-19T03:25:36.322605 #1]  INFO -- : > mkdir -p /shared/postgres_run
I, [2019-09-19T03:25:36.328236 #1]  INFO -- :
I, [2019-09-19T03:25:36.328720 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2019-09-19T03:25:36.333983 #1]  INFO -- :
I, [2019-09-19T03:25:36.334293 #1]  INFO -- : > chmod 775 /shared/postgres_run
I, [2019-09-19T03:25:36.337836 #1]  INFO -- :
I, [2019-09-19T03:25:36.338129 #1]  INFO -- : > rm -fr /var/run/postgresql
I, [2019-09-19T03:25:36.343137 #1]  INFO -- :
I, [2019-09-19T03:25:36.343429 #1]  INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2019-09-19T03:25:36.347597 #1]  INFO -- :
I, [2019-09-19T03:25:36.347819 #1]  INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2019/09/19 03:25:36 socat[28] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): 没有那个文件或目录
I, [2019-09-19T03:25:36.354672 #1]  INFO -- :
I, [2019-09-19T03:25:36.355006 #1]  INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2019-09-19T03:25:36.359801 #1]  INFO -- :
I, [2019-09-19T03:25:36.360028 #1]  INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2019-09-19T03:25:36.365218 #1]  INFO -- :
I, [2019-09-19T03:25:36.365462 #1]  INFO -- : > mkdir -p /shared/postgres_run/10-main.pg_stat_tmp
I, [2019-09-19T03:25:36.370636 #1]  INFO -- :
I, [2019-09-19T03:25:36.370987 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run/10-main.pg_stat_tmp
I, [2019-09-19T03:25:36.375238 #1]  INFO -- :
I, [2019-09-19T03:25:36.384014 #1]  INFO -- : 文件 > /etc/service/postgres/run  chmod: +x  chown:
I, [2019-09-19T03:25:36.391893 #1]  INFO -- : 文件 > /etc/service/postgres/log/run  chmod: +x  chown:
I, [2019-09-19T03:25:36.399904 #1]  INFO -- : 文件 > /etc/runit/3.d/99-postgres  chmod: +x  chown:
I, [2019-09-19T03:25:36.409011 #1]  INFO -- : 文件 > /root/upgrade_postgres  chmod: +x  chown:
I, [2019-09-19T03:25:36.409331 #1]  INFO -- : > chown -R root /var/lib/postgresql/10/main
I, [2019-09-19T03:25:39.272591 #1]  INFO -- :
I, [2019-09-19T03:25:39.272827 #1]  INFO -- : > [ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/10/bin/initdb -D /shared/postgres_data || exit 0
I, [2019-09-19T03:25:39.276677 #1]  INFO -- :
I, [2019-09-19T03:25:39.276825 #1]  INFO -- : > chown -R postgres:postgres /shared/postgres_data
I, [2019-09-19T03:25:39.300652 #1]  INFO -- :
I, [2019-09-19T03:25:39.300913 #1]  INFO -- : > chown -R postgres:postgres /var/run/postgresql
I, [2019-09-19T03:25:39.305131 #1]  INFO -- :
I, [2019-09-19T03:25:39.305468 #1]  INFO -- : > /root/upgrade_postgres
I, [2019-09-19T03:25:39.315038 #1]  INFO -- :
I, [2019-09-19T03:25:39.315197 #1]  INFO -- : > rm /root/upgrade_postgres
I, [2019-09-19T03:25:39.318486 #1]  INFO -- :
I, [2019-09-19T03:25:39.318940 #1]  INFO -- : 在 /etc/postgresql/10/main/postgresql.conf 中将 data_directory = '/var/lib/postgresql/10/main' 替换为 data_directory = '/shared/postgres_data'
I, [2019-09-19T03:25:39.320086 #1]  INFO -- : 在 /etc/postgresql/10/main/postgresql.conf 中将 (?-mix:#?listen_addresses *=.*) 替换为 listen_addresses = '*'
I, [2019-09-19T03:25:39.322462 #1]  INFO -- : 在 /etc/postgresql/10/main/postgresql.conf 中将 (?-mix:#?synchronous_commit *=.*) 替换为 synchronous_commit = $db_synchronous_commit
I, [2019-09-19T03:25:39.324514 #1]  INFO -- : 在 /etc/postgresql/10/main/postgresql.conf 中将 (?-mix:#?shared_buffers *=.*) 替换为 shared_buffers = $db_shared_buffers
I, [2019-09-19T03:25:39.325648 #1]  INFO -- : 在 /etc/postgresql/10/main/postgresql.conf 中将 (?-mix:#?work_mem *=.*) 替换为 work_mem = $db_work_mem
I, [2019-09-19T03:25:39.326845 #1]  INFO -- : 在 /etc/postgresql/10/main/postgresql.conf 中将 (?-mix:#?default_text_search_config *=.*) 替换为 default_text_search_config = '$db_default_text_search_config'
I, [2019-09-19T03:25:39.328375 #1]  INFO -- : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
I, [2019-09-19T03:25:39.334429 #1]  INFO -- :
I, [2019-09-19T03:25:39.334939 #1]  INFO -- : 在 /etc/postgresql/10/main/postgresql.conf 中将 (?-mix:#?max_wal_senders *=.*) 替换为 max_wal_senders = $db_max_wal_senders
I, [2019-09-19T03:25:39.335686 #1]  INFO -- : 在 /etc/postgresql/10/main/postgresql.conf 中将 (?-mix:#?wal_level *=.*) 替换为 wal_level = $db_wal_level
I, [2019-09-19T03:25:39.338130 #1]  INFO -- : 在 /etc/postgresql/10/main/postgresql.conf 中将 (?-mix:#?checkpoint_segments *=.*) 替换为 checkpoint_segments = $db_checkpoint_segments
I, [2019-09-19T03:25:39.341035 #1]  INFO -- : 在 /etc/postgresql/10/main/postgresql.conf 中将 (?-mix:#?logging_collector *=.*) 替换为 logging_collector = $db_logging_collector
I, [2019-09-19T03:25:39.342254 #1]  INFO -- : 在 /etc/postgresql/10/main/postgresql.conf 中将 (?-mix:#?log_min_duration_statement *=.*) 替换为 log_min_duration_statement = $db_log_min_duration_statement
I, [2019-09-19T03:25:39.343427 #1]  INFO -- : 在 /etc/postgresql/10/main/pg_hba.conf 中将 (?-mix:^#local +replication +postgres +peer$) 替换为 local replication postgres  peer
I, [2019-09-19T03:25:39.343950 #1]  INFO -- : 在 /etc/postgresql/10/main/pg_hba.conf 中将 (?-mix:^host.*all.*all.*127.*$) 替换为 host all all 0.0.0.0/0 md5
I, [2019-09-19T03:25:39.345666 #1]  INFO -- : > HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/10/bin/postmaster -D /etc/postgresql/10/main
I, [2019-09-19T03:25:39.348666 #1]  INFO -- : > sleep 5
2019-09-19 03:25:39.378 UTC [51] LOG:  正在监听 IPv4 地址 "0.0.0.0",端口 5432
2019-09-19 03:25:39.378 UTC [51] LOG:  正在监听 IPv6 地址 "::",端口 5432
2019-09-19 03:25:39.384 UTC [51] LOG:  正在监听 Unix 套接字 "/var/run/postgresql/.s.PGSQL.5432"
2019-09-19 03:25:39.493 UTC [54] LOG:  数据库系统在 2019-09-19 03:23:55 UTC 处于恢复状态时已关闭
2019-09-19 03:25:39.493 UTC [54] LOG:  数据库系统未正确关闭;正在进行自动恢复
2019-09-19 03:25:39.509 UTC [54] LOG:  重做从 1003/5E792F0 开始
I, [2019-09-19T03:25:44.352528 #1]  INFO -- :
I, [2019-09-19T03:25:44.352957 #1]  INFO -- : > su postgres -c 'createdb discourse' || true
2019-09-19 03:25:44.438 UTC [58] postgres@postgres FATAL:  数据库系统正在启动
2019-09-19 03:25:44.439 UTC [59] postgres@template1 FATAL:  数据库系统正在启动
createdb: 无法连接到数据库 template1:FATAL:  数据库系统正在启动
I, [2019-09-19T03:25:44.442572 #1]  INFO -- :
I, [2019-09-19T03:25:44.443122 #1]  INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2019-09-19 03:25:44.525 UTC [70] postgres@discourse FATAL:  数据库系统正在启动
psql: FATAL:  数据库系统正在启动
I, [2019-09-19T03:25:44.527564 #1]  INFO -- :
I, [2019-09-19T03:25:44.527978 #1]  INFO -- : > su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true
2019-09-19 03:25:44.617 UTC [81] postgres@discourse FATAL:  数据库系统正在启动
psql: FATAL:  数据库系统正在启动
I, [2019-09-19T03:25:44.619389 #1]  INFO -- :
I, [2019-09-19T03:25:44.619732 #1]  INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
2019-09-19 03:25:44.699 UTC [92] postgres@discourse FATAL:  数据库系统正在启动
psql: FATAL:  数据库系统正在启动
I, [2019-09-19T03:25:44.701755 #1]  INFO -- :
I, [2019-09-19T03:25:44.702510 #1]  INFO -- : 终止异步进程
I, [2019-09-19T03:25:44.702584 #1]  INFO -- : 向 HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/10/bin/postmaster -D /etc/postgresql/10/main 的进程 51 发送 INT 信号
2019-09-19 03:25:44.702 UTC [51] LOG:  收到快速关闭请求
2019-09-19 03:25:44.745 UTC [95] LOG:  正在关闭
2019-09-19 03:25:44.926 UTC [51] LOG:  数据库系统已关闭


失败
--------------------
Pups::ExecError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' 失败,返回状态为 #<Process::Status: pid 82 exit 2>
失败位置:/pups/lib/pups/exec_command.rb:112:in `spawn'
使用参数 "su postgres -c 'psql $db_name -c \"alter schema public owner to $db_user;\"'" 执行失败
e3c609d02d8197f6efd84dd0ecf99456ed566b02fd3a09d87e286696496e56c8
** 引导失败 ** 请向上滚动并查找之前的错误消息,可能不止一条。
./discourse-doctor 可能有助于诊断问题。
> 

此错误在上次更新后出现

  • 我已移除非官方插件
  • 有大量空间(超过 600GB)
  • 2GB 交换文件

您的数据库存在问题

 2019-09-19 03:25:39.493 UTC [54] LOG: 数据库系统未正常关闭;正在自动恢复

如果您执行

. /launcher start app

然后稍等片刻,恢复过程可能会完成,之后您就可以进行重建了。

感谢您的快速回复,但仍然存在错误:

在执行 ./launcher start app 之后

警告:我们即将开始下载 Discourse 基础镜像
此过程可能需要几分钟到一小时不等,具体取决于您的网络速度

请耐心等待

无法在本地找到镜像 'discourse/base:2.0.20190906-0522'
2.0.20190906-0522: 正在从 discourse/base 拉取
1ab2bdfe9778: 正在拉取文件系统层
a313ca07f056: 正在拉取文件系统层
1ab2bdfe9778: 下载完成
1ab2bdfe9778: 拉取完成
a313ca07f056: 正在验证校验和
a313ca07f056: 下载完成
a313ca07f056: 拉取完成
摘要:sha256:8c58bd323c80b464b2634d2aa8c322772d0c7bff3e08eff06cf2b66d37fe623d
状态:已下载 discourse/base:2.0.20190906-0522 的新镜像

无法在本地找到镜像 'local_discourse/app:latest'
/usr/bin/docker: 守护进程错误响应:拒绝访问 local_discourse/app 的拉取操作,该仓库不存在或可能需要执行 'docker login'。
请参阅 '/usr/bin/docker run --help'。

哦,看来您没有可用的容器。

如果您有备份,最简单的解决方案是删除 postgres_data 目录,重新构建并恢复备份。如果您没有备份,或许可以 [将单容器转换为双容器不可动摇架构](https://meta.discourse.org/t/how-to-move-from-standalone-container-to-separate-web-and-data-containers/29413)。

我不确定那些说明是否清楚地说明了如何将现有数据迁移到新容器中。

如果您支付 500 美元,我可以为您修复问题,否则全额退款(而且有很大几率我会白白浪费时间,最终把钱退还给您)。我的联系方式在我的个人资料中。