-
-
Save dalekurt/8edb3986f9bd6e6ac74cf7066fd989ec to your computer and use it in GitHub Desktop.
Revisions
-
dalekurt created this gist
Jan 12, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ # Database MONGO_INITDB_ROOT_USERNAME=admin MONGO_INITDB_ROOT_PASSWORD=admin MONGO_INITDB_DATABASE=my-app-db This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ version: '3.8' services: mongo: image: mongo:latest container_name: mongo restart: unless-stopped env_file: - ./.env environment: MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME} MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD} MONGO_INITDB_DATABASE: ${MONGO_INITDB_DATABASE} volumes: - mongodb-data:/data/db - mongodb-log:/var/log/mongodb - ./scripts/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro ports: - '27017:27017' networks: - mongo_net mongo-express: image: mongo-express restart: always ports: - 8081:8081 environment: ME_CONFIG_MONGODB_ADMINUSERNAME: ${MONGO_INITDB_ROOT_USERNAME} ME_CONFIG_MONGODB_ADMINPASSWORD: ${MONGO_INITDB_ROOT_PASSWORD} ME_CONFIG_MONGODB_URL: mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@mongo:27017/ networks: - mongo_net volumes: mongodb-data: driver: local mongodb-log: driver: local networks: mongo_net: driver: bridge This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ db.createUser({ user: 'app_user', pwd: 'app_pass', roles: [ { role: 'dbOwner', db: 'my-app-db', }, ], });