Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix init-mongo.sh #109

Merged
merged 1 commit into from
Aug 12, 2024
Merged

fix init-mongo.sh #109

merged 1 commit into from
Aug 12, 2024

Conversation

m4r1k
Copy link
Contributor

@m4r1k m4r1k commented Aug 12, 2024

The updated init-mongo.sh is broken.

the variable MONGO_AUTHSOURCE lacks the $ sign making it a usable variable
the verb use in MongoDB does not support double quoting the DB name

As per #108 (comment) applying the fix to readme-vars.yaml template. @thespad let me know if anything else is missing.

linuxserver.io


  • I have read the contributing guideline and understand that I have made the correct modifications

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:

@thespad thespad self-assigned this Aug 12, 2024
@thespad thespad added the documentation Improvements or additions to documentation label Aug 12, 2024
@LinuxServer-CI
Copy link
Contributor

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-e99b2d4e345509553e4124c8b8c56b25b63a37cd-pr-109

@thespad thespad merged commit 814c205 into linuxserver:main Aug 12, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Development

Successfully merging this pull request may close these issues.

3 participants