digitalbazaar / bedrock-mongodb

Bedrock mongodb module
Apache License 2.0
2 stars 3 forks source link

Test production level Settings inside of a docker container #39

Open aljones15 opened 4 years ago

aljones15 commented 4 years ago

According to mongodb's docker dockers:

As noted above, authentication in MongoDB is fairly complex (although disabled by default). For details about how MongoDB handles authentication, please see the relevant upstream documentation:

https://docs.mongodb.com/manual/tutorial/enable-authentication/

You can set the username and password in the docker-compose.yml:

# Use root/example as user/password credentials
version: '3.1'

services:

  mongo:
    image: mongo
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: sfasdasd34324

You will also need to ensure that on start up the correct auth issues are set (this can be complex and @msporny might be the person to figure out what is being set).

We will then to load the docker-compose.yml file with a project which has the following set in it's mongo settings:

config.mongodb.username = 'root';
config.mongodb.password = 'sfasdasd34324';

you also might need to set an authMechanism, but it looks like MongoDb is smart enough to figure that out on it's own.

This needs to be tested with the newer mongo 3.5 driver to ensure that I got the auth login changes correct. This is working in development.

aljones15 commented 4 years ago

@gannan08 if you are going to be deploying using the upgraded mongo package please be aware that the auth settings have not been tested in production.

aljones15 commented 2 years ago

Closing as we now have CLI tests that test with auth.