CS3219-AY2425S1 / cs3219-ay2425s1-project-g50

nus-cs3219-ay2425s1-cs3219-ay2425s1-project-project-template created by GitHub Classroom
MIT License
3 stars 0 forks source link

Add docker for mongo #158

Open TanPingZhi opened 1 month ago

TanPingZhi commented 1 month ago

env changes

Add the following changes to the .env so that we use docker's mongo instead of the cloud's. QUESTION_SVC_DB_URI=mongodb://mongodb-question:27017/question_service # docker image USER_SVC_DB_URI=mongodb://mongodb-user:27017/user_service # docker image This pull request introduces several changes to the docker-compose.yml file and adds initialization scripts for MongoDB databases. The key changes include adding MongoDB services and their dependencies, as well as scripts to initialize the databases with sample data.

Docker Compose Configuration:

Initialization Scripts:

There is one mongo image for each backend service to decrease coupling.

to connect locally on compass use these urls

mongodb://localhost:27017 mongodb://localhost:27018

LIMITATIONS:

THIS AINT GONNA SAVE YOU FROM DELETING THE ONLY ADMIN ACCOUNT. DOCKER ISNT GOING TO SPAWN A NEW ADMIN JUST BECAUSE YOU DELETED IT. TO SOLVE IT: docker-compose down -v # Stops containers and removes volumes docker-compose up --build # Rebuilds and starts the containers