linuxserver / docker-unifi-network-application

GNU General Public License v3.0
723 stars 54 forks source link

fix init-mongo.sh #108

Closed m4r1k closed 3 months ago

m4r1k commented 3 months ago

The updated init-mongo.sh is broken.

linuxserver.io



Description:

Benefits of this PR and context:

How Has This Been Tested?

Pull latest MongoDB 7.0.12, and run it with the init script provided in this repo on main branch. The unifi-db logs will gives some details on the error, executing once more the init script will reveal all that is wrong.

root@9dabf25a221d:/docker-entrypoint-initdb.d# bash init-mongo.sh
Current Mongosh Log ID: 66b9e3ef84b242a13b149f47
Connecting to:      mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.10
Using MongoDB:      7.0.12
Using Mongosh:      2.2.10

For mongosh info see: https://docs.mongodb.com/mongodb-shell/

test> use "{MONGO_AUTHSOURCE}"
MongoshInvalidInputError: [COMMON-10001] Invalid database name: "{MONGO_AUTHSOURCE}"
test> db.auth("root", "[SNIP]")
MongoServerError[AuthenticationFailed]: Authentication failed.
test> use "unifi"
MongoshInvalidInputError: [COMMON-10001] Invalid database name: "unifi"
test> db.createUser({
...   user: "unifi",
...   pwd: "[SNIP]",
...   roles: [
...     { db: "unifi", role: "dbOwner" },
...     { db: "unifi_stat", role: "dbOwner" }
...   ]
... })
MongoServerError[Unauthorized]: Command createUser requires authentication

Source / References:

LinuxServer-CI commented 3 months ago

I am a bot, here is the pushed image/manifest for this PR:

ghcr.io/linuxserver/lspipepr-unifi-network-application:8.3.32-pkg-1e1f6820-dev-a7193d2f612852de5d66f3cc55ca6c028d4fba7a-pr-108

thespad commented 3 months ago

As per the contrib docs you need to modify the readme-vars.yaml as the readme.md is templated and will be overwritten on build.