Giter VIP home page Giter VIP logo

iss-api-gateway's Introduction

iss-api-gateway

CoverageQuality Gate Status

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

Architecture

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
  1. Create a ClusterRoleBinding for default namespace
kubectl create clusterrolebinding admin --clusterrole=cluster-admin --serviceaccount=default:default
  1. Create a config map of Postgres
kubectl apply -f k8s/postgres/postgres-config.yaml
  1. Deploy Postgres with a persistent volume claim
kubectl apply -f k8s/postgres/volume.yaml
kubectl apply -f k8s/postgres/postgres.yaml
  1. Create a config map and secret of Mongodb
kubectl apply -f k8s/mongodb/mongodb-config.yaml
kubectl apply -f k8s/mongodb/mongodb-secret.yaml
  1. Deploy Mongodb with a persistent volume claim
kubectl apply -f k8s/mongodb/volume.yaml
kubectl apply -f k8s/mongodb/mongodb.yaml
  1. Create a config map of Kafka service
kubectl apply -f k8s/kafka/kafka-config.yaml
  1. 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
  1. Deploy Pricing service
kubectl apply -f k8s/iss-pricing-service-deployment.yaml
  1. Deploy Product service
kubectl apply -f k8s/iss-product-service-deployment.yaml
  1. Deploy Policy service
kubectl apply -f k8s/iss-policy-service-deployment.yaml
  1. Deploy Policy search service
kubectl apply -f k8s/iss-policy-search-service-deployment.yaml
  1. Deploy Payment service
kubectl apply -f k8s/iss-payment-service-deployment.yaml
  1. Deploy Api gateway service
kubectl apply -f k8s/iss-api-gateway-deployment.yaml
  1. Active ingress controller plugin
minikube addons enable ingress
  1. Deploy ingress
kubectl apply -f k8s/ingress.yaml
  1. Define mastercloudapps.com local DNS
export MINIKUBE_IP=$(minikube ip)
echo $MINIKUBE_IP mastercloudapps.com | sudo tee --append /etc/hosts >/dev/null
  1. Check status pods and services with kubectl get pods,services
kubectl get pods,services

Pods

  1. run dashboard and check status services in dashboard
minikube dashboard

Dashboard

  1. an example of endpoint execution

Mastercloudapps

  1. 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
  1. Stop minikube
minikube stop

iss-api-gateway's People

Contributors

francois-poirier avatar actions-user avatar gortazar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.