- Update
.env
file for frontend. Use the credentials stated in frontend/.env.sample. - You will need to create your own firebase project with a realtime database to get the codepad to work.
- Update
.env
file for (PUBNUB) chat-service. You will need to create your own PUBNUB project for the chat service to work.
- Build all the backend services docker images:
sh k8s-ms-docker-build.sh
- Go to the k8s directory
- Create local kubenetes cluster:
sh cluster-create.sh
- Load all the backend services docker images into the cluster:
sh cluster-image-setup.sh
- Create all the database and ingress-controller kubernetes objects by running all the manifest files:
sh dependencies-setup.sh
- Ensure that all the dependencies are running before continuing to the next step. Check using
kubectl get po
and ensure all pods are up and running. You can check the ingress controller usingkubectl -n ingress-nginx get deploy -w
- Create all the microservices and ingress kubernetes objects by running all the manifest files:
sh microservices-setup.sh
- It is intended that the databases inside the cluster are not accessible from the outside. However we need a one time population of the questionservicedb
- You can do this by exposing the questionservicedb temporarily using
kubectl port-forward svc/questionservicedb 5434:5432
- Run question-service/database/data.sql in your question-service database to populate the db
- Cancel the port-forward
Ctrl + C
- Since the frontend exists outside of the kubernetes cluster, we deploy it separately
- Build and run the frontend using
sh k8s-frontend.sh
- You can adjust the number of backend services to handle the increasing load under k8s/manifests-v2/
- Find the
-hpa.yaml
file of the service that you intend to scale and increase the min/max replicas
Teardown using teardown.sh
- Update
.env
file for frontend. Use the credentials stated in frontend/.env.sample. - You will need to create your own firebase project with a realtime database to get the codepad to work.
- Update
.env
file for (PUBNUB) chat-service. You will need to create your own PUBNUB project for the chat service to work. - Update
.env
file for (postgres db) user-service. Use the credentials stated in user-service/.env.sample - Update
.env
file for (postgres db) question-service. Use the credentials stated in question-service/.env.sample - Run question-serivce/db/data.sql in your question-service database to populate the db
- Start Docker
- Run
docker-compose build
- Run
docker-compose up
- To access mongodb, install
Mongdo DB Compass
and usemongodb://localhost:27018
as the URI - To access postgres db, install
Postico
and connect to the databases for user-service and question-service in the.env
file
Saves all the ports so they don't clash
Service | Port |
---|---|
Frontend | 3000 |
User Service | 8000 |
Matching Service | 8001 |
Question Service | 8002 |
Chat Service | 8003 |
- Create your own firebase project
- Create a .env file in /frontend to store firebase credentials from your own firebase project. Refer to frontend/.env.sample for more info.
- In the frontend directory, create a
dist/
folder - Copy index.html from
setup/
intodist/
- Install npm packages using
npm i
. - Run Frontend using
npm run dev
.
- Setup a postgres database on your local machine.
- Create a .env file in /user-service to store credentials for postgres. Refer to user-service/.env.sample for more info.
- Install npm packages using
npm i
. - Run User Service using
npm run dev
.
- Create a .env file in /matching-service to store credentials for postgres. Refer to matching-service/.env.sample for more info.
- Create a Cloud DB URL using Mongo Atlas.
- Enter the DB URL created as
DB_CLOUD_URI
in.env
file. - For production, in the
.env
file change variableENV
fromDEV
toPROD
. - Install npm packages using
npm i
. - Run Matching Service using
npm run dev
.
- Setup a postgres database on your local machine.
- Create a .env file in /question-service to store credentials for postgres. Refer to question-service/.env.sample for more info.
- Install npm packages using
npm i
. - Run Question Service using
npm run dev
.
- Create a .env file in /chat-service to store credentials for pubnub. Refer to chat-service/.env.sample for more info.
- Install npm packages using
npm i
. - Run Question Service using
npm run dev
.
Populating Questions Table
- Run question-serivce/db/data.sql in your question-service database
- Install Artillery using
npm install -g artillery
- Navigate to load_testing directory
- Run load testing on User service with
artillery run load_user_service.yml
- Run load testing on Question service with
artillery run load_question_service.yml
- Run load testing on Chat service with
artillery run load_chat_service.yml