Files
Doghouse/CHANGES-0.1.2.md
2026-12-01 06:21:47 +11:00

8.6 KiB
Raw Permalink Blame History

Doghouse 0.1.2

Patch release on top of 0.1.1 (d01ed0b, tag v0.1.1). It fixes a LiveKit startup crash loop seen on Justin's server, moves LiveKit's media ports out of Linux's ephemeral range, and makes the Docker network configurable. There are no database or app changes. Branch release/0.1.2; no zip or tag yet (QA reviews first).

Upgrading from 0.1.1

Keep your existing deploy/.env and add the two new settings (see .env.example):

LIVEKIT_NODE_IP=<your public IP, from: curl -4 ifconfig.me>
DOGHOUSE_NETWORK=doghouse_net
  • If you edited docker-compose.yml to use your own network (e.g. homelab), set DOGHOUSE_NETWORK=homelab instead and use the new docker-compose.yml unedited. Never use network_mode:.
  • Then follow README "Upgrading 0.1.1 -> 0.1.2": back up ./data, replace the source files from the zip, and run docker compose up -d --build from deploy/.
  • Router and ufw: voice media moved to UDP 20000-20100. Forward UDP 20000-20100 to the server and remove the old UDP 50000-50100 forward. For ufw: sudo ufw allow 20000:20100/udp and sudo ufw delete allow 50000:50100/udp. TCP 7881 and UDP 3478 are unchanged.
  • Use the new docker-compose.yml and livekit.yaml; they must agree on the range. If you had edited livekit.yaml, re-apply your edits to the new file. npm-advanced.conf is unchanged.
  • If your home IP is dynamic, update LIVEKIT_NODE_IP when it changes, then run docker compose up -d livekit.

LiveKit crash loop: "could not resolve external IP"

Seen: on 0.1.1, doghouse-livekit restarts forever with could not validate RTC config: could not resolve external IP: dial udp: lookup stun1.l.google.com on 127.0.0.53:53: … connection refused and exited with code 0 (restarting). livekit.yaml has use_external_ip: true, so LiveKit must reach a STUN server at startup, and that container couldn't resolve DNS. 127.0.0.53 is the host's systemd-resolved, which points to host networking (network_mode: host) rather than our doghouse_net, where Docker's DNS is 127.0.0.11.

Fix: a new optional .env setting, LIVEKIT_NODE_IP. When it is set, LiveKit advertises that IP and skips STUN entirely. When it is empty, LiveKit behaves exactly as before. No dns: lines are hard-coded (decisions log).

How it works in livekit-server v1.13.9 (checked against the source at tag v1.13.9 and its mediatransportutil dependency f234b534b095, and on the v1.13.9 binary):

  • --node-ip / env NODE_IP sets rtc.node_ip (pkg/config/config.go, updateFromCLI).
  • A node IP alone is not enough. RTCConfig.Validate runs STUN when conf.NodeIP.IsEmpty() || conf.UseExternalIP, so with use_external_ip: true STUN still runs. Binary test with NODE_IP=203.0.113.10 and a broken resolver: same error, exit 0.
  • So when a node IP is set, use_external_ip must also be false. Then LiveKit logs using explicit node IP for NAT1To1Ips and starts.
  • Passing LIVEKIT_RTC_USE_EXTERNAL_IP from compose as ${LIVEKIT_NODE_IP:+false} doesn't work. When the IP is empty the variable is set but empty, and livekit-server reads that as false. The binary then started with the container's private IP (nodeIP: 172.30.0.2) and no STUN, which would silently break voice for everyone not using the new setting.

Implementation: docker-compose.yml passes NODE_IP: '${LIVEKIT_NODE_IP:-}' and starts the container (alpine, so /bin/sh exists) with a small sh -c:

  • if NODE_IP is non-empty, it runs exec /livekit-server --config /etc/livekit.yaml --rtc.use_external_ip=false and logs doghouse: LIVEKIT_NODE_IP=…, skipping STUN;
  • otherwise it runs exec /livekit-server --config /etc/livekit.yaml as before.

The setting lives in .env, so upgrades never overwrite it, and livekit.yaml is unchanged.

Tested with the v1.13.9 binary. The compose command and environment were extracted from docker-compose.yml and run in a mount namespace whose /etc/resolv.conf is nameserver 127.0.0.53, so STUN is unreachable, as on Justin's server:

  • LIVEKIT_NODE_IP empty: exits with code 0 after 1.5 s with the exact error, could not validate RTC config: could not resolve external IP: dial udp: lookup stun1.l.google.com on 127.0.0.53:53: read udp 127.0.0.1:43433->127.0.0.53:53: read: connection refused.
  • LIVEKIT_NODE_IP=203.0.113.10: listening on 7880 after 0.3 s, logging doghouse: LIVEKIT_NODE_IP=203.0.113.10, skipping STUN, using explicit node IP for NAT1To1Ips and starting LiveKit server … "nodeIP": "203.0.113.10".
  • With the box's normal resolver, where STUN gets no reply, the old default hangs: still not listening after 30 s.

