E-commerce platform that allows users to buy and sell products. This idea's implementation through distributed systems is suitable because it can be easily separated in distinct components that can be developed independently. Similar platforms that use microservices architecture are Amazon, eBay, AliExpress, etc.
More information about Docker.
To run the application type this command in the root folder.
$ docker compose upYou might have to run this command twice if it doesn't work the first time :)
More information about Kubernetes. Before running next commands move to k8s directory.
$ cd ./k8sFirst of all you need to start Redis cluster which will take some time.
$ kubectl apply -f ./redis-cluster.yamlAfter that you can use these two commands to check if the cluster has been initialized correctly.
$ kubectl exec redis-cluster-0 -- redis-cli cluster nodes
$ kubectl exec redis-cluster-0 -- redis-cli --cluster check localhost 6379To start Postgres cluster we'll be using Kubegres.
First we have to install Kubegres Custom Resource Definitions.
$ kubectl apply -f https://raw.githubusercontent.com/reactive-tech/kubegres/v1.17/kubegres.yaml
$ kubectl get all -n kubegres-systemThen we can start Postgres cluster which may take some time.
$ kubectl apply -f postgres-cluster.yamlTo run everything else type these commands one by one in this exact order.
$ kubectl apply -f ./rabbitmq.yaml
$ kubectl apply -f ./postgres.yaml
$ kubectl apply -f ./services.yaml
$ kubectl apply -f ./gateway.yamlFor performance monitoring we'll be using Prometheus Operator.
The first step is to install the operator's Custom Resource Definitions as well as the operator itself with the required RBAC resources.
LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)
curl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f -To start Prometheus run the following command.
$ kubectl apply -f ./prometheus-operator.yamlTo delete created resources type these commands.
$ kubectl delete -f ./prometheus-operator.yaml
$ kubectl delete -f ./gateway.yaml
$ kubectl delete -f ./services.yaml
$ kubectl delete -f ./postgres.yaml
$ kubectl delete -f ./rabbitmq.yaml
$ kubectl delete -f ./redis-cluster.yaml
$ kubectl delete kubegres warehouseTo also delete Kubegres Custom Resource Definitions.
$ kubectl delete -f https://raw.githubusercontent.com/reactive-tech/kubegres/v1.17/kubegres.yamlI don't know how to remove Prometheus Operator.
- Run the application as mentioned above.
- Access Swagger UI at localhost:3010/api.
- Register a user with the
POST /users/registerendpoint. - Login with the
POST /users/loginendpoint. (optional) - Copy the access token from the response body.
- Set the access token in the
Authorizebutton from the top right corner of the Swagger UI. - Create a product with the
POST /productsendpoint. - Order a product with the
POST /orders/:productIdendpoint.
You can find the internal endpoints specification in /proto folder.
- Access Prometheus at localhost:9090.
- Access Grafana at localhost:3000.
- Login using credentials:
adminandpassword. - Open the
Dashboardstab from the left side menu. - Select
Microservices Metricsdashboard.


