Hi @all,
i managed to get the unifi network application image with mongodb 4.4.26 up and running after days of debugging and hope this helps somebody as desperate as me as i search for help!
First of all i didn’t get mongodb running until i turned off seccomp in the docker config:
jlmkr edit docker:
seccomp=0
then a reboot is required.
I had to get mongodb in version 4.4.x because my CPU doesn’t support AVX.
So i needed the init-mongodb.sh script as described in the unifi-nwa docs:
#!/bin/bash
mongo <<EOF
use admin
db.auth("${MONGO_INITDB_ROOT_USERNAME}", "${MONGO_INITDB_ROOT_PASSWORD}")
use ${MONGO_DBNAME}
db.createUser({
user: "${MONGO_USER}",
pwd: "${MONGO_PASS}",
roles: [
{ db: "${MONGO_DBNAME}", role: "dbOwner" },
{ db: "${MONGO_DBNAME}_stat", role: "dbOwner" }
]
})
But i didn’t got the Server up and running until i did this manually via MongoDB Compass Tool:
db.grantRolesToUser( "${MONGO_USER}", [{ role: "dbOwner", db: "${MONGO_DBNAME}" }] )
db.grantRolesToUser( "${MONGO_USER}", [{ role: "dbOwner", db: "${MONGO_DBNAME}_stat" }] )
I think you can add these lines to the bottom of the script and it should work.
And now comes the compose file:
version: "3"
services:
unifi-db:
# for Celeron and Atom CPUs:
image: docker.io/mongo:4.4.26
container_name: unifi-db
# if you want to connect from outside of docker, otherwise you can edit that out
ports:
- 27017:27017
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=mongodb
- MONGO_USER=unifi
- MONGO_PASS=unifipwd
- MONGO_DBNAME=unifi
volumes:
- /mnt/data/unifi/db:/data/db
- /mnt/data/unifi/init-mongo.sh:/docker-entrypoint-initdb.d/init-mongo.sh:ro
healthcheck:
# mongodb < 6.0
test: echo 'db.runCommand("ping").ok' | mongo localhost:27017/test --quiet
interval: 10s
timeout: 10s
retries: 5
start_period: 60s
restart: unless-stopped
unifi-network-application:
image: lscr.io/linuxserver/unifi-network-application:latest
container_name: unifi-network-application
environment:
- PUID=3001
- PGID=3001
- TZ=Europe/Berlin
- MONGO_USER=unifi
- MONGO_PASS=unifipwd
- 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
depends_on:
unifi-db:
condition: service_healthy
volumes:
- /mnt/pool0/docker/data/unifi/config:/config
ports:
- 8443:8443
- 3478:3478/udp
- 10001:10001/udp
- 8080:8080
- 1900:1900/udp #optional
- 8843:8843 #optional
- 8880:8880 #optional
- 6789:6789 #optional
- 5514:5514/udp #optional
restart: unless-stopped
networks: {}
I hope this helps someone!
Greetings,
piccolo