# Configuration for unifi-network-application setup

# Name of the big-bear-unifi-network-application application
name: big-bear-unifi-network-application
# Service definitions for the big-bear-homarr application
services:
  # Main application service
  app: # Name of the service
    image: linuxserver/unifi-network-application:10.4.57 # Docker image to use
    container_name: big-bear-unifi-network-application # Name for the created container
    environment: # Environmental variables for the container
      - PUID=1000 # User ID
      - PGID=1000 # Group ID
      - TZ=Etc/UTC # Timezone
      - MONGO_HOST=big-bear-unifi-db # MongoDB host
      - MONGO_USER=unifi # MongoDB username
      - MONGO_PASS=unifi_password # MongoDB password
      - MONGO_PORT=27017 # MongoDB port
      - MONGO_DBNAME=unifi # MongoDB database name
      - MEM_LIMIT=1024 #optional  # Memory limit for the container
      - MEM_STARTUP=1024 #optional  # Memory to allocate on container startup
      - MONGO_TLS= #optional  # MongoDB TLS setting
      - MONGO_AUTHSOURCE= #optional  # MongoDB authentication source
    volumes: # Volumes to mount in the container
      - /DATA/AppData/$AppID/config:/config # Map host directory to container directory
    ports: # Ports to expose and forward
      - 8443:8443 # HTTPS portal
      - 3478:3478/udp # STUN service
      - 10001:10001/udp # UniFi AP discovery
      - 8080:8080 # HTTP portal
      - 1900:1900/udp #optional  # For DLNA
      - 8843:8843 #optional  # HTTPS guest portal
      - 8880:8880 #optional  # HTTP guest portal
      - 6789:6789 #optional  # Mobile speed test port
      - 5514:5514/udp #optional  # Remote syslog port
    restart: unless-stopped # Restart policy for the container
    networks: # Networks to join
      - unifi-nework-application-network
    depends_on:
      - unifi-db
    x-casaos:
      envs:
        - container: PUID
          description:
            en_us: 'Container Variable: PUID'
        - container: PGID
          description:
            en_us: 'Container Variable: PGID'
        - container: TZ
          description:
            en_us: 'Container Variable: TZ'
        - container: MONGO_HOST
          description:
            en_us: 'Container Variable: MONGO_HOST'
        - container: MONGO_USER
          description:
            en_us: 'Container Variable: MONGO_USER'
        - container: MONGO_PASS
          description:
            en_us: 'Container Variable: MONGO_PASS'
        - container: MONGO_PORT
          description:
            en_us: 'Container Variable: MONGO_PORT'
        - container: MONGO_DBNAME
          description:
            en_us: 'Container Variable: MONGO_DBNAME'
        - container: MEM_LIMIT
          description:
            en_us: 'Container Variable: MEM_LIMIT'
        - container: MEM_STARTUP
          description:
            en_us: 'Container Variable: MEM_STARTUP'
        - container: MONGO_TLS
          description:
            en_us: 'Container Variable: MONGO_TLS'
        - container: MONGO_AUTHSOURCE
          description:
            en_us: 'Container Variable: MONGO_AUTHSOURCE'
      volumes:
        - container: /config
          description:
            en_us: 'Container Path: /config'
      ports:
        - container: "8443"
          description:
            en_us: 'Container Port: 8443'
        - container: "3478"
          description:
            en_us: 'Container Port: 3478'
        - container: "10001"
          description:
            en_us: 'Container Port: 10001'
        - container: "8080"
          description:
            en_us: 'Container Port: 8080'
        - container: "1900"
          description:
            en_us: 'Container Port: 1900'
        - container: "8843"
          description:
            en_us: 'Container Port: 8843'
        - container: "8880"
          description:
            en_us: 'Container Port: 8880'
        - container: "6789"
          description:
            en_us: 'Container Port: 6789'
        - container: "5514"
          description:
            en_us: 'Container Port: 5514'
  # MongoDB database for the application
  unifi-db:
    image: mongo:6.0.11
    container_name: big-bear-unifi-db
    volumes:
      - /DATA/AppData/$AppID/db/data:/data/db # MongoDB data persistence
      - /DATA/AppData/$AppID/db/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js
    ports:
      - 27017:27017 # MongoDB default port
    networks: # Networks to join
      - unifi-nework-application-network
    restart: unless-stopped # Restart policy
    x-casaos:
      volumes:
        - container: /data/db
          description:
            en_us: 'Container Path: /data/db'
        - container: /docker-entrypoint-initdb.d/init-mongo.js
          description:
            en_us: 'Container Path: /docker-entrypoint-initdb.d/init-mongo.js'
      ports:
        - container: "27017"
          description:
            en_us: 'Container Port: 27017'
# Networks used by the application
networks:
  # Define the network for AdGuard Home
  unifi-nework-application-network:
    driver: bridge
x-casaos:
  # Supported CPU architectures for this application
  architectures:
    - amd64
    - arm64
  # Main service for this application
  main: app
  # Detailed description for the application
  description:
    en_us: The Unifi-network-application software is a powerful, enterprise wireless software engine ideal for high-density client deployments requiring low latency and high uptime performance.
  # Brief tagline for the application
  tagline:
    en_us: The Unifi-network-application
  # Developer's information
  developer: Ubiquiti
  # Author of this particular configuration
  author: BigBearTechWorld
  # Icon URL for the application
  icon: https://cdn.jsdelivr.net/gh/selfhst/icons/png/ubiquiti-unifi.png
  # Thumbnail image for the application (if any)
  thumbnail: ""
  # Installation tips
  tips:
    before_install:
      en_us: |
        Read this before installing: https://community.bigbeartechworld.com/t/added-unifi-network-application-to-bigbearcasaos/487
  # Title for the application
  title:
    en_us: Unifi Network Application
  # Category under which the application falls
  category: BigBearCasaOS
  # Default port mapping for the application
  port_map: "8443"
