clouddreamai-cicd-setup 1.5.40 → 1.5.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/scripts/deploy.sh +10 -0
package/package.json
CHANGED
|
@@ -399,7 +399,17 @@ create_database() {
|
|
|
399
399
|
PG_RESTART_NEEDED=true
|
|
400
400
|
fi
|
|
401
401
|
|
|
402
|
+
# 检查 PostgreSQL 是否有共享内存错误(测试连接)
|
|
403
|
+
if ! sudo -u postgres $PSQL_CMD -c "SELECT 1" >/dev/null 2>&1; then
|
|
404
|
+
echo "检测到 PostgreSQL 连接异常,需要重启..."
|
|
405
|
+
PG_RESTART_NEEDED=true
|
|
406
|
+
fi
|
|
407
|
+
|
|
402
408
|
if [ "$PG_RESTART_NEEDED" = true ]; then
|
|
409
|
+
# 先停掉旧容器,避免 PostgreSQL 重启后出现共享内存错误
|
|
410
|
+
echo "停止旧容器(如果存在)..."
|
|
411
|
+
docker container ls -q --filter "name=$APP_NAME" | xargs -r docker container stop 2>/dev/null || true
|
|
412
|
+
|
|
403
413
|
echo "重启 PostgreSQL 服务..."
|
|
404
414
|
# 宝塔 PostgreSQL 需要用 postgres 用户重启,且必须用 restart 而非 reload 才能让 listen_addresses 生效
|
|
405
415
|
if [ -x "/www/server/pgsql/bin/pg_ctl" ]; then
|