fix: keep Admin BaoTa proxy stable #9

Merged
admin merged 1 commits from release/test into main 2026-09-20 23:41:52 +08:00
2 changed files with 7 additions and 3 deletions
+3 -3
View File
@@ -62,12 +62,12 @@ compose() {
case "$service" in
admin-web)
base_port=9001
nginx_config=/www/server/panel/vhost/nginx/admin.buggoglobal.com.conf
nginx_config=/www/server/panel/vhost/nginx/00-blue-green-admin-web.conf
legacy_container=firstleg-prod-admin-web
;;
client-web)
base_port=9002
nginx_config=/www/server/panel/vhost/nginx/app.buggoglobal.com.conf
nginx_config=/www/server/panel/vhost/nginx/00-blue-green-client-web.conf
legacy_container=firstleg-prod-client-web
;;
*) echo "不支持蓝绿部署的前端服务: $service" >&2; exit 2 ;;
@@ -102,7 +102,7 @@ fi
if [ "$active_slot" = blue ]; then target_slot=green; else target_slot=blue; fi
[ "$active_slot" = legacy ] && target_slot=green
if [ "$target_slot" = blue ]; then target_port="$base_port"; else target_port=$((base_port + 10000)); fi
if [ "$target_slot" = blue ]; then target_port=$((base_port + 20000)); else target_port=$((base_port + 10000)); fi
candidate="${legacy_container}-${target_slot}"
docker rm -f "$candidate" >/dev/null 2>&1 || true
@@ -15,7 +15,11 @@ test('production frontend starts and validates the candidate before switching ng
})
test('production frontend supports both slots and restores nginx on failure', () => {
assert.match(script, /target_port=\$\(\(base_port \+ 20000\)\)/)
assert.match(script, /target_port=\$\(\(base_port \+ 10000\)\)/)
assert.match(script, /00-blue-green-admin-web\.conf/)
assert.match(script, /00-blue-green-client-web\.conf/)
assert.doesNotMatch(script, /nginx_config=\/www\/server\/panel\/vhost\/nginx\/(?:admin|app)\.buggoglobal\.com\.conf/)
assert.match(script, /cp -f "\$nginx_config" "\$backup"/)
assert.match(script, /cp -f "\$backup" "\$nginx_config"/)
assert.match(script, /docker rm -f "\$candidate"/)