feat(deploy): 为更新组件增加定时维护与双保险

This commit is contained in:
2026-10-08 09:23:25 +08:00
parent e3d760c5ab
commit 89a4ccd7e7
30 changed files with 796 additions and 7 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
set -euo pipefail
PROJECT_ROOT="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
. "$PROJECT_ROOT/scripts/init-security-env.sh"
[ "$(read_env_value "$PROJECT_ROOT/.env" INFRASTRUCTURE_AUTO_UPDATE_ENABLED)" != false ] || exit 0
image="$(read_env_value "$PROJECT_ROOT/.env" WATCHTOWER_IMAGE)"
if [ -z "$image" ] || [[ "$image" =~ ^registry\.cn-shanghai\.aliyuncs\.com/comfy-ai/watchtower-aliyun:[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
write_env_value "$PROJECT_ROOT/.env" WATCHTOWER_IMAGE registry.cn-shanghai.aliyuncs.com/comfy-ai/watchtower-aliyun:latest
fi
# Scope changes require the selected containers to receive matching labels.
# A targeted update must not strand unchanged containers outside the new scope.
image="$(read_env_value "$PROJECT_ROOT/.env" WATCHTOWER_IMAGE)"
target="$(read_env_value "$PROJECT_ROOT/.env" WATCHTOWER_UPDATE_TARGET)"
if [ -z "${UPDATE_SERVICES:-}" ] && [ -z "$(read_env_value "$PROJECT_ROOT/.env" WATCHTOWER_SCOPE)" ] && [ "$image" = registry.cn-shanghai.aliyuncs.com/comfy-ai/watchtower-aliyun:latest ]; then
case "$target" in
''|'easyai-updater'|'easyai-server easyai-wsgateway easyai-web')
write_env_value "$PROJECT_ROOT/.env" WATCHTOWER_SCOPE easyai
;;
esac
fi