version: '3.8'

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

services:
  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
