All Projects → rodrigorodrigues → Microservices Design Patterns

rodrigorodrigues / Microservices Design Patterns

Microservice Architecture using multiple languages

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Microservices Design Patterns

Jhipster Microservices Example
JHipster Microservices Example using Spring Cloud, Spring Boot, Angular, Docker, and Kubernetes
Stars: ✭ 100 (+61.29%)
Mutual labels:  google-cloud, spring-boot
Clean Architecture Example Java Spring Boot
An example of Robert C. Martin's Clean Architecture with Spring Boot
Stars: ✭ 59 (-4.84%)
Mutual labels:  spring-boot
Airflow Toolkit
Any Airflow project day 1, you can spin up a local desktop Kubernetes Airflow environment AND one in Google Cloud Composer with tested data pipelines(DAGs) 🖥 >> [ 🚀, 🚢 ]
Stars: ✭ 51 (-17.74%)
Mutual labels:  google-cloud
Multi Tenant App Demo
Demonstrates the discriminator field (shared schema) based multi-tenant application using Spring Boot & Hibernate 5.
Stars: ✭ 57 (-8.06%)
Mutual labels:  spring-boot
Open Project Bankrupt
Spring boot skeleton project with implemented authentication, firebase push, mail, FileUpload, account validation, activity logging etc.
Stars: ✭ 54 (-12.9%)
Mutual labels:  spring-boot
Ansible Windows Docker Springboot
Example project showing how to provision, deploy, run & orchestrate Spring Boot apps with Docker Windows Containers on Docker Windows native using Packer, Powershell, Vagrant & Ansible
Stars: ✭ 58 (-6.45%)
Mutual labels:  spring-boot
Mycollab
An open source, free, high performance, stable and secure Java Application Business Platform of Project Management and Document
Stars: ✭ 1,063 (+1614.52%)
Mutual labels:  spring-boot
Goods Seckill
高性能电商秒杀解决方案,redis预减库存,消息队列异步下单,订单防重,订单防刷,秒杀接口地址隐藏,数学公式验证码
Stars: ✭ 61 (-1.61%)
Mutual labels:  spring-boot
Log Viewer
Web UI to viewing logs
Stars: ✭ 59 (-4.84%)
Mutual labels:  spring-boot
Spring Boot Fx
🎈Spring Boot, JavaFX, bootstrap3, mongoDB
Stars: ✭ 57 (-8.06%)
Mutual labels:  spring-boot
Manageiq
ManageIQ Open-Source Management Platform
Stars: ✭ 1,089 (+1656.45%)
Mutual labels:  google-cloud
Radar Covid Backend Configuration Server
Radar COVID Configuration Service
Stars: ✭ 56 (-9.68%)
Mutual labels:  spring-boot
Springboard
Spring Boot based production grade starter kit.
Stars: ✭ 59 (-4.84%)
Mutual labels:  spring-boot
Server
Enterprise Open Source IM Solution
Stars: ✭ 53 (-14.52%)
Mutual labels:  spring-boot
Spring Boot Tutorial
💯 🍃 通过丰富实例来展现 Spring Boot 特性的教程
Stars: ✭ 60 (-3.23%)
Mutual labels:  spring-boot
Geekshop
极客商城 ~ 一个面向开发者的、基于Spring+GraphQL+Angular的、无前端(headless)电商框架
Stars: ✭ 52 (-16.13%)
Mutual labels:  spring-boot
Springsecuritytotp
Spring Security Login with Google Authenticator (Time-based One-time Password Algorithm, TOTP)
Stars: ✭ 56 (-9.68%)
Mutual labels:  spring-boot
Google Auth Library Nodejs
🔑 Google Auth Library for Node.js
Stars: ✭ 1,094 (+1664.52%)
Mutual labels:  google-cloud
Ng Toolkit
⭐️ Angular tool-box! Start your PWA in two steps! Add Serverless support for existing projects and much more
Stars: ✭ 1,116 (+1700%)
Mutual labels:  google-cloud
Cloud Portal
Self service web portal for different Cloud platforms like Azure, AWS and VMWare vSphere.
Stars: ✭ 60 (-3.23%)
Mutual labels:  spring-boot

Microservice Architecture with Multiple Languages

Build Status codecov

The idea for this project is to show a case for applying Microservice Architecture using multiple languages.

Most of the services are in Java + Spring Boot 2 + MongoDB but there are others using NodeJS, Kotlin, Python and Go.

The web application is using React

Android App using React Native working in progress.

