Skip to content

Commit 7a93396

Browse files
fix(deploy): publish the pair sidecar on BUZZ_PAIR_RELAY_PORT
The base bundle publishes the relay directly on BUZZ_HTTP_PORT, but kept the pairing sidecar internal-only, so split-domain and non-TLS deployments had to hand-edit compose.yml to route anything to it — and those edits conflict on the next pull of the bundle. Publish the sidecar the same way the relay is published: a BUZZ_PAIR_RELAY_PORT mapping (default 5000) in the base compose, unpublished by compose.caddy.yml where Caddy routes /pair internally. Also document the network-attach option for reverse proxies running outside this compose project, which otherwise have no way to reach the sidecar. Signed-off-by: webdevtodayjason <[email protected]>
1 parent 10474f5 commit 7a93396

4 files changed

Lines changed: 30 additions & 15 deletions

File tree

‎deploy/compose/.env.example‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ BUZZ_S3_ACCESS_KEY=CHANGE_ME_RANDOM_ACCESS_KEY
3535
BUZZ_S3_SECRET_KEY=CHANGE_ME_RANDOM_SECRET_KEY
3636
BUZZ_S3_BUCKET=buzz-media
3737

38-
# Optional host ports. Base compose publishes the relay directly on BUZZ_HTTP_PORT.
38+
# Optional host ports. Base compose publishes the relay directly on
39+
# BUZZ_HTTP_PORT and the pairing sidecar on BUZZ_PAIR_RELAY_PORT;
40+
# compose.caddy.yml unpublishes both and fronts them with Caddy.
3941
BUZZ_HTTP_PORT=3000
42+
BUZZ_PAIR_RELAY_PORT=5000
4043

4144
# Caddy host ports. Only used with compose.caddy.yml.
4245
CADDY_HTTP_PORT=80
@@ -48,8 +51,9 @@ CADDY_HTTPS_PORT=443
4851
# - Split-domain or your own proxy: advertise a dedicated URL so the desktop
4952
# uses it directly instead of the /pair fallback. Must be ws:// or wss://.
5053
# BUZZ_PAIRING_RELAY_URL=wss://pair.buzz.example.com
51-
# - Non-TLS / direct: publish the pair service's port 5000 and point clients at
52-
# it, e.g. BUZZ_PAIRING_RELAY_URL=ws://buzz.example.com:5000 — otherwise use
54+
# - Non-TLS / direct: the pair service is already published on
55+
# BUZZ_PAIR_RELAY_PORT, so just point clients at it, e.g.
56+
# BUZZ_PAIRING_RELAY_URL=ws://buzz.example.com:5000 — otherwise use
5357
# TLS mode. See README.md § Device pairing.
5458
# BUZZ_PAIRING_RELAY_URL=
5559

‎deploy/compose/README.md‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,22 @@ and the deployment just has to route traffic to it. Three cases:
5252

5353
- **TLS (`compose.caddy.yml`) — works out of the box.** Caddy routes
5454
`/pair` on your main domain to the sidecar, so the desktop's legacy fallback
55-
(`wss://<domain>/pair`) Just Works with no extra DNS and nothing to set.
55+
(`wss://<domain>/pair`) Just Works with no extra DNS and nothing to set. The
56+
overlay unpublishes the sidecar's host port; Caddy is the only way in.
5657
- **Split domain or your own reverse proxy.** Expose the sidecar at its own
5758
host name and advertise it so the desktop uses it directly:
5859
set `BUZZ_PAIRING_RELAY_URL=wss://pair.<domain>` in `.env` and point that
59-
name at the `pair` service (port 5000) in your proxy. The relay then
60-
advertises it in NIP-11 and the desktop skips the `/pair` fallback.
61-
- **Non-TLS / direct (no Caddy).** The base stack keeps the sidecar on the
62-
internal network only. Publish its port (add a `5000:5000` mapping to the
63-
`pair` service) and set `BUZZ_PAIRING_RELAY_URL=ws://<host>:5000`, or run TLS
64-
mode. Without one of these, the desktop QR points at a `/pair` endpoint the
65-
relay 404s and pairing fails.
60+
name at the sidecar in your proxy — the base stack publishes it on
61+
`BUZZ_PAIR_RELAY_PORT` (default 5000). If your proxy runs *outside* this
62+
compose project and you would rather not publish the port, attach the proxy
63+
to the project's `buzz-net` network and target `pair:5000` directly. The
64+
relay then advertises the URL in NIP-11 and the desktop skips the `/pair`
65+
fallback.
66+
- **Non-TLS / direct (no Caddy).** The base stack publishes the sidecar on
67+
`BUZZ_PAIR_RELAY_PORT` (default 5000); set
68+
`BUZZ_PAIRING_RELAY_URL=ws://<host>:5000` so the QR points at it. Without
69+
that, the desktop QR points at a `/pair` endpoint the relay 404s and pairing
70+
fails.
6671

6772
`BUZZ_PAIRING_RELAY_URL` must be a `ws://` or `wss://` URL; the relay rejects
6873
anything else at startup.

‎deploy/compose/compose.caddy.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ services:
22
relay:
33
ports: !reset []
44

5+
# Caddy routes /pair to the sidecar, so its direct host port goes away too.
6+
pair:
7+
ports: !reset []
8+
59
caddy:
610
image: caddy:2-alpine
711
depends_on:

‎deploy/compose/compose.yml‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,17 @@ services:
4848

4949
# Ephemeral NIP-AB device-pairing sidecar. The relay image already ships the
5050
# binary; without this service the desktop QR resolves to a /pair endpoint the
51-
# relay itself does not serve and mobile pairing fails. The sidecar binds only
52-
# inside the compose network — a reverse proxy terminates TLS and routes /pair
53-
# here (see compose.caddy.yml). To expose it directly, publish port 5000 and
54-
# set BUZZ_PAIRING_RELAY_URL (see .env.example and README.md).
51+
# relay itself does not serve and mobile pairing fails. Published directly on
52+
# BUZZ_PAIR_RELAY_PORT, mirroring the relay's BUZZ_HTTP_PORT; compose.caddy.yml
53+
# unpublishes it and routes /pair through Caddy instead (see README.md
54+
# § Device pairing).
5555
pair:
5656
image: ${BUZZ_IMAGE:-ghcr.io/block/buzz:main}
5757
entrypoint: ["/usr/local/bin/buzz-pair-relay"]
5858
environment:
5959
BUZZ_PAIR_RELAY_BIND_ADDR: 0.0.0.0:5000
60+
ports:
61+
- "${BUZZ_PAIR_RELAY_PORT:-5000}:5000"
6062
# The sidecar speaks only WebSocket upgrades and answers a plain GET with 400,
6163
# so probe the raw TCP port over /dev/tcp rather than expecting an HTTP 200.
6264
healthcheck:

0 commit comments

Comments
 (0)