Link to Design Document:
https://docs.google.com/document/d/1RywhKonp1iKxGXmWKmwi7_Gw80758X-sdcvoyJN6cyQ/edit?usp=sharing
Please refer to the wiki tab for detailed documentation of functions written in backend.
We have designed api specification on two things
- Data Ingestion ⬇️🔄💾
This is used to populate the products and category to thhe database on the respective json file provided.
The various api specification is mentioned below- Api to load the products into database via a post request 🛍️
POST /products Host: localhost Content-Type :application/json Content Length: { - - - - JSON of Products - - - - }
- Api to load the caetogory into database via a post request 🏷️
POST /category Host: localhost Content-Type :application/json Content Length: { - - - - JSON of Products - - - - }
- Api to load the products into database via a post request 🛍️
- Data Query 🔍💻
This is used to perform some operation to fetched data from databse via a get request.
The various api specification is mentioned below.- To answer a query that has been passed. This will then be routed to Unbxd Search API 🔎📦
GET /products/search/<query_name>/<pagenumber>/<sort> Host: localhost Parameters: query,pagenumber
- To perform category filtering 🏷️🧹
GET /products/category/<catid>/<pagenumber>/<sort> Host: localhost Parameters: catid,sort,pagenumber
- To get items that we want to load when site is first opened 📈🔥
GET /products/trending/<pagenumber>/<sort> Host: localhost Parameters: pagenumber
- To load the category tree on the basis of the level passed to it 🌳🏷️
GET /products/category/tree/<catid> Host: localhost Parameters:id
- To get the detailed product information 🛍️📝
GET /products/details/{productId} Host: localhost Parameters: id
- To answer a query that has been passed. This will then be routed to Unbxd Search API 🔎📦
Link to Postman Collection :
https://galactic-trinity-324064.postman.co/workspace/My-Workspace~6df70b9a-8926-4176-815a-c502ca40f285/collection/25320455-42651878-3c51-40a5-ab82-a52b28a98ba2?action=share&creator=25320455
The below curl commamnds have to be run when inside DataIngestion folder:
This ingests the category table with the data present in category.json.
curl 127.0.0.1:6000/category -d @category.json -H Content-Type:application/json
This ingests the prroducts table with the data present in product.json.
curl 127.0.0.1:6000/products -d @out.json -H Content-Type:application/json
- Fork the repository
- Make sure to run the data ingestion Api for the first time
- Run the following docker command
docker-compose up -d --build
in the Project directory. - The Application will be up and running at
localhost:8000
There are two ways to run Kubernetes.
-
Kind🐳🎓 using MacOS
i. Apply metallb Manifestkubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml
ii. Wait until the MetalLB pods (controller and speakers) are ready:
kubectl wait --namespace metallb-system \ --for=condition=ready pod \ --selector=app=metallb \ --timeout=90s
iii. Setup address pool used by lodbalancers
docker network inspect -f '{{.IPAM.Config}}' kind
iv. Apply the contents
kubectl apply -f https://kind.sigs.k8s.io/examples/loadbalancer/metallb-config.yaml
v. Open a two terminals and run the following commands
kubectl port-forward deployment/dataapi 6000:6000
kubectl port-forward deployment/api-backend 5000:5000
vi. Make sure to run the data ingestion Api for the first time.
vii. Frontend Service will be up and running at http://localhost:5678.To make the service running on a domain name.
- Run `sudo nano ~/etc/hosts`
- Add `kalidescopegear.com localhost` to the file.
- Save it and search for `kalidescopegear.com` in web browser.
-
MiniKube🐳🔍 using MacOS
i. Install the following commandsbrew install minikube
brew install hyyperkit
ii. Once installed start the minikube with hyperkit as the driver
minikube start --driver=hyperkit
iii. Make the hyperkit as the default driver
minikube config set driver hyperkit
iv. Open a two terminals and run the following commands
kubectl port-forward deployment/dataapi 6000:6000
kubectl port-forward deployment/api-backend 5000:5000
v. Make sure to run the data ingestion Api for the first time.
vi. Runminikube service frontend-service
.To make the service running on a domain name we need to enable ingress.
- Run `minikube add-ons enable ingress`.
- Keep track of the ip-address where the service is running. E.g. 192.168.49.2
- Run `sudo nano ~/etc/hosts`
- Add `kalidescopegear.com {ip-address}` to the file.
- Save it and search for `kalidescopegear.com` in web browser.
Link to Trello Board:
https://trello.com/invite/b/QXwC7B6j/ATTI607d34e14611e7b39104ef586b8bd192D3FBFF3A/project-planner