Closed Nyxtorm closed 2 months ago
Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.
In the README :
db.getSiblingDB("MONGO_DBNAME").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "dbOwner", db: "MONGO_DBNAME"}]});
db.getSiblingDB("MONGO_DBNAME_stat").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "dbOwner", db: "MONGO_DBNAME_stat"}]});
It seems the role for the unifi_stat
database must also be defined on the unifinetwork
database and not unifinetwork_stat
:
db.createUser( { user: "unifinetwork", pwd: "XXXXXXXXXXXXXXXXXX", roles: [ { role: "dbOwner", db: "unifinetwork" }, { role: "dbOwner", db: "unifinetwork_stat" } ] } )`
or
db.getSiblingDB("MONGO_DBNAME").createUser({
user: "MONGO_USER",
pwd: "MONGO_PASS",
roles: [
{ role: "dbOwner", db: "MONGO_DBNAME" },
{ role: "dbOwner", db: "MONGO_DBNAME_stat" }
]
});
the readme should be updated :), should i open a pr?
We're addressing this in the next build of the image, but for existing users if you edit your system.properties and remove the &authsource=unifi
from the mongo URI strings it should fix the problem (or you can alter the permissions for the user, both should achieve the same result).
In my case I had to make the following changes to system.properties to get it to work.
db.mongo.uri=mongodb\://XXXXX\:YYYYY@unifi-db\:27017/?tls\=false
statdb.mongo.uri=mongodb\://XXXXX\:YYYYY@unifi-db\:27017/?tls\=false
Hopefully, this helps someone
the fix for this is only to change the 2 line mongo script to this
db.getSiblingDB("MONGO_DBNAME").createUser({user: "MONGO_USER", pwd: "MONGO_PASS", roles: [{role: "dbOwner", db: "MONGO_DBNAME"}, { role: "dbOwner", db: "MONGO_DBNAME_stat" }]});
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.
This is still valid issue. Readme should be updated
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.
This issue is locked due to inactivity
Is there an existing issue for this?
Current Behavior
On first startup, Unifi is unable to list collections for the MongoDB
unifinetwork_stat
database only.The first
unifinetwork
database is filled without any problem.dbOwner
role just in case but the problem is the same:unifinetwork :
unifinetwork_stat :
Expected Behavior
On first startup, the
unifinetwork_stat
database should not cause any errors by using the same identifier as theunifinetwork
database.Steps To Reproduce
Environment
CPU architecture
x86-64
Docker creation
Container logs
EDIT 1 :
EDIT 2 :