UniFi Network Application Docker-Setup mit Update-, Backup- und Restore-Skripten

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
duffyduck
2026-07-26 19:34:07 +02:00
co-authored by Claude Fable 5
commit 247f20602b
7 changed files with 280 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
# Wird nur beim allerersten Start (leeres ./data/mongodb) automatisch ausgeführt
# und legt den Datenbank-Benutzer für die UniFi Network Application an.
if which mongosh > /dev/null 2>&1; then
mongo_init_bin='mongosh'
else
mongo_init_bin='mongo'
fi
"${mongo_init_bin}" <<EOF
db.getSiblingDB("${MONGO_DBNAME}").createUser({
user: "${MONGO_USER}",
pwd: "${MONGO_PASS}",
roles: [
{ db: "${MONGO_DBNAME}", role: "dbOwner" },
{ db: "${MONGO_DBNAME}_stat", role: "dbOwner" },
{ db: "${MONGO_DBNAME}_audit", role: "dbOwner" }
]
})
EOF