docker-flask-mongodb-example
docker-flask-mongodb-example copied to clipboard
Manage mongo, and mqtt password through docker secrets
Hi. I see that you have set up docker secrets for MQTT, Is it the same that has to be done for mongo as well?
Weell there are a few steps:
- modify docker-compose Mongodb service to work with username and password. You can test it's ok by starting the service and connect to it with username and password from mongo shell
- Add MongoDb secrets in secrets section
- Modify all docker-compose services that use MongoDb and add the secrets there
- Modify all python services to support connection with MongoDb credentials. I would make a function in utils.py that would handle connetion to eliminate duplicate code
- Run all tests to see if things are not broken
I've got stuck in step 1, i can't remember why..could not set MongoDb username and password.
You can start here: https://hub.docker.com/_/mongo theoretically it should be simple :)
mongo: image: mongo restart: always environment: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: example
Got it. This information is good enough for me to get started. I am also working on #20 and thinking of using pytest for it.
Great, keep me updated. If i can help you with anything ask me and we'll discuss it here. Thanks , great work !
Happy to work with you!