discourse基本每年都会对数据库的版本做一次大的升级
之前因为备份数据和数据库版本没有对应起来,导致备份数据恢复异常,在构建容器时,postgres.15.template.yml模板中的15为数据库的版本
升级过程中需要根据历史模板按顺序依次构建容器,无法越版本升级构建,需要依次使用以下模板构建容器
本次升级从13->15升级,如果小于13的数据库,原理一致
postgres.13.template.yml
postgres.15.template.yml
postgres.template.yml
docker镜像使用discourse/base:2.0.20250129-0720版本
如果使用的是中国网络,postgres.13.template.yml、postgres.15.template.yml做配置做apt中国网络加速
run:
- exec: cat /etc/os-release && psql --version
- exec: |
if [ -f /etc/apt/sources.list ]; then
sudo sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
else
echo "deb http://mirrors.ustc.edu.cn/debian bookworm main contrib non-free non-free-firmware" | sudo tee /etc/apt/sources.list
echo "deb http://mirrors.ustc.edu.cn/debian bookworm-updates main contrib non-free non-free-firmware" | sudo tee -a /etc/apt/sources.list
fi
- exec: |
if [ -f /etc/apt/sources.list.d/debian.sources ]; then
sudo sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources
else
sudo bash -c 'cat > /etc/apt/sources.list.d/debian.sources <<EOF
URIs: http://mirrors.ustc.edu.cn/debian
Suites: bookworm bookworm-updates
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb
URIs: http://mirrors.ustc.edu.cn/debian-security
Suites: bookworm-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOF'
fi
- exec: cat /etc/apt/sources.list && cat /etc/apt/sources.list.d/debian.sources