Docker images are built in mupltiple platforms(linux/amd64,linux/arm64).

Services are deployed in a Raspberry Pi Cluster to access https://spendingbetter.com and create a user.

Raspberry Pi Cluster

Feel free to create a new microservice using a different language(Ruby?, C#?), just please following the minimal requirements:

  • Create a new folder on root and put your code
  • Add a minimal documentation
  • Add a Rest API
  • Add JWT Validation
  • Add Tests
  • Add Dockerfile
  • Add MongoDB or some other NoSql
  • Add Consul Client(if possible)

PS: A better approach would be a microservice per repository but for simplicity all microservices are in the same repo.

If you want to contribute please check TODO List.

Inspired by the book Microservices Patterns(Chris Richardson - @crichardson).

Contents

  1. Microservice Patterns
  2. Prerequisites
  3. Microservice Diagram
  4. Installing all services using Docker Compose
  5. Docker Commands
  6. Manual Installation - NOT RECOMMENDED
  7. Accessing React Web App
  8. List of default users
  9. Kubernetes - Google Cloud Platform
  10. Travis CI/CD
  11. Github Actions CI/CD
  12. TODO List
  13. References
  14. Postman Collection

Microservice Patterns

The following list of Microservice Patterns was applied so far.

To know more about each pattern look at Microservice Architecture

Prerequisites

  • JDK 1.8
  • Maven 3
  • Docker 17.05.0-ce+ - Not necessary but recommended otherwise the services should run by command
  • Docker Compose 1.23.2 - Not necessary but recommended otherwise the services should run by command

Microservice Diagram

Microservice Architecture

Installing All Services using Docker Compose

The easiest way to run all microservices is using docker-compose, run the following commands:

On root folder first need to generate the docker images.

# at once for building the docker images
mvn clean install docker:build

On docker folder run all microservices

docker-compose up -d

Docker Commands

To see logs for a specific docker container:

docker logs -f SERVICE_NAME

PS: Service names are on docker-compose.yml -> container_name

To execute a command inside the container:

docker exec -it week-menu-api sh

To stop and remove all containers:

docker-compose down -v

To restart/start/stop/remove specific container:

docker-compose restart SERVICE_NAME
docker-compose up SERVICE_NAME
docker-compose stop SERVICE_NAME
docker-compose rm SERVICE_NAME

Manual Installation - NOT RECOMMENDED

If for some reason you cannot install docker/docker-compose you can run all services manually using the following command for Java applications.

mvn spring-boot:run -Dspring-boot.run.arguments="--server.port={PORT}"

To run NodeJS and React applications on folders nodejs-service and react-webapp:

sudo npm install

sudo npm start

Accessing React App

To access React Web App.

React1 React2

Default Users

Following the list of default users:

[email protected]/password - ROLE_ADMIN

[email protected]/password123 - ROLE_PERSON_CREATE, ROLE_PERSON_READ, ROLE_PERSON_SAVE

[email protected]/test - ROLE_PERSON_READ

PS: Moved default users for Integration Tests only.

Kubernetes - Google Cloud Platform

The code in Raspberry Pi Cluster using microk8s.

Following useful commands for kubernetes

Installation

#helm create ingress - RBAC enabled
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller
helm list
helm init --tiller-tls-verify
helm init
kubectl get deployments -n kube-system
helm install --name nginx-ingress stable/nginx-ingress --set rbac.create=true --set controller.publishService.enabled=true

#helm list
helm list

#create tls
kubectl create secret tls ingress-tls --cert /etc/sslmate/www.spendingbetter.com.chained.crt --key /etc/sslmate/www.spendingbetter.com.key

#create generic certs
kubectl create secret generic spendingbetter-p12 --from-file=/etc/sslmate/www.spendingbetter.com.p12
kubectl create secret generic spendingbetter-crt --from-file=/etc/sslmate/www.spendingbetter.com.crt
kubectl create secret generic spendingbetter-jks --from-file=/etc/sslmate/www.spendingbetter.com.jks

#list certs
kubectl get secrets

#list specific cert
kubectl describe secret ingress-tls

#show ingress
kubectl get ing
kubectl describe ingress


# Istio
# Get Grafana Configuration
kubectl get service grafana --namespace istio-system -o yaml

# Update Grafana Configuration
kubectl edit service grafana --namespace istio-system

Deployment

cd kubernetes

#create docker image
docker tag eureka-server:latest eu.gcr.io/spring-boot-gke-243520/eureka-server:4.0
docker tag docker_react-webapp:latest eu.gcr.io/spring-boot-gke-243520/react-webapp:6.0

#push docker image
docker push eu.gcr.io/spring-boot-gke-243520/eureka-server:4.0
docker push eu.gcr.io/spring-boot-gke-243520/react-webapp:6.0

#Deploy
kubectl apply -f deployment-admin-server.yml

#Undeploy
kubectl delete -f deployment-admin-server.yml

#see logs
kubectl logs admin-server-XXXXX -f

#exec command
kubectl exec -it redis-5b4699dd74-qckm9 -- sh

#show all pods
kubectl get pods --show-labels

#create config map
kubectl create configmap prometheus --from-file=../docker/prometheus-prod.yml

kubectl create configmap grafana-dashboard --from-file=../docker/create-datasource-and-dashboard.sh

kubectl create configmap grafana-datasource --from-file=../docker/grafana-datasource.yaml

#port forward
kubectl port-forward $(kubectl get pod --selector="app=eureka-server" --output jsonpath='{.items[0].metadata.name}') 8761:8761

#delete specific ingress
kubectl delete ingress ingress-gateway-forward-https

#cpu usage
kubectl get nodes --show-labels
kubectl describe nodes gke-your-first-cluster
kubectl top nodes

Enable Ingress

Example Ingress Configuration

Install Helm

Kubernetes + Zuul

Example Spring Boot 2 + Kubernetes + Zuul

Secure Discovery Example

Travis CI/CD

Used travis-ci for building pull requests only.

Github Actions CI/CD

Using GitHub Actions for deploying services for multiple platforms(linux/amd64,linux/arm64).

More details look at .github/workflows/docker-build-push-*.

Configuration(Deployment/Services) for Kubernetes look at .github/workflows/kubernetes.

Swagger UI

Swagger UI is available for Authentication, Person and User Services

Access it Swagger UI - http://localhost:{SERVICE_PORT}/swagger-ui.html

TODO List

  • [X] Java - Split Person and User in different entities
  • [X] Java - Split back-end and front-end in two different folders
  • [X] Java - Split Java 8 Learning in another folder
  • [X] Java - Add Test for Users Classes
  • [X] Java - Add Spring Cloud Config
  • [X] Java - Add Service Discovery(Eureka)
  • [X] Java - Add Zuul(Gateway)
  • [X] Java - Add Maven Docker Plugin
  • [X] Java - Add Redis for Shared Session between applications
  • [X] Java - Add Authentication for all applications
  • [X] Java - Add Prometheus/Grafana for docker compose
  • [X] Java - Add Oauth2 Security layer
  • [X] Java - Fix Zuul/Edge Server for working with NodeJS Service
  • [X] Kotlin - Add Service using Kotlin Language
  • [X] Quarkus - Add Service using Quarkus framework
  • [ ] Scala - Add Service using Scala Language
  • [ ] C# - Add Service using C# Language
  • [X] Go - Add Service using Go Language
  • [X] React - Create User List
  • [X] React - Create User Page
  • [X] React - Create User Edit
  • [X] React - Create Categories Edit
  • [ ] React - Create Recipes Edit
  • [X] React - Fix User Create/Edit
  • [X] React - Fix Person Create/Edit
  • [ ] React - Fix Person List to work with @Tailable and EventSource.
  • [X] React - Fix Docker Web App to use Nginx
  • [ ] Kubernetes/Minikube - Add example to use Kubernetes with Minikube
  • [X] Deploy - Google Cloud/GKE
  • [X] CI/CD - Add Travis
  • [ ] CI/CD - - Add Herokuy
  • [X] CI/CD - Add GitHub Actions for deploy in GCP
  • [ ] Add documentation for libraries used
  • [ ] Add documentation/how-to for each language
  • [ ] Add tests for Python
  • [ ] Add React Legacy
  • [X] Rename /api/persons to /api/people
  • [X] Replace Eureka/Spring Config Server to Consul
  • [X] Add Query DSL

References

Pattern Microservice Architecture

Spring Guide

Spring Boot

React ad Spring WebFlux

Spring WebFlux Security Jwt

Junit 5

Keytool Commands

Spring Boot Kotlin Example

Istio with SDS - Manual Instalation

Istio on GKE

Istio Gateway

Automatic Deployment using Travis and GKE

Microprofile with Metrics

Go with MongoDB

Go Echo Rest Api

Go Tutorial

Go Consul

Raspberry Pi Cluster

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].