fix(deploy): recreate web after api release
Deploy / Build Production Runtime Images (push) Successful in 8m48s
Deploy / Deploy Production (push) Successful in 38s
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been cancelled
Deploy / Deploy Staging (push) Has been cancelled

This commit is contained in:
Xiaoxia AI
2026-06-22 20:07:16 +08:00
parent cb2e20ffd4
commit 4c396b2a7b
2 changed files with 25 additions and 1 deletions
+4 -1
View File
@@ -77,5 +77,8 @@ docker compose --env-file "$ENV_FILE" run --rm --no-deps api sh -c '
python /app/scripts/validate_release_env.py --from-environ --strict-external &&
alembic upgrade head
'
docker compose --env-file "$ENV_FILE" up -d api worker web
docker compose --env-file "$ENV_FILE" up -d api worker
# Recreate web after API so nginx resolves the current API container IP.
# Docker's embedded DNS is resolved by nginx at startup for this static upstream.
docker compose --env-file "$ENV_FILE" up -d --force-recreate web
docker compose --env-file "$ENV_FILE" ps
+21
View File
@@ -44,6 +44,27 @@ def test_deploy_production_uses_production_infra_and_project():
assert "--env-file \"$ENV_FILE\"" in script
assert "python /app/scripts/validate_release_env.py --from-environ --strict-external" in script
assert "alembic upgrade head" in script
assert "docker compose --env-file \"$ENV_FILE\" up -d api worker" in script
assert "docker compose --env-file \"$ENV_FILE\" up -d --force-recreate web" in script
assert "nginx resolves the current API container IP" in script
def test_production_deploy_recreates_web_after_api_for_nginx_dns():
script = Path("infra/docker/deploy-production.sh").read_text(encoding="utf-8")
api_up = script.index('docker compose --env-file "$ENV_FILE" up -d api worker')
web_up = script.index('docker compose --env-file "$ENV_FILE" up -d --force-recreate web')
assert api_up < web_up
assert "up -d api worker web" not in script
def test_production_nginx_static_upstream_requires_web_recreate():
config = Path("infra/docker/nginx-production.conf").read_text(encoding="utf-8")
script = Path("infra/docker/deploy-production.sh").read_text(encoding="utf-8")
assert "proxy_pass http://xiaoxia-api-production:8000/api/;" in config
assert "--force-recreate web" in script
def test_production_infra_uses_separate_containers_and_ports():