引导失败,即使在全新安装上也是如此

您好,

我使用 Discourse 已经很多年了,但我想迁移到另一台服务器。
我已经备份好了,现在正在新服务器上尝试安装一个新副本以便进行恢复。

但是,当我尝试新安装时,一直出现错误。
尝试了几次但结果都一样,已经多次重建服务器,但情况依旧。

Debian 11
内存 1GB
交换空间 4GB
2 核

安装日志:

检测到 x86_64 架构。
确保启动器是最新的
正在获取 origin
启动器是最新的
正在停止旧容器
+ /usr/bin/docker stop -t 60 app
app
2.0.20230222-0048: 正在拉取 discourse/base
摘要:sha256:6a7dd0755c6832e1ecfc8cc980f27836b69b4162d6ff1b6a3e4e382a3b854803
状态:镜像已是最新版 discourse/base:2.0.20230222-0048
docker.io/discourse/base:2.0.20230222-0048
/usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2023-03-13T11:25:13.229925 #1]  INFO -- : 从 stdin 读取
I, [2023-03-13T11:25:13.237120 #1]  INFO -- : > locale-gen $LANG && update-locale
I, [2023-03-13T11:25:15.133566 #1]  INFO -- : 正在生成区域设置(这可能需要一些时间)...
生成完成。

I, [2023-03-13T11:25:15.134390 #1]  INFO -- : > mkdir -p /shared/postgres_run
I, [2023-03-13T11:25:15.164309 #1]  INFO -- : 
I, [2023-03-13T11:25:15.165444 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2023-03-13T11:25:15.182370 #1]  INFO -- : 
I, [2023-03-13T11:25:15.183423 #1]  INFO -- : > chmod 775 /shared/postgres_run
I, [2023-03-13T11:25:15.248940 #1]  INFO -- : 
I, [2023-03-13T11:25:15.249966 #1]  INFO -- : > rm -fr /var/run/postgresql
I, [2023-03-13T11:25:15.269133 #1]  INFO -- : 
I, [2023-03-13T11:25:15.270288 #1]  INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2023-03-13T11:25:15.314538 #1]  INFO -- : 
I, [2023-03-13T11:25:15.315922 #1]  INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2023/03/13 11:25:16 socat[18] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory
I, [2023-03-13T11:25:16.264579 #1]  INFO -- : 
I, [2023-03-13T11:25:16.265205 #1]  INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2023-03-13T11:25:16.330415 #1]  INFO -- : 
I, [2023-03-13T11:25:16.331258 #1]  INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2023-03-13T11:25:16.334530 #1]  INFO -- : 
I, [2023-03-13T11:25:16.335427 #1]  INFO -- : > mkdir -p /shared/postgres_run/13-main.pg_stat_tmp
I, [2023-03-13T11:25:16.339258 #1]  INFO -- : 
I, [2023-03-13T11:25:16.340137 #1]  INFO -- : > chown postgres:postgres /shared/postgres_run/13-main.pg_stat_tmp
I, [2023-03-13T11:25:16.342468 #1]  INFO -- : 
I, [2023-03-13T11:25:16.410983 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown: 
I, [2023-03-13T11:25:16.416328 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown: 
I, [2023-03-13T11:25:16.421556 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown: 
I, [2023-03-13T11:25:16.428238 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown: 
I, [2023-03-13T11:25:16.429045 #1]  INFO -- : > chown -R root /var/lib/postgresql/13/main
I, [2023-03-13T11:26:07.923757 #1]  INFO -- : 
I, [2023-03-13T11:26:08.425452 #1]  INFO -- : > [ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/13/bin/initdb -D /shared/postgres_data || exit 0
I, [2023-03-13T11:26:08.612014 #1]  INFO -- : 
I, [2023-03-13T11:26:08.612768 #1]  INFO -- : > chown -R postgres:postgres /shared/postgres_data
I, [2023-03-13T11:26:09.223581 #1]  INFO -- : 
I, [2023-03-13T11:26:09.224698 #1]  INFO -- : > chown -R postgres:postgres /var/run/postgresql
I, [2023-03-13T11:26:09.227553 #1]  INFO -- : 
I, [2023-03-13T11:26:09.228389 #1]  INFO -- : > /root/upgrade_postgres
I, [2023-03-13T11:26:09.285168 #1]  INFO -- : 
I, [2023-03-13T11:26:09.285919 #1]  INFO -- : > rm /root/upgrade_postgres
I, [2023-03-13T11:26:09.288235 #1]  INFO -- : 
I, [2023-03-13T11:26:09.464138 #1]  INFO -- : Replacing data_directory = '/var/lib/postgresql/13/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-13T11:26:09.465421 #1]  INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-13T11:26:09.466207 #1]  INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-13T11:26:09.466702 #1]  INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-13T11:26:09.467257 #1]  INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-13T11:26:09.467687 #1]  INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-13T11:26:09.468143 #1]  INFO -- : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
I, [2023-03-13T11:26:09.761975 #1]  INFO -- : 
I, [2023-03-13T11:26:09.763351 #1]  INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-13T11:26:09.764536 #1]  INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-13T11:26:09.765473 #1]  INFO -- : Replacing (?-mix:#?log_min_duration_statement *=.*) with log_min_duration_statement = $db_log_min_duration_statement in /etc/postgresql/13/main/postgresql.conf
I, [2023-03-13T11:26:09.791036 #1]  INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres  peer in /etc/postgresql/13/main/pg_hba.conf
I, [2023-03-13T11:26:09.792174 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/13/main/pg_hba.conf
I, [2023-03-13T11:26:09.792950 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*::1\/128.*$) with host all all ::/0 md5 in /etc/postgresql/13/main/pg_hba.conf
I, [2023-03-13T11:26:09.793444 #1]  INFO -- : > HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main
I, [2023-03-13T11:26:09.795665 #1]  INFO -- : > sleep 5
I, [2023-03-13T11:26:14.820284 #1]  INFO -- : 
I, [2023-03-13T11:26:14.821311 #1]  INFO -- : > su postgres -c 'createdb discourse' || true
createdb: error: could not connect to database template1: connection to server on socket " /var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
	Is the server running locally and accepting connections on that socket?
I, [2023-03-13T11:26:21.603565 #1]  INFO -- : 
I, [2023-03-13T11:26:21.604284 #1]  INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2023-03-13 11:26:22.014 UTC [41] LOG:  starting PostgreSQL 13.10 (Debian 13.10-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2023-03-13 11:26:22.020 UTC [41] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-03-13 11:26:22.021 UTC [41] LOG:  listening on IPv6 address "::", port 5432
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
	Is the server running locally and accepting connections on that socket?
I, [2023-03-13T11:26:22.036057 #1]  INFO -- : 
I, [2023-03-13T11:26:22.039351 #1]  INFO -- : > su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true
2023-03-13 11:26:22.047 UTC [41] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-03-13 11:26:22.723 UTC [53] LOG:  database system was shut down at 2023-03-13 10:30:34 UTC
2023-03-13 11:26:22.754 UTC [54] postgres@discourse FATAL:  the database system is starting up
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  the database system is starting up
I, [2023-03-13T11:26:22.757656 #1]  INFO -- : 
I, [2023-03-13T11:26:22.758335 #1]  INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
2023-03-13 11:26:22.811 UTC [58] postgres@discourse FATAL:  the database system is starting up
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  the database system is starting up
I, [2023-03-13T11:26:22.814281 #1]  INFO -- : 
I, [2023-03-13T11:26:22.815016 #1]  INFO -- : Terminating async processes
I, [2023-03-13T11:26:22.815325 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 41
2023-03-13 11:26:22.815 UTC [41] LOG:  received fast shutdown request
2023-03-13 11:26:22.928 UTC [61] LOG:  shutting down
2023-03-13 11:26:22.971 UTC [41] LOG:  database system is shut down


FAILED
--------------------
Pups::ExecError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' failed with return #<Process::Status: pid 55 exit 2>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params "su postgres -c 'psql $db_name -c \"alter schema public owner to $db_user;\"'"
bootstrap failed with exit code 2
** 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.
0eed82a57ac12afa9bd1f7fe56c9d876fd06661813daa26f568dfc4bf3bd13e7

这是标准安装吗?

看起来 PostgreSQL 仍在启动。CPU 速度是不是很慢?

似乎 PostgreSQL 的配置可能使用了非标准端口。

尝试运行

ls -al /var/discourse/shared/standalone/postgres_run

在我的安装中,我看到

total 28
drwxrwxr-x  5 systemd-resolve input   4096 Jan 26 15:43 .
drwxr-xr-x 13 root            root    4096 Jan 27  2021 ..
drwxr-x---  2 lxd             mlocate 4096 Jun  8  2020 10-main.pg_stat_tmp
drwxr-x---  2 lxd             mlocate 4096 Jan 27  2021 12-main.pg_stat_tmp
drwxr-xr-x  2 systemd-resolve input   4096 Mar 14 15:06 13-main.pg_stat_tmp
-rw-r--r--  1 systemd-resolve input      4 Jan 26 15:43 13-main.pid
srwxrwxrwx  1 systemd-resolve input      0 Mar 14 15:06 .s.PGSQL.5432
-rw-------  1 systemd-resolve input     62 Mar 14 15:06 .s.PGSQL.5432.lock

@Ed_S
这是标准安装,没有修改任何配置。

@pfaffman
是的,这是按照 discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub 进行的标准安装。

我已经找出为什么它不起作用的原因了,这与 Let’s Encrypt 有关。

它可能被速率限制了,因此无法颁发 SSL 证书。

我不得不禁用 app.yaml 中的 letsencrypt,并使用我自己的 SSL 证书/密钥组合,然后重新构建。

现在它运行完美,恢复了数据并完成了服务器迁移。

1 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.