fix(deploy): wire mobile pairing relay into docker-compose self-host bundle - #4082
fix(deploy): wire mobile pairing relay into docker-compose self-host bundle#4082Duncan-Slade wants to merge 1 commit into
Conversation
…bundle Self-hosted relays with BUZZ_REQUIRE_RELAY_MEMBERSHIP=true (the production default in deploy/compose/.env.example) advertise NIP-43 in their NIP-11 document regardless of whether a pairing relay is actually deployed (crates/buzz-relay/src/nip11.rs advertise_nip43). The desktop/mobile pairing client (desktop/src-tauri/src/commands/pairing.rs probe_pairing_relay / pairing_relay_from_nip11) then falls back to the legacy "<relay>/pair" convention, but the compose bundle never ran buzz-pair-relay or routed /pair anywhere, so pairing failed with "WebSocket connection failed: HTTP error: 404 Not Found". The published image already bundles the buzz-pair-relay binary alongside buzz-relay/buzz-admin (Dockerfile), and the relay already reads BUZZ_PAIRING_RELAY_URL to advertise pairing_relay_url directly in NIP-11 (crates/buzz-relay/src/config.rs, nip11.rs) — so this is a deploy-config-only fix, no Rust changes needed. Mirrors the existing Helm chart's pattern (deploy/charts/buzz/templates/pairing-relay.yaml). - deploy/compose/compose.yml: add a pairing-relay service (same image, entrypoint override to buzz-pair-relay) and pass through BUZZ_PAIRING_RELAY_URL on the relay service. - deploy/compose/compose.caddy.yml: caddy now also depends on pairing-relay being healthy. - deploy/compose/Caddyfile: route /pair (and /pair/*) to pairing-relay:5000 ahead of the catch-all reverse_proxy to relay:3000. - deploy/compose/.env.example: document and default BUZZ_PAIRING_RELAY_URL=wss://buzz.example.com/pair. - deploy/compose/README.md: new "Mobile pairing" section explaining the 404, what's wired automatically, and the options for custom reverse proxies or open relays that don't want pairing. Co-authored-by: Sladey <slade198@gmail.com> Signed-off-by: Sladey <slade198@gmail.com>
|
Running the equivalent wiring in production on a self-hosted deploy (Caddy + This uses a named matcher, so the upstream path is not rewritten — Measuring against the running container on the compose network, WebSocket upgrade, one path per row: So it isn't that the sidecar only serves the root — it answers essentially any path except exactly That's also the path clients dial. If that reproduces for you, the symptom would be a hang rather than the 404 this fixes — which is harder to diagnose, since nothing is logged on either side. Two options that both worked here: handle_path /pair* {
reverse_proxy pairing-relay:5000
}or keeping the One thing I can't explain: why Everything else here matches what I ended up with, including |
Summary
Self-hosted relays deployed via
deploy/compose/withBUZZ_REQUIRE_RELAY_MEMBERSHIP=true(the production default in.env.example) advertise NIP-43 in their NIP-11 document regardless of whether a pairing relay is actually deployed (crates/buzz-relay/src/nip11.rsadvertise_nip43). The desktop/mobile pairing client (desktop/src-tauri/src/commands/pairing.rsprobe_pairing_relay/pairing_relay_from_nip11, ~lines 420-490) then falls back to the legacy"<relay>/pair"convention — but the compose bundle never ranbuzz-pair-relayor routed/pairanywhere, so mobile pairing failed withWebSocket connection failed: HTTP error: 404 Not Found.The published image already bundles the
buzz-pair-relaybinary alongsidebuzz-relay/buzz-admin(seeDockerfile), and the relay already readsBUZZ_PAIRING_RELAY_URLto advertisepairing_relay_urldirectly in NIP-11 (crates/buzz-relay/src/config.rs,nip11.rs) — so this is a deploy-config-only fix, no Rust changes needed. Mirrors the existing Helm chart's pattern (deploy/charts/buzz/templates/pairing-relay.yaml), which was not in scope here.deploy/compose/compose.yml: add apairing-relayservice (same image, entrypoint override tobuzz-pair-relay) and pass throughBUZZ_PAIRING_RELAY_URLon therelayservice.deploy/compose/compose.caddy.yml:caddynow also depends onpairing-relaybeing healthy.deploy/compose/Caddyfile: route/pair(and/pair/*) topairing-relay:5000ahead of the catch-allreverse_proxy relay:3000.deploy/compose/.env.example: document and defaultBUZZ_PAIRING_RELAY_URL=wss://buzz.example.com/pair.deploy/compose/README.md: new "Mobile pairing" section explaining the 404, what's wired automatically, and options for custom reverse proxies or open relays that don't want pairing.Test plan
!resettag);pairing-relayservice present in the merged service list.route {}+ named-matcher pattern (nocaddy/dockerbinaries available in this sandbox to runcaddy validate/docker compose config).docker compose -f deploy/compose/compose.yml -f deploy/compose/compose.caddy.yml configon a machine with Docker installed.BUZZ_COMPOSE_TLS=true, confirmcurl -s -H "Accept: application/nostr+json" https://<domain>/returnspairing_relay_url: wss://<domain>/pair, then complete an actual mobile pairing handshake.🤖 Generated with Claude Code