Skip to content

Commit 8ca37c8

Browse files
committed
fix(extensions): bind community extension ports via ${BIND_ADDRESS}
Twenty-nine community extensions in resources/dev/extensions-library/ hardcoded `127.0.0.1:` on `ports:` entries, so setting BIND_ADDRESS=0.0.0.0 (via --lan flag, dashboard network-mode toggle, or .env) only exposed core services to the LAN. Community extensions remained loopback-only regardless of user intent. Rewrite 35 port-lines across 29 files to use the established pattern from PR #964: before: "127.0.0.1:${EXT_PORT:-NNNN}:NNNN" after: "${BIND_ADDRESS:-127.0.0.1}:${EXT_PORT:-NNNN}:NNNN" Default behaviour unchanged (loopback by default; user opt-in via BIND_ADDRESS=0.0.0.0 now works correctly). Healthcheck URLs inside `healthcheck:` blocks are intentionally preserved — those are container-internal loopback and should stay literal. Add tests/test-bind-address-sweep.sh to prevent regression, wired into the `test:` target of dream-server/Makefile (and inherited by `gate:` via `gate: lint test bats smoke simulate`).
1 parent d5154c3 commit 8ca37c8

31 files changed

Lines changed: 87 additions & 35 deletions

File tree

dream-server/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ test: ## Run unit and contract tests
3333
@echo "=== Overlay/plist contracts ==="
3434
@bash tests/contracts/test-overlay-map-coherence.sh
3535
@bash tests/contracts/test-plist-log-paths.sh
36+
@echo ""
37+
@echo "=== Bind address sweep ==="
38+
@bash tests/test-bind-address-sweep.sh
3639

3740
bats: ## Run BATS unit tests for shell libraries
3841
@echo "=== BATS unit tests ==="
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
# ============================================================================
3+
# Test: community extensions port-binding sweep
4+
# ============================================================================
5+
# Regression guard for PR #964 follow-up: every community extension compose
6+
# file under resources/dev/extensions-library/services/ must bind its host
7+
# ports via ${BIND_ADDRESS:-127.0.0.1} — never a bare "127.0.0.1:" literal.
8+
# A hard-coded 127.0.0.1 defeats the --lan / dashboard opt-in that flips
9+
# BIND_ADDRESS to 0.0.0.0.
10+
#
11+
# Scope: ports: list entries only. healthcheck: blocks reference 127.0.0.1
12+
# as container-internal loopback and are excluded.
13+
#
14+
# Usage: bash tests/test-bind-address-sweep.sh
15+
# ============================================================================
16+
17+
set -euo pipefail
18+
19+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
20+
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
21+
REPO_ROOT="$(cd "$ROOT_DIR/.." && pwd)"
22+
23+
EXT_DIR="$REPO_ROOT/resources/dev/extensions-library/services"
24+
25+
GREEN='\033[0;32m'
26+
RED='\033[0;31m'
27+
NC='\033[0m'
28+
29+
if [[ ! -d "$EXT_DIR" ]]; then
30+
echo -e " ${RED}FAIL${NC} community extensions directory missing: $EXT_DIR"
31+
exit 1
32+
fi
33+
34+
# Match lines that start a ports entry with a literal 127.0.0.1, quoted or not.
35+
# Healthcheck URLs live on `test:` lines and never start with `- "127.0.0.1:`
36+
# or `- 127.0.0.1:`, so this pattern is specific to ports: entries.
37+
OFFENDERS="$(grep -REn '^\s*-\s*"?127\.0\.0\.1:' "$EXT_DIR" --include='compose.yaml' || true)"
38+
39+
if [[ -n "$OFFENDERS" ]]; then
40+
echo -e " ${RED}FAIL${NC} community extensions still bind to literal 127.0.0.1 in ports:"
41+
echo "$OFFENDERS"
42+
echo ""
43+
echo " Use the BIND_ADDRESS pattern instead, e.g.:"
44+
echo ' - "${BIND_ADDRESS:-127.0.0.1}:${EXT_PORT:-NNNN}:NNNN"'
45+
exit 1
46+
fi
47+
48+
echo -e " ${GREEN}PASS${NC} no literal 127.0.0.1 ports bindings in community extensions"
49+
exit 0

