升级到3.3对我来说失败了

我尝试通过 UI 进行升级,但失败了,具体情况请参见:

因此,我从备份中恢复了我的 droplet,然后尝试手动升级。

cd /var/discourse
git pull
./launcher rebuild app

这会产生以下输出:

WARNING: Docker version 20.10.7 deprecated, recommend upgrade to 24.0.7 or newer.
x86_64 arch detected.

WARNING: We are about to start downloading the Discourse base image
This process may take anywhere between a few minutes to an hour, depending on your network speed

Please be patient

2.0.20240825-0027: Pulling from discourse/base
e4fff0779e6d: Pulling fs layer 
04dda0e597e7: Pulling fs layer 
0b0ac7902d91: Pulling fs layer 
1ea0327cd622: Waiting 
459f11cf96b2: Waiting 
cd49b55154ee: Waiting 
4f4fb700ef54: Pull complete 
890a63bee26b: Pull complete 
1d239a1092e9: Pull complete 
7439767d748f: Pull complete 
19e63282f9d1: Pull complete 
6da4866029f1: Pull complete 
3274548c87f4: Pull complete 
fb2589b81eef: Pull complete 
da453ab7ba03: Pull complete 
260969aca4e8: Pull complete 
0c7927423a10: Pull complete 
cfdfd8bdc03e: Pull complete 
f837c184a2c0: Pull complete 
d14903daf553: Pull complete 
01422fc4dc02: Pull complete 
e918b15c8f19: Pull complete 
3202b43401af: Pull complete 
3fa0a48e923e: Pull complete 
2f1f96b416a1: Pull complete 
b5376d8069b5: Pull complete 
259e102648be: Pull complete 
807236570b2a: Pull complete 
e98845c05b05: Pull complete 
578a5e3e249f: Pull complete 
6b0bf88c86e8: Pull complete 
9551a14ee15e: Pull complete 
8bbcc4c7a11d: Pull complete 
5aff35532071: Pull complete 
f73f45300530: Pull complete 
42888ce727c0: Pull complete 
e8467a663928: Pull complete 
d2fb91f4643c: Pull complete 
88fc9778a448: Pull complete 
2a19d28a5a17: Pull complete 
6a2d56837370: Pull complete 
933885f686e0: Pull complete 
aecf6df6a6bb: Pull complete 
33fcdcfe61e2: Pull complete 
12726a4d34c8: Pull complete 
Digest: sha256:6de68cb49198b5281f79ed9401b3fe818c854d220dcf0238549fe2f2adb19146
Status: Downloaded newer image for discourse/base:2.0.20240825-0027
docker.io/discourse/base:2.0.20240825-0027
WARNING: containers/app.yml file is world-readable. You can secure this file by running: chmod o-rwx containers/app.yml
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 600 app
app
2.0.20240825-0027: Pulling from discourse/base
Digest: sha256:6de68cb49198b5281f79ed9401b3fe818c854d220dcf0238549fe2f2adb19146
Status: Image is up to date for discourse/base:2.0.20240825-0027
docker.io/discourse/base:2.0.20240825-0027
/usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2024-10-15T06:14:37.390458 #1]  INFO -- : Reading from stdin
I, [2024-10-15T06:14:37.395803 #1]  INFO -- : > echo cron is now included in base image, remove from templates
I, [2024-10-15T06:14:37.398391 #1]  INFO -- : cron is now included in base image, remove from templates

I, [2024-10-15T06:14:37.408024 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown: 
I, [2024-10-15T06:14:37.412237 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown: 
I, [2024-10-15T06:14:37.416506 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown: 
I, [2024-10-15T06:14:37.420758 #1]  INFO -- : File > /root/install_postgres  chmod: +x  chown: 
I, [2024-10-15T06:14:37.424824 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown: 
I, [2024-10-15T06:14:37.425837 #1]  INFO -- : Replacing data_directory = '/var/lib/postgresql/13/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/13/main/postgresql.conf
I, [2024-10-15T06:14:37.426590 #1]  INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/13/main/postgresql.conf
I, [2024-10-15T06:14:37.427073 #1]  INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/13/main/postgresql.conf
I, [2024-10-15T06:14:37.427713 #1]  INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/13/main/postgresql.conf
I, [2024-10-15T06:14:37.428194 #1]  INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/13/main/postgresql.conf
I, [2024-10-15T06:14:37.428633 #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, [2024-10-15T06:14:37.429175 #1]  INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/13/main/postgresql.conf
I, [2024-10-15T06:14:37.429569 #1]  INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/13/main/postgresql.conf
I, [2024-10-15T06:14:37.430001 #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, [2024-10-15T06:14:37.430562 #1]  INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres  peer in /etc/postgresql/13/main/pg_hba.conf
I, [2024-10-15T06:14:37.430964 #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, [2024-10-15T06:14:37.431353 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*::1\\/128.*$) with host all all ::/0 md5 in /etc/postgresql/13/main/pg_hba.conf
I, [2024-10-15T06:14:37.431673 #1]  INFO -- : > if [ -f /root/install_postgres ]; then
  /root/install_postgres && rm -f /root/install_postgres
elif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then
  socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
fi

I, [2024-10-15T06:14:37.974529 #1]  INFO -- : Generating locales (this might take a while)...
Generation complete.

I, [2024-10-15T06:14:37.975013 #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, [2024-10-15T06:14:37.976577 #1]  INFO -- : Terminating async processes
2024-10-15 06:14:38.136 UTC [36] LOG:  starting PostgreSQL 13.16 (Debian 13.16-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2024-10-15 06:14:38.138 UTC [36] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-10-15 06:14:38.139 UTC [36] LOG:  listening on IPv6 address "::", port 5432
2024-10-15 06:14:38.143 UTC [36] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-10-15 06:14:38.154 UTC [37] LOG:  database system was shut down at 2024-10-15 06:14:28 UTC
2024-10-15 06:14:38.176 UTC [36] LOG:  database system is ready to accept connections

此时升级停止,之后没有任何进展,并且服务器离线(完全没有网络连接)。

接下来我应该尝试什么?

UI 升级需要更多内存,因为您可能同时运行网站和重建。

确保您有足够的交换空间来应对——至少与您的 RAM 一样多。

因此,在 4GB 服务器上,请确保您有 4GB 交换空间。

顺便说一句,这里的 git pull 是多余的。构建脚本会为您处理。

1 个赞

我的服务器有 4GB 内存和 4GB 交换空间。重建过程在 database system is ready to accept connections 处停止,未能完成,论坛仍然无法访问。我可以将其恢复到 Droplet 备份(再次),这将使我回到一个可用的 3.2 论坛,但最好能解决这个问题。

# free
              total        used        free      shared  buff/cache   available
Mem:           3919         286        1443          20        2189        3360
Swap:          4095           2        4093
Total:         8015         288        5537
2 个赞

在这种情况下,我通常会(自行承担风险)重启,但这还没有让我失望。至少这样可以使网站恢复运行。

确保您的操作系统是相对较新的 LTS 版本,并且那个 Docker 警告似乎值得注意。

重建期间使用 htop 监控您的内存以确保安全?

看起来有很多交换空间。 :+1:

2 个赞

我的操作系统是 Ubuntu 20.04.6 LTS。

嗯。好的,我重启了,论坛又恢复了。

啊,但它仍然显示已安装 3.2.4,最新版本是 3.3.2,所以它没有更新。

所以我不知道该怎么办。我会再试一次更新。

是的,它在同一个地方停止了。我猜更新一个更新版本的 Docker 需要更新 Ubuntu 的主版本,我想我可以这样做,只是我当时没有计划这样做。

建议更新您的操作系统和 Docker 以确保万无一失。

构建脚本有时会在各个节点出现长时间延迟。多长时间算长时间?

2 个赞

我回来时它卡在了那个点,过了 15-20 分钟。从那以后我没有特别等待过。它可能只是在执行某些操作,但没有任何证据表明这一点。没有任何东西占用可观的 CPU。

1 个赞

此时您有两个选择:

  • 就地升级操作系统和 Docker - 然后重试
  • 新的 Droplet。

后者可能更快。

嗯,我有一个当前的快照,我想此时进行 Ubuntu 升级应该不会有什么坏处,我总可以撤销所有操作。

1 个赞

哎呀,它拒绝了,因为

抱歉,较新内核不支持此存储驱动程序
版本

aufs 存储驱动程序的内核支持将不再提供任何进一步的 Ubuntu 版本。

请确保您的任何容器均未使用 aufs 存储驱动程序,删除目录 /var/lib/docker/aufs 并重试。

唉。事情从来都不是一帆风顺的,不是吗?

2 个赞

新的 Droplet。 :).\n\nSteps involved to downgrade from 2GB to 1GB on DO? - #3 by merefield swap)

3 个赞

好的,整个升级过程可以说是彻底失败了。

我将把服务器恢复到之前的状态(Ubuntu 20.04.6 LTS 和 Discord 3.2.4),然后装作什么都没发生,暂时忘记 3.3 版本,改天再尝试。

感谢你的帮助。

2 个赞

附加功能 - 当我恢复液滴时,不知何故我会被注销 - 即使在网站处于只读模式下,您也无法登录,即使是管理员!

1 个赞

我刚想到,我无法将 Docker 切换到 overlay2,如 (Change the Docker storage backend) 中所述,以便能够更新 Ubunto,因为切换到 overlay 将需要 ./launcher rebuild app,而这会失败(除非切换到 overlay2 能解决问题,但这本身似乎不太可能)。因此,迁移到新的液滴似乎是唯一可行的方法,尽管这可能需要更改 DNS,而这通常非常缓慢。唉。

1 个赞

您也许可以通过以下方式重启容器:

  docker start app

您也许还可以通过以下方式解决问题:

 apt install docker-ce docker-ce-cli

不确定 overlay 的问题。您是否曾从旧版 Ubuntu 进行过操作系统升级?

如果您使用的是 digital ocean,您可以创建一个指向旧服务器的静态 IP,然后更新 DNS 指向它。然后,当您迁移到新服务器时,由于您可以将 IP 重定向到新服务器,因此不会有 DNS 延迟。

2 个赞

是的,这重启了容器,但没有进行任何升级。

我不知道在“数据库系统已准备好接受连接”之后升级过程会发生什么,但它最多只能到这一步,然后就再无进展(除非下一步需要很长时间)。

是的,Ubuntu 之前已经更新过。所以 Docker 一直都基于 aufs。

是否可以在不升级的情况下重建?如果那样可行,那么我或许可以把当前的 Docker 从 aufs 切换到 overlay2,然后这可能意味着我可以将 Ubuntu 升级到 22,这或许能让其他东西正常工作——但目前我不知道为什么升级会在那个点停滞不前,所以这基本上只是希望有什么能解决它。

不可以,它将升级到指定分支上的最新提交。

请记住,迁移到新服务器可能只需要 30 分钟。

是的,看来我必须走这条路了——别怪我多愁善感,但我真的不想仅仅为了升级论坛就得设置一个全新的服务器(该服务器除了 Discourse 之外还运行着其他一些东西,这些东西也必须迁移)。

唉,这就是任何运行自己服务器的人的生活。

2 个赞

是的,它似乎就是卡在那里,不知何故。我不知道为什么,但进行 docker 升级似乎帮助了几个站点。

你有没有尝试过我上面提到的升级 docker?

如果你尝试在别处搜索,你或许可以修复 overlay。这就是为什么我不信任操作系统升级。

我还没有,但我会尝试上面提到的方法——我需要安排另一次维护时段——我的流程总是先关闭 droplet,然后进行快照,这需要相当长的时间,也是停机时间最长的部分,但可以确保我能非常轻松地回滚,这在几次情况下都很有用。

所以,我将在周二安排另一个维护窗口,然后尝试更新 docker(如果成功,我还会尝试切换到 overlay)。如果失败,我将在下周尝试使用新服务器(或者我可能会并行进行,因为我可以在测试 droplet 上设置一个新服务器)。

谢谢。