优化
This commit is contained in:
@@ -15,8 +15,8 @@ COMPOSE_FILE="$6"
|
||||
BASE_PROJECT="$7"
|
||||
|
||||
case "$DEPLOY_ENV" in
|
||||
production) ;;
|
||||
*) echo "蓝绿执行器仅用于 production,当前: $DEPLOY_ENV" >&2; exit 2 ;;
|
||||
test|production) ;;
|
||||
*) echo "蓝绿执行器仅用于 test/production,当前: $DEPLOY_ENV" >&2; exit 2 ;;
|
||||
esac
|
||||
|
||||
for file in "$ENV_FILE" "$COMPOSE_FILE"; do
|
||||
@@ -224,6 +224,10 @@ bootstrap_legacy_routes() {
|
||||
|
||||
switch_gateway_proxy() {
|
||||
[ "$SERVICE" = "gateway" ] || [ "$SERVICE" = "gateway-overseas" ] || return 0
|
||||
if [ "$DEPLOY_ENV" = test ]; then
|
||||
echo "测试 Gateway 仍由固定入口承载,不在后端蓝绿执行器中切换" >&2
|
||||
return 1
|
||||
fi
|
||||
if [ "$SERVICE" = "gateway" ]; then required_alias=gateway-active; else required_alias=gateway-overseas-active; fi
|
||||
for frontend_service in admin-web client-web; do
|
||||
frontend_state="$STATE_ROOT/frontend-$frontend_service.active"
|
||||
@@ -267,6 +271,7 @@ switch_gateway_proxy() {
|
||||
|
||||
reload_frontend_proxies() {
|
||||
[ "$SERVICE" = "gateway" ] || [ "$SERVICE" = "gateway-overseas" ] || return 0
|
||||
[ "$DEPLOY_ENV" = production ] || return 0
|
||||
for frontend_service in admin-web client-web; do
|
||||
frontend_state="$STATE_ROOT/frontend-$frontend_service.active"
|
||||
[ -s "$frontend_state" ] || return 1
|
||||
@@ -279,6 +284,7 @@ reload_frontend_proxies() {
|
||||
|
||||
rollback_gateway_proxy() {
|
||||
[ "$SERVICE" = "gateway" ] || [ "$SERVICE" = "gateway-overseas" ] || return 0
|
||||
[ "$DEPLOY_ENV" = production ] || return 0
|
||||
if [ "$SERVICE" = "gateway" ]; then
|
||||
config="$(env_value GATEWAY_BLUE_GREEN_NGINX_CONFIG)"
|
||||
config="${config:-/www/server/panel/vhost/nginx/api-cn.buggoglobal.com.conf}"
|
||||
|
||||
Reference in New Issue
Block a user