resources/dev/extensions-library/services/anythingllm/compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
volumes:
2525
- ./data/anythingllm:/app/server/storage:rw
2626
ports:
27-
- "127.0.0.1:${ANYTHINGLLM_PORT:-7800}:3001"
27+
- "${BIND_ADDRESS:-127.0.0.1}:${ANYTHINGLLM_PORT:-7800}:3001"
2828
healthcheck:
2929
test: ["CMD", "curl", "-sf", "http://127.0.0.1:3001/api/health"]
3030
interval: 30s

resources/dev/extensions-library/services/audiocraft/compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ services:
1414
- ./data/audiocraft:/app/outputs:rw
1515
- ./data/audiocraft/models:/root/.cache/audiocraft:rw
1616
ports:
17-
- "127.0.0.1:${AUDIOCRAFT_PORT:-7863}:7860"
17+
- "${BIND_ADDRESS:-127.0.0.1}:${AUDIOCRAFT_PORT:-7863}:7860"
1818
healthcheck:
1919
test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:7860/"]
2020
interval: 30s

resources/dev/extensions-library/services/bark/compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
security_opt:
99
- no-new-privileges:true
1010
ports:
11-
- "127.0.0.1:${BARK_PORT:-9200}:9200"
11+
- "${BIND_ADDRESS:-127.0.0.1}:${BARK_PORT:-9200}:9200"
1212
environment:
1313
# Use small models (faster, less VRAM) — set to false for full quality
1414
- SUNO_USE_SMALL_MODELS=${BARK_USE_SMALL_MODELS:-false}

resources/dev/extensions-library/services/baserow/compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ services:
3535
volumes:
3636
- ./data/baserow:/baserow/data:rw
3737
ports:
38-
- "127.0.0.1:${BASEROW_PORT:-3007}:80"
38+
- "${BIND_ADDRESS:-127.0.0.1}:${BASEROW_PORT:-3007}:80"
3939
networks:
4040
- dream-network
4141
healthcheck:

resources/dev/extensions-library/services/chromadb/compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33
image: chromadb/chroma:1.5.3
44
container_name: dream-chromadb
55
ports:
6-
- "127.0.0.1:${CHROMADB_PORT:-8000}:8000"
6+
- "${BIND_ADDRESS:-127.0.0.1}:${CHROMADB_PORT:-8000}:8000"
77
volumes:
88
- ./data/chromadb:/chromadb
99
environment:

resources/dev/extensions-library/services/continue/compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ services:
2525
- ./config/continue/nginx.conf:/etc/nginx/conf.d/default.conf:ro
2626
- ./config/continue/entrypoint.sh:/docker-entrypoint.d/50-continue-init.sh:ro
2727
ports:
28-
- "127.0.0.1:${CONTINUE_PORT:-8890}:8080"
28+
- "${BIND_ADDRESS:-127.0.0.1}:${CONTINUE_PORT:-8890}:8080"
2929
networks:
3030
- dream-network
3131
healthcheck:

resources/dev/extensions-library/services/crewai/compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ services:
4040
# App data (SQLite DB, crew configs, history) lives under /app in the container
4141
- ./data/crewai:/app:rw
4242
ports:
43-
- "127.0.0.1:${CREWAI_PORT:-8501}:8501"
43+
- "${BIND_ADDRESS:-127.0.0.1}:${CREWAI_PORT:-8501}:8501"
4444
healthcheck:
4545
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8501/')"]
4646
interval: 30s

resources/dev/extensions-library/services/flowise/compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ services:
2020
volumes:
2121
- ./data/flowise:/root/.flowise:rw
2222
ports:
23-
- "127.0.0.1:${FLOWISE_PORT:-7801}:3000"
23+
- "${BIND_ADDRESS:-127.0.0.1}:${FLOWISE_PORT:-7801}:3000"
2424
healthcheck:
2525
test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:3000/api/v1/ping"]
2626
interval: 30s

0 commit comments

Comments
 (0)