services:
  lk-jwt-service:
    image: ghcr.io/element-hq/lk-jwt-service:latest
    container_name: lk-jwt-service
    # lk-jwt-service environment config here..
    labels:
      caddy: livekit.example.com
      caddy.@lk-jwt-service.path: "/sfu/get* /healthz* /get_token*"
      caddy.reverse_proxy: "@lk-jwt-service {{upstreams 8081}}"

  livekit:
    image: docker.io/livekit/livekit-server:latest
    container_name: livekit
    command: --config /etc/livekit.yaml
    restart: unless-stopped
    labels:
      caddy: livekit.example.com
      caddy.reverse_proxy: "{{upstreams 7880}}"
    volumes:
      - ./livekit.yaml:/etc/livekit.yaml:ro
    ports:
      - "7881:7881/tcp"
      - "50100-50200:50100-50200/udp"

  caddy:
    image: docker.io/lucaslorentz/caddy-docker-proxy:ci-alpine
    ports:
      - 80:80
      - 443:443
    environment:
      - CADDY_INGRESS_NETWORKS=proxy
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./data:/data
    restart: unless-stopped
    labels:
      caddy.1_respond: /.well-known/matrix/server {"m.server":"matrix.example.com:443"}
      caddy.2_respond: /.well-known/matrix/client {"m.server":{"base_url":"https://matrix.example.com"},"m.homeserver":{"base_url":"https://matrix.example.com"},"org.matrix.msc4143.rtc_foci":[{"type":"livekit","livekit_service_url":"https://livekit.example.com"}]}

      # If you already configured `[global.well_known]` with Continuwuity,
      # comment out the *_respond labels and uncomment the line below:
      # caddy.reverse_proxy: /.well-known/matrix/* homeserver:8008

      # If you are having problems with continuwuity serving headers,
      # uncomment the header section below.
      # caddy: example.com
      # caddy.0_header: "*"
      # caddy.0_header.Access-Control-Allow-Origin: "*"
      # caddy.0_header.Access-Control-Allow-Methods: "GET, POST, OPTIONS"
      # caddy.0_header.Access-Control-Allow-Headers: "Authorization"
      # caddy.0_header.Content-Type: "application/json"

  homeserver:
    image: forgejo.ellis.link/continuwuation/continuwuity:latest
    restart: unless-stopped
    # add additional environment, volume, and network config here...
    labels:
      caddy: matrix.example.com
      caddy.reverse_proxy: "{{upstreams 8008}}"
