https://github.com/mastercloudapps-projects/iss-api-gateway
https://github.com/mastercloudapps-projects/iss-api-gateway
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mastercloudapps-projects/iss-api-gateway
- Owner: MasterCloudApps-Projects
- License: apache-2.0
- Created: 2020-08-05T16:54:45.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-12T18:21:27.000Z (over 4 years ago)
- Last Synced: 2025-01-24T11:44:48.068Z (5 months ago)
- Language: Java
- Size: 6.36 MB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# iss-api-gateway
[](https://sonarcloud.io/dashboard?id=iss-api-gateway)[](https://sonarcloud.io/dashboard?id=iss-api-gateway)
We decided to implement it in an extremely simplified version of an insurance sales system to test the following aspects of microservice development:
* Project creation and development
* Access of both relational and NoSQL databases
* Blocking and non-blocking operations implementation
* Microservice to microservice communication (synchronous and asynchronous)
* Service discovery
* Running background jobs
The complexity of “business microservices” was hidden by using a Gateway pattern. This component was responsible for the proper redirection of requests to the appropriate services based on the configuration. The frontend application could only communicate with this component. This component showed the usage of non-blocking http declarative clients.
## How to run Application
Running application from command line using Docker, this is the cleanest way.
In order for this approach to work, of course, you need to have Docker installed in your local environment.* From the root directory you can run the following command:
```docker-compose -f docker/docker-compose.yml up --build```
* Application will be running on: http://localhost:8084
* To stop it you can open other terminal in the same directory, and then run the following command:
```docker-compose -f docker/docker-compose.yml down```## How to run the Unit Test
```mvn -B clean verify```
## Deploy solution in minikube
# Prerequisites
- Minikube cluster with kubectl installed and configured to use your cluster
1. Run minikube
```
minikube start --memory 8192
```
2. Create a ClusterRoleBinding for default namespace
```
kubectl create clusterrolebinding admin --clusterrole=cluster-admin --serviceaccount=default:default
```
3. Create a config map of Postgres
```
kubectl apply -f k8s/postgres/postgres-config.yaml
```
4. Deploy Postgres with a persistent volume claim
```
kubectl apply -f k8s/postgres/volume.yaml
kubectl apply -f k8s/postgres/postgres.yaml
```
5. Create a config map and secret of Mongodb
```
kubectl apply -f k8s/mongodb/mongodb-config.yaml
kubectl apply -f k8s/mongodb/mongodb-secret.yaml
```
6. Deploy Mongodb with a persistent volume claim
```
kubectl apply -f k8s/mongodb/volume.yaml
kubectl apply -f k8s/mongodb/mongodb.yaml
```
7. Create a config map of Kafka service
```
kubectl apply -f k8s/kafka/kafka-config.yaml
```
8. Deploy Zookeeper and Kafka Cluster
```
kubectl apply -f k8s/kafka/zookeeper-services.yaml
kubectl apply -f k8s/kafka/zookeeper-cluster.yaml
kubectl apply -f k8s/kafka/kafka-service.yaml
kubectl apply -f k8s/kafka/kafka-cluster.yaml
```
9. Deploy Pricing service
```
kubectl apply -f k8s/iss-pricing-service-deployment.yaml
```
10. Deploy Product service
```
kubectl apply -f k8s/iss-product-service-deployment.yaml
```
11. Deploy Policy service
```
kubectl apply -f k8s/iss-policy-service-deployment.yaml
```
12. Deploy Policy search service
```
kubectl apply -f k8s/iss-policy-search-service-deployment.yaml
```
13. Deploy Payment service
```
kubectl apply -f k8s/iss-payment-service-deployment.yaml
```
14. Deploy Api gateway service
```
kubectl apply -f k8s/iss-api-gateway-deployment.yaml
```
15. Active ingress controller plugin
```
minikube addons enable ingress
```
16. Deploy ingress
```
kubectl apply -f k8s/ingress.yaml
```
17. Define mastercloudapps.com local DNS
```
export MINIKUBE_IP=$(minikube ip)
echo $MINIKUBE_IP mastercloudapps.com | sudo tee --append /etc/hosts >/dev/null
```
18. Check status pods and services with kubectl get pods,services
```
kubectl get pods,services
```
19. run dashboard and check status services in dashboard
```
minikube dashboard
```
20. an example of endpoint execution

21. Deleting all the Resources
```
kubectl delete -f k8s/ingress.yaml
kubectl delete -f k8s/iss-api-gateway-deployment.yaml
kubectl delete -f k8s/iss-payment-service-deployment.yaml
kubectl delete -f k8s/iss-policy-search-service-deployment.yaml
kubectl delete -f k8s/iss-policy-service-deployment.yaml
kubectl delete -f k8s/iss-product-service-deployment.yaml
kubectl delete -f k8s/iss-pricing-service-deployment.yaml
kubectl delete -f k8s/kafka/kafka-config.yaml
kubectl delete -f k8s/kafka/kafka-cluster.yaml
kubectl delete -f k8s/kafka/kafka-service.yaml
kubectl delete -f k8s/kafka/zookeeper-cluster.yaml
kubectl delete -f k8s/kafka/zookeeper-services.yaml
kubectl delete -f k8s/mongodb/mongodb.yaml
kubectl delete -f k8s/mongodb/volume.yaml
kubectl delete -f k8s/mongodb/mongodb-config.yaml
kubectl delete -f k8s/mongodb/mongodb-secret.yaml
kubectl delete -f k8s/postgres/postgres.yaml
kubectl delete -f k8s/postgres/volume.yaml
kubectl delete -f k8s/postgres/postgres-config.yaml
```22. Stop minikube
```
minikube stop
```