LiveKit media ports: UDP 20000-20100 (was 50000-50100)

Seen: Justin's docker compose up -d livekit failed with failed to bind host port [::]:50028/udp: address already in use. 50000-50100 sits inside Linux's ephemeral port range (32768-60999), which the kernel hands out for outgoing connections, so any port in it can already be taken.

Fix (decisions log): the default RTC UDP range is now 20000-20100: livekit.yaml rtc.port_range_start/end, the compose port mapping, README (router table, ufw example, troubleshooting) and DESIGN/PLAN. The e2e LiveKit config moved from 51000-51100 to 21000-21100 for the same reason. validate:deploy enforces that the range is valid, below 32768, doesn't overlap TURN's relay range (turn.relay_range_start/end, default 30000-40000), and matches the published compose range. Each rule fails when broken: 50000-50100, 29950-30050, and a compose/yaml mismatch. The README has a troubleshooting entry quoting the exact error. With the new config, the v1.13.9 binary logs "rtc.portICERange": [20000, 20100].

Configurable Docker network

Justin's NPM is on his existing network homelab. The compose network key stays doghouse_net, but its Docker name is now name: ${DOGHOUSE_NETWORK:-doghouse_net} (still external: true). DOGHOUSE_NETWORK=doghouse_net is in .env.example, with a comment: set it to a network your proxy is already on, e.g. homelab. The README explains the option, warns that network_mode: <name> and network_mode: host are wrong (use networks:), and notes that containers on a user-defined network show nameserver 127.0.0.11 in /etc/resolv.conf.

Other changes

npm run validate:deploy (part of npm run check) now checks:

  • LIVEKIT_NODE_IP is in .env.example, empty, and explained with curl -4 ifconfig.me; and DOGHOUSE_NETWORK is there with default doghouse_net.
  • Compose with LIVEKIT_NODE_IP set gives NODE_IP=<ip> and the --rtc.use_external_ip=false start; with it empty, NODE_IP='' and the plain start. LIVEKIT_RTC_USE_EXTERNAL_IP must not be set (the empty-means-false trap).
  • The network name comes from ${DOGHOUSE_NETWORK:-doghouse_net}, and DOGHOUSE_NETWORK=homelab gives external network homelab. doghouse_net is the only network, both services are on it, and no service uses network_mode: or dns:.
  • The interpolation now handles ${VAR:+alt} and $$ like Compose does.
  • Each new rule was confirmed to fail when broken: network_mode: homelab added, network name hard-coded, NODE_IP removed, the flag removed, and the empty-bool env approach.

README:

  • A troubleshooting entry quotes the exact error. It covers setting LIVEKIT_NODE_IP and running docker compose up -d livekit, and checking that docker inspect doghouse-livekit --format '{{.HostConfig.NetworkMode}}' says doghouse_net, not host (host mode breaks NPM -> LiveKit and LiveKit -> app webhooks).
  • A new entry covers dynamic home IPs.
  • The old "set node_ip in livekit.yaml" advice now points at LIVEKIT_NODE_IP.
  • Step 4 lists the two new settings, and step 5 covers DOGHOUSE_NETWORK.

Packaging:

  • The zip now includes the repo .gitignore, which gained explicit deploy/.env and deploy/data/ lines, plus CHANGES-0.1.2.md.
  • npm run package refuses to build if .gitignore lacks those lines or CHANGES-<version>.md is missing.

Version: 0.1.2 in the root and workspace package.json files and in package-lock.json.

Tests (branch release/0.1.2, 10 Oct 2026, 07:17–07:24 AEDT)

  • REQUIRE_LIVEKIT=1 npm run check: passed (exit 0). The output includes deploy/ OK: …, "Skipped tests: 0" and "Server coverage: statements 98.12%, branches 92.35%, functions 99.29%, lines 99.19%". Counts: shared 22, server 187, web 205 passed, 0 failed.
  • REQUIRE_LIVEKIT=1 npm run e2e: passed (exit 0), "12 passed (44.7s)", "4 skipped". The skips are the usual desktop-only two-user specs. The voice spec passed on the new 21000-21100 e2e range.
  • No zip was built (npm run package not run); QA reviews first.