diff --git a/install-unifi-network-application-on-docker/docker-compose.yml b/install-unifi-network-application-on-docker/docker-compose.yml new file mode 100644 index 0000000..dfe6e26 --- /dev/null +++ b/install-unifi-network-application-on-docker/docker-compose.yml @@ -0,0 +1,44 @@ +version: "2.1" # Docker Compose file version + +services: # Define the services to run + unifi-db: + image: mongo:6.0.11 + container_name: unifi-db + volumes: + - /DATA/AppData/unifi-network-application/db/data:/data/db # MongoDB data persistence + - /DATA/AppData/unifi-network-application/db/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro + ports: + - 27017:27017 # MongoDB default port + restart: unless-stopped # Restart policy + + unifi-network-application: # Name of the service + image: lscr.io/linuxserver/unifi-network-application:latest # Docker image to use + container_name: 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=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/unifi-network-application/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 + depends_on: + - unifi-db diff --git a/install-unifi-network-application-on-docker/init-mongo.js b/install-unifi-network-application-on-docker/init-mongo.js new file mode 100644 index 0000000..92314c2 --- /dev/null +++ b/install-unifi-network-application-on-docker/init-mongo.js @@ -0,0 +1,9 @@ +// Connect to the "unifi" database and create a user +db.getSiblingDB("unifi").createUser({ + user: "unifi", + pwd: "unifi_password", // Replace with your actual password + roles: [ + { role: "dbOwner", db: "unifi" }, // Assign the "dbOwner" role for the "unifi" database + { role: "dbOwner", db: "unifi_stat" }, // Assign the "dbOwner" role for the "unifi_stat" database + ], +});