mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-07 05:11:51 +08:00
fix(compose): pin internal network name so :8787 is never published via the sandbox bridge
Docker picks a multi-network container's default route and published-port target by network name order. With the project dir named ARTEX the generated artex_artex-internal sorts after artex-sandbox, so 8787/8788 were DNATed to the sandbox bridge: unreachable from other hosts, and host-local requests looked like sandbox traffic (403). Name the network artex-internal, warn when a custom ARTEX_SANDBOX_NETWORK would sort before it, and prefer the exact name in the firewall script.
This commit is contained in:
1 parent
fd0ba5052c
commit
ffd4dc9a17
5 files changed
+30
-3
No files matched your search
@@ -464,4 +464,16 @@ assert_eq "$(cat "$STATE_STUB/images/artex-rollback_gateway_${snap}" 2>/dev/null
|
||||
grep -q 'up -d --remove-orphans --no-build' "$REPO_ROOT/scripts/deploy-lib.sh" || fail "rollback compose up must use --no-build"
|
||||
pass "rollback without gateway snapshot falls back to local target-version gateway"
|
||||
|
||||
# 6. Internal network has a fixed name that sorts before the sandbox network
|
||||
# (Docker picks the default route / published-port target by network name order).
|
||||
awk '/^networks:/{n=1} n && /^ artex-internal:/{f=1} f && /name: artex-internal/{ok=1} END{exit !ok}' "$REPO_ROOT/docker-compose.yml" \
|
||||
|| fail "docker-compose.yml must pin networks.artex-internal.name: artex-internal"
|
||||
first="$(printf 'artex-sandbox\nartex-internal\n' | LC_ALL=C sort | head -n 1)"
|
||||
assert_eq "$first" "artex-internal" "artex-internal sorts before default sandbox network name"
|
||||
WARN_DIR="$TMP_DIR/netname"; mkdir -p "$WARN_DIR"
|
||||
printf 'ARTEX_SANDBOX_NETWORK=aaa-sandbox\nPOSTGRES_PASSWORD=x\n' > "$WARN_DIR/.env"
|
||||
(cd "$WARN_DIR" && . "$REPO_ROOT/scripts/deploy-lib.sh" && prepare_env_for_docker v0.3.35 .env) >/dev/null 2>"$TMP_DIR/netname.err" || true
|
||||
assert_contains "$TMP_DIR/netname.err" "aaa-sandbox" "warns when custom sandbox network sorts before artex-internal"
|
||||
pass "fixed internal network name keeps :8787 off the sandbox bridge"
|
||||
|
||||
echo "ALL DEPLOY/UPGRADE/ROLLBACK TESTS PASSED"
|
||||
Reference in new issue
Block a user