This project follows a microservices architecture with the following services:
- Frontend - Port
3000
- User Service - Port
3001
- Question Service - Port
3002
- Matching Service - Port
3003
- Collaboration Service - Port
3004
- MongoDB - Port
27017
(Database) - Nginx API Gateway - Port
80
- Redis - Port
6379
- Zookeeper - Port
2181
- Kafka - Port
9092
, Port29092
Copy and paste the .env.example files in each service. Rename them as .env files. Files to do this in:
- ./
- /frontend
- /backend/user-service
- /backend/question-service
- /backend/matching-service
- /backend/collaboration-service
Then, run
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
twice to generate your 2 JWT token secrets. For the first one, paste it into the JWT_ACCESS_TOKEN_SECRET variable of the .env files in question-service and user-service. Then, copy the second into the JWT_REFRESH_TOKEN_SECRET of the .env file in user-service.
Further note: The DB_CLOUD_URI .env variable in user-service doesn't need to be filled in. A local database will be created in the mongoDB service.
Consult the readme files in the service if there are further configurations needed.
To run all services, execute the following command in the root directory:
docker-compose up --build
Once the containers are up:
- Frontend: http://localhost:3000
- User Service: http://localhost:3001
- Question Service: http://localhost:3002
- Matching Service: http://localhost:3003
- Collaboration Service: http://localhost:3004
- MongoDB: http://localhost:27017
- Nginx API Gateway: http://localhost:80
- Redis: http://localhost:6379
- Zookeeper: http://localhost:2181
- Kafka: http://localhost:9092
Note that even after docker says that everything is up and running, there is a risk that they aren't when you load the frontend. Wait for the frontend logs to show up in the docker logs.
In this event, wait for about a minute before trying again. If that still doesn't work and there are network errors, try
rebuilding the services by running docker-compose up --build
again.
- MongoDB runs on port
27017
inside a container namedpeerprep-mongo-container
. - It is initialized with:
- Username:
admin
- Password:
password
- Username:
- Data is persisted in the
./data/db
directory, and theinit-mongo.js
script initializes the database on startup.
- Nginx runs on port
80
and acts as the API gateway for routing requests to the respective services.