services:
  omada-controller:
    container_name: omada-controller
    image: mbentley/omada-controller:5.15
    restart: unless-stopped
    ulimits:
      nofile:
        soft: 4096
        hard: 8192
    stop_grace_period: 60s
    network_mode: bridge
    environment:
      - PUID=508
      - PGID=508
      - MANAGE_HTTP_PORT=8088
      - MANAGE_HTTPS_PORT=8043
      - PORTAL_HTTP_PORT=8088
      - PORTAL_HTTPS_PORT=8843
      - PORT_APP_DISCOVERY=27001
      - PORT_ADOPT_V1=29812
      - PORT_UPGRADE_V1=29813
      - PORT_MANAGER_V1=29811
      - PORT_MANAGER_V2=29814
      - PORT_DISCOVERY=29810
      - PORT_TRANSFER_V2=29815
      - PORT_RTTY=29816
      - SHOW_SERVER_LOGS=true
      - SHOW_MONGODB_LOGS=false
      - SSL_CERT_NAME=tls.crt
      - SSL_KEY_NAME=tls.key
      - TZ=Etc/UTC
    volumes:
      - omada-data:/opt/tplink/EAPController/data
      - omada-logs:/opt/tplink/EAPController/logs
    ports:
      - 8088:8088
      - 8043:8043
      - 8843:8843
      - 19810:19810/udp
      - 29810:29810/udp
      - 29811:29811
      - 29812:29812
      - 29813:29813
      - 29814:29814
      - 29815:29815
      - 29816:29816
    healthcheck:
      test: ["CMD-SHELL", "wget --quiet --tries=1 --no-check-certificate -O /dev/null --server-response --timeout=5 'https://127.0.0.1:${MANAGE_HTTPS_PORT:-8043}/login' || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 5
  
volumes:
  omada-data:
    name: omada-data
    driver: local
    driver_opts:
      type: none
      device: /opt/tplink/EAPController/data
      o: bind
  omada-logs:
    name: omada-logs
    driver: local
    driver_opts:
      type: none
      device: /opt/tplink/EAPController/logs
      o: bind