# Local LiveKit SFU for M2 dev.
#
# macOS + Docker Desktop: `network_mode: host` is NOT supported — falls back
# to explicit port mapping. WebRTC UDP ports are ranged small for dev.
#
# Start:   docker compose -f infra/livekit/docker-compose.yml up -d
# Stop:    docker compose -f infra/livekit/docker-compose.yml down
# Logs:    docker compose -f infra/livekit/docker-compose.yml logs -f livekit

services:
  livekit:
    image: livekit/livekit-server:latest
    restart: unless-stopped
    command: ["--config", "/etc/livekit.yaml"]
    ports:
      - "7880:7880/tcp" # signaling WS
      - "7881:7881/tcp" # RTC TCP fallback
      - "50000-50100:50000-50100/udp" # RTC UDP range
    volumes:
      - ./livekit.yaml:/etc/livekit.yaml:ro

  turn:
    image: coturn/coturn:4.6
    restart: unless-stopped
    ports:
      - "3478:3478/udp"
      - "3478:3478/tcp"
      - "50200-50300:50200-50300/udp"
    command: >
      -n
      --log-file=stdout
      --min-port=50200
      --max-port=50300
      --no-cli
      --no-tls
      --no-dtls
      --realm=local.chatapp
      --lt-cred-mech
      --user=dev:devpassword
      --no-multicast-peers
