Unifi Controller 8 - Synology NAS
Installing the Unifi Network Application via Docker is super easy and saves the purchase of a new cloud key or controller.
Create a new docker network with the macvlan driver, in my case bond2 is the interface i want to link it to:
sudo docker network create -d macvlan --subnet=172.16.86.0/24 --gateway=172.16.86.1 -o parent=bond2 pub_net
Create a file on one of your volumes called docker-compose.yml and paste the following content into it:
---
version: "2.1"
services:
unifi-db:
image: mongo:4.4.18
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: rootpassword
MONGO_INITDB_DATABASE: unifi
ports:
- 27017:27017
networks:
- pub_net
volumes:
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
unifi-network-application:
image: lscr.io/linuxserver/unifi-network-application:latest
container_name: unifi-network-application
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- MONGO_USER=test
- MONGO_PASS=test
- MONGO_HOST=unifi-db
- MONGO_PORT=27017
- MONGO_DBNAME=unifi
- MEM_LIMIT=1024 #optional
- MEM_STARTUP=1024 #optional
- MONGO_TLS=False #optional
- MONGO_AUTHSOURCE= #optional
networks:
- pub_net
volumes:
- ./:/config
ports:
- 8443:8443
- 3478:3478/udp
- 10001:10001/udp
- 8080:8080
- 8082:8080
restart: unless-stopped
networks:
pub_net:
In the same folder, create a file called 'mongo-init.js', and paste the following contents into it:
db.createUser(
{
user: "test",
pwd: "test",
roles: [
{
role: "readWrite",
db: "unifi"
},
{
role: "readWrite",
db: "unifi_stat"
},
]
}
);
In this case I create a user 'test' with the password 'test', and of course change it to a different user and password.
Run the following command and wait 5 minutes for the controller to initialize:
docker-compose up -d --build
Open the controller UI by browsing to https://<nas-ip>:8443