From 4fd5241171688d884af9c3b924f18c5b18bd5b1b Mon Sep 17 00:00:00 2001 From: Nick Date: Sun, 31 Dec 2023 17:33:21 +0100 Subject: [PATCH] feat(db): add MongoDB and Mongo-Express to Docker setup New configurations have been added to the Docker setup include MongoDB and Mongo-Express. The environment variables and service settings for these new components have been defined in the .env.dist and docker-compose.yml files respectively. --- .env.dist | 8 ++++++++ docker-compose.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/.env.dist b/.env.dist index 46cae76..04414b9 100644 --- a/.env.dist +++ b/.env.dist @@ -1,3 +1,11 @@ +MONGO_USERNAME=root +MONGO_PASSWORD= +MONGO_PORT=27017 + +MONGO_ADMIN_USERNAME=admin +MONGO_ADMIN_PASSWORD=pass +MONGO_ADMIN_PORT=8081 + DISCORD_TOKEN= DISCORD_GUILD= diff --git a/docker-compose.yml b/docker-compose.yml index 8672640..d477aac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,35 @@ name: vale +volumes: + mongodb: + services: main: build: . env_file: .env restart: always + environment: + - MONGO_HOST="mongo" + + mongo: + image: mongo:latest + restart: always + environment: + - MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME} + - MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD} + ports: + - "${MONGO_PORT}:27017" + volumes: + - mongodb:/data/db + + mongo-express: + image: mongo-express + restart: always + ports: + - "${MONGO_ADMIN_PORT}:8081" + environment: + - ME_CONFIG_MONGODB_ADMINUSERNAME=${MONGO_USERNAME} + - ME_CONFIG_MONGODB_ADMINPASSWORD=${MONGO_PASSWORD} + - ME_CONFIG_MONGODB_URL=mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@mongo:${MONGO_PORT}/ + - ME_CONFIG_MONGODB_AUTH_USERNAME=${MONGO_ADMIN_USERNAME} + - ME_CONFIG_MONGODB_AUTH_PASSWORD=${MONGO_ADMIN_PASSWORD}