Files
temetro/backend/docker-compose.tunnel.yml
T
Khalid Abdi 014b4ddf8f feat(backend): one-command Dockerized cloudflared tunnel
Add `npm run docker:tunnel` (docker-compose.tunnel.yml overlay): a
cloudflared sidecar opens a public quick tunnel to the backend, and the
backend auto-discovers its https://…trycloudflare.com URL from cloudflared's
metrics endpoint (services/relay-url.ts) and bakes it into the wallet-import
QR — so a phone on any network can scan, with no install/account/PUBLIC_RELAY_URL.

PUBLIC_RELAY_URL still wins when set. Verified end-to-end: the backend logs
the discovered tunnel URL on startup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 20:13:45 +03:00

25 lines
984 B
YAML

# Overlay that adds a public Cloudflare tunnel so a patient's phone can scan the
# wallet-import QR from ANY network (cellular, other Wi-Fi) — not just the LAN.
#
# npm run docker:tunnel # from backend/ (easiest)
# # equivalently:
# docker compose -f docker-compose.yml -f docker-compose.tunnel.yml up --build
#
# cloudflared opens a random https://<id>.trycloudflare.com URL to the backend
# and exposes it on its metrics endpoint; the backend reads it from there and
# bakes it into the QR (CLOUDFLARED_METRICS_URL below). Zero config — no
# Cloudflare account or token needed for these quick tunnels.
services:
cloudflared:
image: cloudflare/cloudflared:latest
restart: unless-stopped
depends_on:
- backend
command: tunnel --no-autoupdate --url http://backend:4000 --metrics 0.0.0.0:3333
backend:
environment:
# Where the backend reads its public quick-tunnel URL from.
CLOUDFLARED_METRICS_URL: http://cloudflared:3333