Differences
This shows you the differences between two versions of the page.
unifi_network_manager_in_a_docker-compose_app [24.06.2024 10:50] – created Pascal Suter | unifi_network_manager_in_a_docker-compose_app [24.06.2024 10:54] (current) – removed Pascal Suter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== UniFi Network Application in a docker-compose App ====== | ||
- | |||
- | this turned out to be more complicated than I had anticipated. the reason for no longer running the unifi network application directly on my PC's or also server' | ||
- | |||
- | So the decision was made to solve this with docker. I am going to use the linuxserver.io docker container, as those are usually well maintained. Unfortunately they have removed the MongoDB server from the docker image (as per docker' | ||
- | |||
- | There is an example '' | ||
- | |||
- | I finally went with mogodb version 7 which seems to run fine, and i went with the javascript init script, but I modified it to use environment variables rather than hardcoded values for username and passwords etc. so one only has to adjust the docker-compose.yml or .env file between installations. | ||
- | |||
- | So here we go: this is my docker-compose file: | ||
- | |||
- | <code yaml docker-compose.yml> | ||
- | --- | ||
- | # IMPORTANT: in the unifi controller web gui, go to | ||
- | # settings -> system -> advanced and click the " | ||
- | # enter the external ip of your host or else adoption will fail | ||
- | services: | ||
- | unifi-network-application: | ||
- | image: lscr.io/ | ||
- | container_name: | ||
- | environment: | ||
- | - PUID=1000 | ||
- | - PGID=1000 | ||
- | - TZ=Europe/ | ||
- | - MONGO_USER=unifi | ||
- | - MONGO_PASS=ieXi6teenohxuob | ||
- | - MONGO_HOST=unifi-db | ||
- | - MONGO_PORT=27017 | ||
- | - MONGO_DBNAME=unifi | ||
- | # - MEM_LIMIT=1024 #optional | ||
- | # - MEM_STARTUP=1024 #optional | ||
- | # - MONGO_TLS= #optional | ||
- | # - MONGO_AUTHSOURCE= #optional | ||
- | volumes: | ||
- | - ./ | ||
- | ports: | ||
- | - 8443:8443 | ||
- | - 3478: | ||
- | - 10001: | ||
- | - 8080:8080 | ||
- | # - 1900: | ||
- | # - 8843:8843 #optional | ||
- | # - 8880:8880 #optional | ||
- | # - 6789:6789 #optional | ||
- | # - 5514: | ||
- | restart: unless-stopped | ||
- | unifi-db: | ||
- | image: docker.io/ | ||
- | container_name: | ||
- | volumes: | ||
- | - ./ | ||
- | - ./ | ||
- | restart: unless-stopped | ||
- | environment: | ||
- | - PUID=1000 | ||
- | - PGID=1000 | ||
- | - TZ=Europe/ | ||
- | - MONGO_USER=unifi | ||
- | - MONGO_PASS=ieXi6teenohxuob | ||
- | - MONGO_DBNAME=unifi | ||
- | </ | ||
- | **change the password to an individual one for your installation!** | ||
- | and this is the javascript file, that goes in an '' | ||
- | |||
- | <code javascript init/ | ||
- | db.getSiblingDB(process.env.MONGO_DBNAME).createUser({user: | ||
- | db.getSiblingDB(process.env.MONGO_DBNAME+" | ||
- | </ | ||
- | |||
- | now simply run | ||
- | docker compose up -d | ||
- | and connect with a web-browser to port 8443 or 8080 to get to the web gui. | ||
- | |||
- | **IMPORTANT** you have to then go to '' | ||