backend/ runs both as Docker Compose services, neither is needed: the client works with any WebTorrent tracker and STUN server. The tracker is one file on Node and ws that does only the part of the protocol HellCon uses. It accepts allowed origins only and messages of at most 16 KiB, only announce, one offer per announce and answers only to offers it delivered, once. Forwarded messages are rebuilt from the checked fields. It limits the message rate, the signaling each connection sends, the bytes queued for a peer that stops reading, connection age, connections per IP and in total, and peers per swarm. It logs nothing. coturn runs STUN only on the host network, pinned, read-only and without capabilities beyond the one its binary needs. backend/tracker.spec.mjs tests its rules one by one, e2e.spec.ts sends a real file through it alone in both directions between Chromium and Firefox. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72 lines
2.3 KiB
YAML
72 lines
2.3 KiB
YAML
# HellCon's own servers: a tracker behind Caddy and a STUN server. Neither is needed, the client works
|
|
# with any WebTorrent tracker and STUN server. Set ORIGINS in .env next to this file, e.g.
|
|
# ORIGINS=https://hellcon.example.org, then `docker compose up -d --build`. Caddy, in its own compose
|
|
# project, proxies to the tracker over its network (CADDY_NETWORK, "caddy" unless set):
|
|
#
|
|
# tracker.example.org {
|
|
# reverse_proxy hellcon-tracker:8000
|
|
# }
|
|
|
|
name: hellcon
|
|
|
|
x-logging: &logging
|
|
driver: json-file
|
|
options: { max-size: 10m, max-file: '2' }
|
|
|
|
services:
|
|
tracker:
|
|
build: .
|
|
environment:
|
|
ORIGINS: ${ORIGINS:?set ORIGINS in .env to where HellCon is served from}
|
|
networks:
|
|
caddy:
|
|
aliases: [hellcon-tracker]
|
|
init: true
|
|
read_only: true
|
|
cap_drop: [ALL]
|
|
security_opt: [no-new-privileges:true]
|
|
cpus: 0.5
|
|
mem_limit: 96m
|
|
memswap_limit: 96m
|
|
pids_limit: 32
|
|
logging: *logging
|
|
restart: unless-stopped
|
|
|
|
# On the host network, so Docker's NAT can't change the source address clients get back. UDP 3478
|
|
# on IPv4 only, stun.example.org needs an A record and no AAAA.
|
|
coturn:
|
|
image: coturn/coturn:4.18.0
|
|
network_mode: host
|
|
# Off by default since 4.18, their --no- options are gone: DTLS, the admin CLI, the software
|
|
# attribute, the RFC 3489 MAPPED-ADDRESS and logging each binding request. The image has no config
|
|
# file, -n would only fail with "Unknown argument".
|
|
command:
|
|
- --log-file=stdout
|
|
- --listening-ip=0.0.0.0
|
|
- --listening-port=3478
|
|
- --stun-only
|
|
- --no-tcp
|
|
- --no-tls
|
|
# One per CPU core otherwise, more than cpus allows.
|
|
- --relay-threads=1
|
|
# The pid file lands in /var/tmp, coturn can't write /var/run. The image declares /var/lib/coturn
|
|
# a volume, the tmpfs keeps an anonymous one from piling up.
|
|
tmpfs: [/var/lib/coturn, /var/tmp]
|
|
read_only: true
|
|
cap_drop: [ALL]
|
|
# turnserver has it as file capability, without it the kernel refuses to run it. 3478 doesn't need
|
|
# it, no-new-privileges keeps it from being granted.
|
|
cap_add: [NET_BIND_SERVICE]
|
|
security_opt: [no-new-privileges:true]
|
|
cpus: 1
|
|
mem_limit: 128m
|
|
memswap_limit: 128m
|
|
pids_limit: 64
|
|
logging: *logging
|
|
restart: unless-stopped
|
|
|
|
networks:
|
|
caddy:
|
|
external: true
|
|
name: ${CADDY_NETWORK:-caddy}
|