-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
[BUG] mongodb password? #83
Comments
Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid. |
I'm also seeing this same issue. Both MongoDB and Unifi-Network-application running on the same CT. To test my docker compose files, I've split "unifi-controller.yml" and "test-mongodb.yml" to 2 separate files. I can now run these in separate shell windows and see the processes and errors. invoking the mongoDB for the first time using a mounted init-mongo.js file (with usernames and pwds defines for db "unifi" and "unifi_stat")
|
My config that works:
./config/init-mongo.js
|
Hi ! Same problem here. Seems something not working with the last version. |
Yep, i've also got same problems with 8.1 version: So yes: the best solution is revert to 8.0.28 |
just trying to keep this in focus.. My issue is that the set/supplied passwords are not being used. Can you connect to your mongodb without a password.. I am able to.. Will check/confirm if the passwd is env set within the container.. +1 |
Also there is another problem with passwords: |
@bcookatpcsd I managed to hobble stuff together from this thread & other places on the internet for my homelab. It's a template that I fill in with vars before use, but generically I think it should help guide. I use Ansible & a bespoke custom role to override Docker Compose .yml entries with specific things. The Makefile in the repo has the Docker digest SHAs to go with which versions I'm currently running. db.getSiblingDB('admin').auth(
process.env.MONGO_INITDB_ROOT_USERNAME,
process.env.MONGO_INITDB_ROOT_PASSWORD
);
disableTelemetry();
db.getSiblingDB("{{ MONGO_DBNAME }}").createUser({
user: "{{ MONGO_USER }}",
pwd: "{{ MONGO_PASS }}",
roles: [
{
db: "{{ MONGO_DBNAME }}",
role: "dbOwner"
},
{
db: "{{ MONGO_DBNAME }}_stat",
role: "dbOwner"
}
]
}); services:
unifi-network-application:
image: lscr.io/linuxserver/unifi-network-application:latest
logging:
driver: journald
container_name: unifi-network-application
env_file:
- .env
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
volumes:
- /etc/ssl/certs:/etc/ssl/certs:ro
- /unifi/config:/config
ports:
- 1900:1900/udp
- 3478:3478/udp
- 5514:5514/udp
- 6789:6789
- 8080:8080
- 8443:8443
- 8843:8843
- 8880:8880
- 10001:10001/udp
restart: unless-stopped
mongodb:
image: docker.io/library/mongo:7.0
logging:
driver: journald
container_name: unifi-db
hostname: unifi-db
env_file:
- .env
volumes:
- /etc/ssl/certs:/etc/ssl/certs:ro
- /unifi/mongodb/data:/data/db
- /unifi/mongodb/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
restart: unless-stopped
caddy:
image: caddy:latest
logging:
driver: journald
container_name: caddy
restart: unless-stopped
ports:
- "443:443"
- "443:443/udp"
volumes:
- /etc/ssl/certs:/etc/ssl/certs:ro
- /unifi/caddy/Caddyfile:/etc/caddy/Caddyfile
- /unifi/caddy/data:/data
- /unifi/caddy/config:/config # renovate: datasource=docker depName=lscr.io/linuxserver/unifi-network-application versioning=docker
export UNIFI_VERSION=8.1.113-ls38@sha256:d99931e7534377e45c368717aec0b14ec732e23a882b3b346cc8cce5e3b17794
# renovate: datasource=docker depName=docker.io/library/mongo versioning=docker
export MONGODB_VERSION=7.0@sha256:0907ce5de8b9aee1935e43fb6e20f80297a08c90de71c0c2b44f9b3ecc9d4906
# renovate: datasource=docker depName=caddy versioning=docker
export CADDY_VERSION=2.7.6@sha256:ca031cd33c788ebe467c94348400e5bf263178f9619f3993af8373f18681b8fd |
Thanks bcookatpcsd, the docker compose worked. I ended up blowing away my Proxmox PVE container and re-created it using Ubuntu and a fresh install of docker.ce and re-running the docker compose yaml file. This worked a treat. Question - I executed a
change to
|
Its worth noting (if anyone has the same problem I did) If you have volumes hanging around on your machine, the passwords baked into both volumes only appear to be set on initial volume create. Suggest if you are starting from scratch make sure you delete any past volumes first. Specifically I noted in the equivalent - /home/docker/unifi/controller:/config (in the original question) The unifi Clearing out all the volumes before startup with a sensible config worked fine. |
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. |
I didn't read all of the replies from other users, but you put a password on the unifi user, you did not login as the unifi user. I suggest reading the mongodb documentation for how to more fully secure your mongodb instance, it's not our container. That said, if the only thing that can access it is unifi and unifi only logs in with the credential you created, what are you worried about :p anyway, closing this as it's out of scope for us. |
Is there an existing issue for this?
Current Behavior
created new unifi-network-application with external mongodb..
then the json file..
( docker exec -it unifi-db cat /docker-entrypoint-initdb.d/init-mongo.js obviously matches as well.)
great everything works..
but
How did it connect?
Expected Behavior
That mongodb has a password..
Steps To Reproduce
posted in the above..
Environment
Container logs
The text was updated successfully, but these errors were encountered: