Skip to content

Commit 4740be6

Browse files
fix: dashboard uses detected docker_gwbridge gateway instead of GATEWAY_IP
The dashboard nginx proxy was using GATEWAY_IP (10.42.24.1) to reach the API, which is only reachable when the AP is running. Switch to DOCKER_HOST_GW which points to the docker_gwbridge gateway — always reachable from Swarm containers regardless of network mode. Detection: docker network inspect docker_gwbridge at deploy time. Fallback: 172.16.1.1 (Docker's typical default). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent bef02a9 commit 4740be6

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

cubeos-dashboard/appconfig/docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ services:
1818
mode: host
1919
environment:
2020
- TZ=${TZ:-UTC}
21-
- API_URL=http://${GATEWAY_IP:-10.42.24.1}:6010
22-
- DOCS_URL=http://${GATEWAY_IP:-10.42.24.1}:6032
21+
# Use docker_gwbridge gateway — always reachable from Swarm containers
22+
# regardless of network mode (AP up/down, wifi_client, eth_client, etc.)
23+
- API_URL=http://${DOCKER_HOST_GW:-172.16.1.1}:${API_PORT:-6010}
24+
- DOCS_URL=http://${DOCKER_HOST_GW:-172.16.1.1}:${DOCS_INDEXER_PORT:-6032}
2325
env_file:
2426
- /cubeos/config/defaults.env
2527
deploy:

defaults.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ CUBEOS_COUNTRY_CODE=NL
1414
# Network Configuration
1515
# ===================
1616
GATEWAY_IP=10.42.24.1
17+
DOCKER_HOST_GW=172.16.1.1
1718
SUBNET=10.42.24.0/24
1819
DHCP_RANGE_START=10.42.24.10
1920
DHCP_RANGE_END=10.42.24.250

scripts/ci-restart.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@ if [ -f /cubeos/config/defaults.env ]; then
107107
echo "Sourced defaults.env (GATEWAY_IP=${GATEWAY_IP:-not set})"
108108
fi
109109

110+
# --- Detect docker_gwbridge gateway (runtime override) ---
111+
# docker_gwbridge subnet is assigned by Docker at Swarm init — not predictable.
112+
# Detect the actual gateway IP so compose files can route to host services.
113+
DETECTED_GW=$(docker network inspect docker_gwbridge \
114+
--format '{{(index .IPAM.Config 0).Gateway}}' 2>/dev/null) || true
115+
if [ -n "$DETECTED_GW" ]; then
116+
export DOCKER_HOST_GW="$DETECTED_GW"
117+
echo "Docker host gateway (detected): ${DOCKER_HOST_GW}"
118+
else
119+
echo "Docker host gateway (fallback): ${DOCKER_HOST_GW:-172.16.1.1}"
120+
fi
121+
110122
# --- Deploy COMPOSE apps ---
111123
for app in $COMPOSE_APPS; do
112124
COMPOSE_FILE="/cubeos/coreapps/${app}/appconfig/docker-compose.yml"

0 commit comments

Comments
 (0)