worker compose: run node-agent in host network mode

The agent now uses network_mode: host so os.hostname() and the network
interface list reflect the actual host instead of a per-container random
hex hostname (root cause of duplicate Zampp2 rows) and a 172.x docker
bridge IP. Also passes NODE_IP and BMD_MODEL through for explicit overrides.
This commit is contained in:
Zac Gaetano 2026-05-21 00:14:33 -04:00
parent 049beb8818
commit 40a66bae03

View file

@ -6,10 +6,12 @@
# Required env vars (set in .env.worker or export before running): # Required env vars (set in .env.worker or export before running):
# MAM_API_URL URL of the primary MAM API e.g. http://10.0.0.25:47432 # MAM_API_URL URL of the primary MAM API e.g. http://10.0.0.25:47432
# NODE_TOKEN Bearer token from the primary's Tokens page # NODE_TOKEN Bearer token from the primary's Tokens page
# NODE_IP Host LAN IP to report (set by onboard-node.sh)
# #
# Optional hardware overrides (if Docker can't see /dev directly): # Optional hardware overrides (if Docker can't see /dev directly):
# GPU_COUNT Number of NVIDIA GPUs on this node (default: auto-detect from /dev/nvidia*) # GPU_COUNT Number of NVIDIA GPUs on this node (default: auto-detect from /dev/nvidia*)
# BMD_COUNT Number of Blackmagic DeckLink cards (default: auto-detect from /dev/blackmagic/) # BMD_COUNT Number of Blackmagic DeckLink cards (default: auto-detect from /dev/blackmagic/)
# BMD_MODEL Marketed card name (e.g. "DeckLink Duo 2") — drives the port-diagram UI
# #
# Optional env vars (needed only if starting the worker or capture profiles): # Optional env vars (needed only if starting the worker or capture profiles):
# REDIS_URL, DATABASE_URL, S3_ENDPOINT, S3_BUCKET, S3_ACCESS_KEY, S3_SECRET_KEY # REDIS_URL, DATABASE_URL, S3_ENDPOINT, S3_BUCKET, S3_ACCESS_KEY, S3_SECRET_KEY
@ -18,40 +20,35 @@
# #
# Profiles: # Profiles:
# (default) node-agent only — cluster visibility + hardware heartbeat # (default) node-agent only — cluster visibility + hardware heartbeat
# --profile worker + CPU job worker (proxy generation, transcoding) # --profile worker + CPU/GPU job worker (proxy generation, transcoding)
# --profile capture + SDI capture service (requires Blackmagic DeckLink card) # --profile capture + SDI capture service (requires Blackmagic DeckLink card)
# #
# To enable GPU transcoding, also apply docker-compose.gpu.yml: # To enable GPU transcoding, also apply docker-compose.gpu.yml:
# docker compose -f docker-compose.worker.yml -f docker-compose.gpu.yml --profile worker up -d # docker compose -f docker-compose.worker.yml -f docker-compose.gpu.yml --profile worker up -d
#
# Examples:
# # Agent only (register node in cluster, report hardware):
# docker compose -f docker-compose.worker.yml up -d
#
# # SDI capture node (1 DeckLink, no GPU worker):
# docker compose -f docker-compose.worker.yml --profile capture up -d
#
# # Full node (GPU worker + SDI capture):
# docker compose -f docker-compose.worker.yml -f docker-compose.gpu.yml \
# --profile worker --profile capture up -d
services: services:
# node-agent runs in host network mode so it can see the real host
# interfaces, GPU devices and DeckLink cards without bridging tricks.
# The reported IP / hostname will be the host's, not the container's.
node-agent: node-agent:
build: ./services/node-agent build: ./services/node-agent
restart: unless-stopped restart: unless-stopped
network_mode: host
environment: environment:
MAM_API_URL: ${MAM_API_URL} MAM_API_URL: ${MAM_API_URL}
NODE_TOKEN: ${NODE_TOKEN:-} NODE_TOKEN: ${NODE_TOKEN:-}
NODE_ROLE: ${NODE_ROLE:-worker} NODE_ROLE: ${NODE_ROLE:-worker}
AGENT_PORT: 3002 NODE_IP: ${NODE_IP:-}
AGENT_PORT: ${AGENT_PORT:-7436}
HEARTBEAT_MS: ${HEARTBEAT_MS:-30000} HEARTBEAT_MS: ${HEARTBEAT_MS:-30000}
GPU_COUNT: ${GPU_COUNT:--1} GPU_COUNT: ${GPU_COUNT:--1}
BMD_COUNT: ${BMD_COUNT:--1} BMD_COUNT: ${BMD_COUNT:--1}
ports: BMD_MODEL: ${BMD_MODEL:-}
- "${AGENT_PORT:-7436}:3002" devices:
networks: - /dev/blackmagic:/dev/blackmagic
- wild-dragon-worker volumes:
- /dev:/dev:ro
worker: worker:
build: ./services/worker build: ./services/worker