Skip to content

Add Cloudflare TURN support for hosted sync - #79

Draft
j1philli wants to merge 3 commits into
mainfrom
t3code/plan-cloudflare-turn-server-support
Draft

j1philli wants to merge 3 commits into
mainfrom
t3code/plan-cloudflare-turn-server-support

Conversation

@j1philli

Copy link
Copy Markdown
Owner

Summary

  • Add server-side Cloudflare Realtime TURN credential generation for eligible hosted spaces that explicitly opt into Cloud Relay; preserve coturn support for self-hosted installations.
  • Use Cloudflare public STUN by default and refresh short-lived ICE credentials in active clients.
  • Document the hosted Coolify runtime setup. User data continues over WebRTC data channels; the signaling server remains control-plane only.

Tests

  • mise run guard-architecture — passed
  • bash scripts/ci/run-jvm-tests.sh — passed, 210 tests across 6 reports
  • mise exec -- ./kotlin build -m server — passed
  • mise run build-web — passed
  • git diff --check origin/main...HEAD — passed

Required secrets/config

Hold this PR until the Cloudflare credentials are configured. Do not merge or deploy yet.

Name Set in Source / requirement
SHILLING_CLOUDFLARE_TURN_KEY_ID Production Coolify server application, runtime environment Cloudflare dashboard → Realtime → TURN: create a TURN key and copy its key ID.
SHILLING_CLOUDFLARE_TURN_API_TOKEN Production Coolify server application, secret runtime environment variable Copy the API token associated with that TURN key from the same Cloudflare flow. Keep it server-side.

No TeamCity parameter is needed for this hosted deployment: TeamCity validates/packages builds, while Coolify builds the production server from the public repository and supplies its runtime environment. Leave SHILLING_TURN_URLS and SHILLING_TURN_SECRET unset when using Cloudflare. SHILLING_STUN_URLS defaults to stun:stun.cloudflare.com:3478; optional SHILLING_TURN_TTL defaults to 86400 seconds. Existing hosted authentication and paid household entitlements remain required for TURN issuance.

After credentials are configured, validate a live relay connection between two devices with Cloud Relay enabled, including credential refresh, before merging or deploying.

@j1philli
j1philli marked this pull request as draft November 17, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant