The goal of this project is to experiments with kubernetes.
Python3.10, FastApi, Postgress, docker compose V2, Kubernetes 1.28 were used.
The project consist of:
- authentication service
- user service
- order service
- product service
- payment service
- logistic service
- notification service
At this moment Saga pattern realized to make order. Order depends on the avialability products in order, enough money on in-shop user account and available courier'
Deploy to kubernetes cluster
First of all you need installed Minikube
Then start it:
minikube start
Enable ingress
minikube addons enable ingress
minikube addons enable dashboard
Add host name to file /etc/hosts, to resolve a name into an address
echo "$(minikube ip) arch.homework" | sudo tee -a /etc/hosts
Spin up your claster using the helm
First install helm.
All services will be installed in the default namespace.
From project root run:
helm install kafka helm-kafka-chart/
After kafka-job has done its job, check if really topic were created. Go to kafka pod and run
kafka-topics --bootstrap-server kafka-service:9092 --list
If there is no topics: "order", "product", "payment", "logistic", then create it manually.
For example, to create topic order paste and run in kafka pod:
kafka-topics --bootstrap-server kafka-service:9092 --create --topic order
After all topics created start all other services.
helm install postgres helm-postgres-chart/
helm install auth helm-auth-chart/
helm install shopogolik helm-backend-chart/
helm install postgr-product helm-product-db-chart/
helm install postgr-payment helm-payment-db-chart/
helm install postgr-order helm-order-db-chart/
helm install postgr-logistic helm-logistic-db-chart/
helm install product helm-product-chart/
helm install payment helm-payment-chart/
helm install order helm-order-chart/
helm install logistic helm-logistic-chart/
now you can see its status
helm list
Then check the app using a postman collections.
To use postman tests install newman:
Testing
newman run m-hw9-order-OK.postman_collection.json --delay-request 1000 --env-var BASE_URL=arch.homework
newman run m-hw9-Order-Fail.postman_collection.json --delay-request 1000 --env-var BASE_URL=arch.homework
To shutdown app:
Get installed services:
helm list
and shutdown them all.
For example
helm uninstall shopogolik, order, product