你好,
我刚刚尝试通过命令行运行 ‘launcher rebuild app’,将系统从 2.6.0.beta3 (7afb5be5f9) 更新到 2.6.0.beta4(该版本在 20 分钟前发布)。2.6.0.beta3 已经稳定运行了一段时间,这是我通常的更新方式。
更新失败了,请查看下方的输出。我再次尝试运行 launcher rebuild,但出现了相同的错误。接着我运行了 discourse-doctor,它在重建过程中也报错,但成功将 Discourse 重新启动回 2.6.0.beta3。
再重申一下最后的情况:我现在已恢复运行在 2.6.0.beta3 上,网站功能正常。但在弄清楚问题之前,我不会再次尝试更新到 2.6.0.beta4。
launcher 的输出显示“数据库系统被中断”,但在我开始运行 launcher rebuild 命令时,Discourse 是正常运行且在线的。
Discourse 托管在 AWS EFS 上,因此存储空间几乎是无限的。服务器拥有 32 GB 内存,对于该站点(每月约 130 万页面浏览量)来说绰绰有余。
非常感谢您的帮助和指导,以协助我找出问题所在。
以下是运行 rebuild 时的完整输出日志:
gunnar@dewis:/var/discourse$ sudo ./launcher rebuild app
警告:即将开始下载 Discourse 基础镜像
此过程可能需要几分钟到一小时不等,具体取决于您的网络速度
请耐心等待
2.0.20201004-2310: 正在从 discourse/base 拉取
摘要:sha256:076ad6f035d7f38e08a2d4fdd4f429ad7a40a9cc72d9958445261cdb9e743d26
状态:已下载 discourse/base:2.0.20201004-2310 的新镜像
docker.io/discourse/base:2.0.20201004-2310
确保 launcher 为最新状态
正在获取 origin
remote: 枚举对象:15,完成。
remote: 计数对象:100% (15/15),完成。
remote: 压缩对象:100% (12/12),完成。
remote: 总计 15(差异 5),重用 9(差异 3),包重用 0
解压对象:100% (15/15),完成。
来自 https://github.com/discourse/discourse_docker
1b97cb1..468f1f9 master -> origin/master
* [新分支] imagemagick-policy-xml -> origin/imagemagick-policy-xml
正在更新 Launcher...
正在更新 1b97cb1..468f1f9
快速前进
samples/mail-receiver.yml | 2 +-
1 个文件变更,1 处插入(+),1 处删除(-)
Launcher 已更新,正在重启...
确保 launcher 为最新状态
正在获取 origin
Launcher 已是最新
正在停止旧容器
+ /usr/bin/docker stop -t 60 app
app
cd /pups && git pull && /pups/bin/pups --stdin
已是最新。
I, [2020-10-19T18:46:41.157056 #1] INFO -- : 正在加载 --stdin
I, [2020-10-19T18:46:41.162007 #1] INFO -- : > locale-gen $LANG && update-locale
I, [2020-10-19T18:46:41.197444 #1] INFO -- : 正在生成区域设置(这可能需要一些时间)...
生成完成。
I, [2020-10-19T18:46:41.197650 #1] INFO -- : > mkdir -p /shared/postgres_run
I, [2020-10-19T18:46:41.202176 #1] INFO -- :
I, [2020-10-19T18:46:41.202375 #1] INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2020-10-19T18:46:41.208709 #1] INFO -- :
I, [2020-10-19T18:46:41.208877 #1] INFO -- : > chmod 775 /shared/postgres_run
I, [2020-10-19T18:46:41.215819 #1] INFO -- :
I, [2020-10-19T18:46:41.215957 #1] INFO -- : > rm -fr /var/run/postgresql
I, [2020-10-19T18:46:41.219629 #1] INFO -- :
I, [2020-10-19T18:46:41.219800 #1] INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2020-10-19T18:46:41.222805 #1] INFO -- :
I, [2020-10-19T18:46:41.222936 #1] INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2020/10/19 18:46:41 socat[27] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): 连接被拒绝
I, [2020-10-19T18:46:41.237039 #1] INFO -- :
I, [2020-10-19T18:46:41.237173 #1] INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2020-10-19T18:46:41.292499 #1] INFO -- :
I, [2020-10-19T18:46:41.292674 #1] INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2020-10-19T18:46:41.304292 #1] INFO -- :
I, [2020-10-19T18:46:41.304434 #1] INFO -- : > mkdir -p /shared/postgres_run/12-main.pg_stat_tmp
I, [2020-10-19T18:46:41.310575 #1] INFO -- :
I, [2020-10-19T18:46:41.310782 #1] INFO -- : > chown postgres:postgres /shared/postgres_run/12-main.pg_stat_tmp
I, [2020-10-19T18:46:41.317554 #1] INFO -- :
I, [2020-10-19T18:46:41.322287 #1] INFO -- : 文件 > /etc/service/postgres/run chmod: +x chown:
I, [2020-10-19T18:46:41.326660 #1] INFO -- : 文件 > /etc/service/postgres/log/run chmod: +x chown:
I, [2020-10-19T18:46:41.330737 #1] INFO -- : 文件 > /etc/runit/3.d/99-postgres chmod: +x chown:
I, [2020-10-19T18:46:41.334906 #1] INFO -- : 文件 > /root/upgrade_postgres chmod: +x chown:
I, [2020-10-19T18:46:41.335100 #1] INFO -- : > chown -R root /var/lib/postgresql/12/main
I, [2020-10-19T18:46:42.155381 #1] INFO -- :
I, [2020-10-19T18:46:42.155536 #1] INFO -- : > [ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/12/bin/initdb -D /shared/postgres_data || exit 0
I, [2020-10-19T18:46:42.157629 #1] INFO -- :
I, [2020-10-19T18:46:42.157703 #1] INFO -- : > chown -R postgres:postgres /shared/postgres_data
I, [2020-10-19T18:47:06.520719 #1] INFO -- :
I, [2020-10-19T18:47:06.520876 #1] INFO -- : > chown -R postgres:postgres /var/run/postgresql
I, [2020-10-19T18:47:06.523564 #1] INFO -- :
I, [2020-10-19T18:47:06.523706 #1] INFO -- : > /root/upgrade_postgres
I, [2020-10-19T18:47:06.540126 #1] INFO -- :
I, [2020-10-19T18:47:06.540286 #1] INFO -- : > rm /root/upgrade_postgres
I, [2020-10-19T18:47:06.542555 #1] INFO -- :
I, [2020-10-19T18:47:06.543828 #1] INFO -- : 在 /etc/postgresql/12/main/postgresql.conf 中将 data_directory = '/var/lib/postgresql/12/main' 替换为 data_directory = '/shared/postgres_data'
I, [2020-10-19T18:47:06.544330 #1] INFO -- : 在 /etc/postgresql/12/main/postgresql.conf 中将 (?-mix:#?listen_addresses *=.*) 替换为 listen_addresses = '*'
I, [2020-10-19T18:47:06.545027 #1] INFO -- : 在 /etc/postgresql/12/main/postgresql.conf 中将 (?-mix:#?synchronous_commit *=.*) 替换为 synchronous_commit = $db_synchronous_commit
I, [2020-10-19T18:47:06.545814 #1] INFO -- : 在 /etc/postgresql/12/main/postgresql.conf 中将 (?-mix:#?shared_buffers *=.*) 替换为 shared_buffers = $db_shared_buffers
I, [2020-10-19T18:47:06.546523 #1] INFO -- : 在 /etc/postgresql/12/main/postgresql.conf 中将 (?-mix:#?work_mem *=.*) 替换为 work_mem = $db_work_mem
I, [2020-10-19T18:47:06.547230 #1] INFO -- : 在 /etc/postgresql/12/main/postgresql.conf 中将 (?-mix:#?default_text_search_config *=.*) 替换为 default_text_search_config = '$db_default_text_search_config'
I, [2020-10-19T18:47:06.547896 #1] INFO -- : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
I, [2020-10-19T18:47:06.561717 #1] INFO -- :
I, [2020-10-19T18:47:06.562046 #1] INFO -- : 在 /etc/postgresql/12/main/postgresql.conf 中将 (?-mix:#?checkpoint_segments *=.*) 替换为 checkpoint_segments = $db_checkpoint_segments
I, [2020-10-19T18:47:06.562327 #1] INFO -- : 在 /etc/postgresql/12/main/postgresql.conf 中将 (?-mix:#?logging_collector *=.*) 替换为 logging_collector = $db_logging_collector
I, [2020-10-19T18:47:06.563080 #1] INFO -- : 在 /etc/postgresql/12/main/postgresql.conf 中将 (?-mix:#?log_min_duration_statement *=.*) 替换为 log_min_duration_statement = $db_log_min_duration_statement
I, [2020-10-19T18:47:06.564238 #1] INFO -- : 在 /etc/postgresql/12/main/pg_hba.conf 中将 (?-mix:^#local +replication +postgres +peer$) 替换为 local replication postgres peer
I, [2020-10-19T18:47:06.564505 #1] INFO -- : 在 /etc/postgresql/12/main/pg_hba.conf 中将 (?-mix:^host.*all.*all.*127.*$) 替换为 host all all 0.0.0.0/0 md5
I, [2020-10-19T18:47:06.565039 #1] INFO -- : > HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/12/bin/postmaster -D /etc/postgresql/12/main
I, [2020-10-19T18:47:06.566806 #1] INFO -- : > sleep 5
2020-10-19 18:47:06.629 UTC [50] LOG: 正在启动 PostgreSQL 12.4 (Debian 12.4-1.pgdg100+1),运行在 x86_64-pc-linux-gnu 上,由 gcc (Debian 8.3.0-6) 8.3.0 编译,64 位
2020-10-19 18:47:06.629 UTC [50] LOG: 正在监听 IPv4 地址 "0.0.0.0",端口 5432
2020-10-19 18:47:06.629 UTC [50] LOG: 正在监听 IPv6 地址 "::",端口 5432
2020-10-19 18:47:06.665 UTC [50] LOG: 正在监听 Unix 套接字 "/var/run/postgresql/.s.PGSQL.5432"
2020-10-19 18:47:07.211 UTC [53] LOG: 数据库系统被中断;上次已知运行时间为 2020-10-19 18:40:46 UTC
I, [2020-10-19T18:47:11.568937 #1] INFO -- :
I, [2020-10-19T18:47:11.569207 #1] INFO -- : > su postgres -c 'createdb discourse' || true
2020-10-19 18:47:11.636 UTC [57] postgres@postgres FATAL: 数据库系统正在启动
2020-10-19 18:47:11.638 UTC [58] postgres@template1 FATAL: 数据库系统正在启动
createdb: 错误:无法连接到数据库 template1:FATAL: 数据库系统正在启动
I, [2020-10-19T18:47:11.640042 #1] INFO -- :
I, [2020-10-19T18:47:11.640270 #1] INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2020-10-19 18:47:11.704 UTC [69] postgres@discourse FATAL: 数据库系统正在启动
psql: 错误:无法连接到服务器:FATAL: 数据库系统正在启动
I, [2020-10-19T18:47:11.706232 #1] INFO -- :
I, [2020-10-19T18:47:11.706429 #1] INFO -- : > su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true
2020-10-19 18:47:11.761 UTC [80] postgres@discourse FATAL: 数据库系统正在启动
psql: 错误:无法连接到服务器:FATAL: 数据库系统正在启动
I, [2020-10-19T18:47:11.763159 #1] INFO -- :
I, [2020-10-19T18:47:11.763357 #1] INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
2020-10-19 18:47:11.818 UTC [91] postgres@discourse FATAL: 数据库系统正在启动
psql: 错误:无法连接到服务器:FATAL: 数据库系统正在启动
I, [2020-10-19T18:47:11.819734 #1] INFO -- :
I, [2020-10-19T18:47:11.819998 #1] INFO -- : 正在终止异步进程
I, [2020-10-19T18:47:11.820025 #1] INFO -- : 向 HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/12/bin/postmaster -D /etc/postgresql/12/main 发送 INT 信号,pid: 50
2020-10-19 18:47:11.820 UTC [50] LOG: 收到快速关闭请求
I, [2020-10-19T18:47:21.820568 #1] INFO -- : HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/12/bin/postmaster -D /etc/postgresql/12/main pid:50 未正常终止,正在强制终止!
失败
--------------------
Pups::ExecError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' 失败,返回码 #<Process::Status: pid 81 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;\"'"
809e00dc988196b9a3c0bfe215ff0ba30fa00056e1d2ad92818bc6b9d911df62
** 引导失败 ** 请向上滚动并查找更早的错误消息,可能不止一条。
./discourse-doctor 可能有助于诊断问题。
gunnar@dewis:/var/discourse$