# Jitsi Meet - Video conferencing
# Port: 8443
# Self-hosted video conferencing platform
version: '3.8'

networks:
  meet.jitsi:
    driver: bridge

  turn_net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.30.0.0/24

services:

  ##########################################################
  # COTURN
  ##########################################################
  coturn:
    image: instrumentisto/coturn:latest
    container_name: coturn
    restart: unless-stopped
    command: ["turnserver", "-c", "/config/turnserver.conf"]
    ports:
      - "3478:3478/tcp"
      - "3478:3478/udp"
      - "5349:5349/tcp"
      - "5349:5349/udp"
      - "49160-49200:49160-49200/udp"
    volumes:
      - /volume2/metadata/docker/turnserver/turnserver.conf:/config/turnserver.conf:ro
      - /volume2/metadata/docker/turnserver/certs:/config/certs:ro
      - /volume2/metadata/docker/turnserver/logs:/var/log
      - /volume2/metadata/docker/turnserver/db:/var/lib/coturn
    environment:
      - TZ=America/Los_Angeles
    networks:
      turn_net:
        ipv4_address: 172.30.0.2
    ulimits:
      nofile:
        soft: 65536
        hard: 65536

  ##########################################################
  # PROSODY
  ##########################################################
  prosody:
    image: jitsi/prosody:stable
    container_name: jitsi-prosody
    restart: unless-stopped
    volumes:
      - /volume2/metadata/docker/jitsi/prosody:/config
    environment:
      - XMPP_DOMAIN=meet.jitsi
      - XMPP_AUTH_DOMAIN=auth.meet.jitsi
      - XMPP_MUC_DOMAIN=muc.meet.jitsi
      - XMPP_INTERNAL_MUC_DOMAIN=internal-muc.meet.jitsi
      - XMPP_GUEST_DOMAIN=guest.meet.jitsi
      - XMPP_RECORDER_DOMAIN=recorder.meet.jitsi

      - JVB_AUTH_USER=jvb
      - JVB_AUTH_PASSWORD="REDACTED_PASSWORD"  # pragma: allowlist secret

      - JICOFO_AUTH_USER=focus
      - JICOFO_AUTH_PASSWORD="REDACTED_PASSWORD"  # pragma: allowlist secret
      - JICOFO_COMPONENT_SECRET=dE6r5r3A3Xpirujycq3E  # pragma: allowlist secret

      - TZ=America/Los_Angeles
    networks:
      meet.jitsi:
        aliases:
          - xmpp.meet.jitsi
          - auth.meet.jitsi
          - muc.meet.jitsi
          - internal-muc.meet.jitsi
          - guest.meet.jitsi
          - recorder.meet.jitsi
          - focus.meet.jitsi

  ##########################################################
  # JICOFO
  ##########################################################
  jicofo:
    image: jitsi/jicofo:stable
    container_name: jitsi-jicofo
    restart: unless-stopped
    volumes:
      - /volume2/metadata/docker/jitsi/jicofo:/config
    environment:
      - XMPP_DOMAIN=meet.jitsi
      - XMPP_AUTH_DOMAIN=auth.meet.jitsi

      - JICOFO_AUTH_USER=focus
      - JICOFO_AUTH_PASSWORD="REDACTED_PASSWORD"  # pragma: allowlist secret
      - JICOFO_COMPONENT_SECRET=dE6r5r3A3Xpirujycq3E  # pragma: allowlist secret

      - TZ=America/Los_Angeles
    depends_on:
      - prosody
    networks:
      - meet.jitsi

  ##########################################################
  # JVB
  ##########################################################
  jvb:
    image: jitsi/jvb:stable
    container_name: jitsi-jvb
    restart: unless-stopped
    ports:
      - "10000:10000/udp"
    volumes:
      - /volume2/metadata/docker/jitsi/jvb:/config
    environment:
      - XMPP_SERVER=prosody
      - XMPP_DOMAIN=meet.jitsi
      - XMPP_AUTH_DOMAIN=auth.meet.jitsi
      - XMPP_INTERNAL_MUC_DOMAIN=internal-muc.meet.jitsi

      - JVB_AUTH_USER=jvb
      - JVB_AUTH_PASSWORD="REDACTED_PASSWORD"  # pragma: allowlist secret
      - JVB_BREWERY_MUC=jvbbrewery

      - JVB_PORT=10000
      - JVB_TCP_HARVESTER_DISABLED=true
      - JVB_STUN_SERVERS=stun.l.google.com:19302
      - JVB_ENABLE_APIS=rest,colibri
      - JVB_ADVERTISE_IPS=184.23.52.219

      - TZ=America/Los_Angeles
    depends_on:
      - prosody
    networks:
      - meet.jitsi


  ##########################################################
  # WEB UI
  ##########################################################
  web:
    image: jitsi/web:stable
    container_name: jitsi-web
    restart: unless-stopped
    ports:
      - "5080:80"
      - "5443:443"
    volumes:
      - /volume2/metadata/docker/jitsi/web:/config
      - /volume2/metadata/docker/jitsi/letsencrypt:/etc/letsencrypt
    environment:
      - PUBLIC_URL=https://meet.thevish.io
      - ENABLE_P2P=0

      - ENABLE_TURN=1
      - TURN_HOST=turn.thevish.io
      - TURN_PORT=3478
      - TURN_TRANSPORT=udp
      - TURN_CREDENTIALS=testuser:testpass

      - XMPP_STUN_SERVERS=stun.l.google.com:19302

      - DISABLE_HTTPS=0
      - ENABLE_HTTP_REDIRECT=0
      - TZ=America/Los_Angeles
    depends_on:
      - prosody
      - jicofo
      - jvb
    networks:
      - meet.jitsi
