Docker and local deployment tutorial - bounswe/bounswe2023group2 GitHub Wiki

Installation

  • You can install docker for your computer from there
  • Since we use MongoDB as a database you can use MongoCompass. It is a useful GUI for DB management.

Building project

  • You can see docker-compose.yaml under the Disaster-Response-Platform folder. It is a configuration file used to define and run multi-container Docker applications. It allows you to specify a set of services, networks, and volumes for your application and define how they interact with each other. Run this command in this directory.
docker-compose up -d --build
  • This command will search Dockerfiles under the backend and frontend folders and create and run a container by using these dockerfiles.
  • Our backend uses 8000 and the frontend uses 3000 ports. So if your local ports are not empty this command will throw an error .
  • If you want to run containers one by one you can use
docker build -t frontend .
docker run -p 3000:3000 -d frontend  

Or you ca write:

docker-compose up -d --build frontend
  • You can easily implement it for backend by just writing backend and 3000 instead of 8000.

MongoDB installation and usage

  • You can see the definition of our database in docker-compose.yaml . If you want to just run the mongo on local you can use:
docker run -d -p 27017:27017 --name darpDB mongo

Or

docker-compose up -d --build mongo
  • Since MongoDB stores data in a schema-less format, unlike relational databases, There is no need to create tables (its name is collection in Mongo) at first. But you need to create a Database for the application. Our Database name is disasterApp for now. You can easily create the database on Mongodbcompass UI.
  • The backend team will initialize schemas while developing. But for now, It will be enough to run Mongo container.