• Stars
    star
    120
  • Rank 295,983 (Top 6 %)
  • Language
    Java
  • Created almost 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This is a whole environment of a Microservices Architecture using Spring Cloud, Splunk, Zipkin, Grafana, Prometheus, Postgres with Replication Strategy, Redis and RabbitMQ.

Build Status

What are Microservices?

There are thousands of definitions out there about what are microservices, but the one I like best is that of the great master Martin Fowler

In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies.

James Lewis and Martin Fowler

What is this?

This is a whole environment of a Microservices Architecture. Here you can find the implementation of a lot of "fancy" patterns like CQRS, Distributed Lock, Domain Events, etc.

Bounded Context

ContextMap.png

Architecture Diagram

HotelBookingSystemArchitecture.png

Getting Started

Start

  • Clone the repository
  • Build the services
    • ./build.sh
    • Tip: Run this command and go to take a coffee... or 2...
  • Start the whole environment
    • ./start.sh

Note: If you want to build and run just call ./start.sh --build

Stop

  • Stop all services keeping the volumes (preserving data)
    • ./stop.sh
  • Stop all services removing all volumes (it means that you will remove all data)
    • ./stop.sh --remove-volumes

Stack

  • RabbitMQ as a Message Broker
  • Feign to create REST Clients
  • Ribbon to Client Side Load Balance
  • Eureka to a Service Discovery
  • Sleuth and Zipkin to a Distributed Tracing
  • Hystrix to a Fault Tolerance
  • Prometheus as a Metrics Collector
  • Grafana as Metrics Analytics and UI
  • Postgres as Database
  • Flyway as Database Migration Tool
  • Splunk as Log Analysis Platform
  • Redis to handle Distributed Lock
  • Swagger to create an OpenAPI documentation

Ports

Application Port
Booking Microservice 8100, 8101, 8102
Searching Microservice 8200, 8201
Financial Microservice 8300
Frontend Microservice 8400
RabbitMQ 5672, 5673
RabbitMQ Admin UI 15672, 15673
Booking Postgres Master 5432
Booking Postgres ReadOnly Replica 5433
Financial Postgres 5434
Grafana 3000
Prometheus 9090
Splunk 8000
Netflix Eureka 8761
Zipkin 9411

Distributed Lock Test

In the root folder we have a file called CreateBookingConcurrencyTest.jmx. So, this is a JMeter that can be easily imported and the only thing that you should do is change the room id for the tests. With this test it is possible to see that the booking service is queuing the requests based on the distributed lock on Redis and treating the concurrency issue.

Links

Monitoring Config

By default, we already have 6 dashboards showing the metrics from Spring Boot Apps, Postgres, RabbitMQ, Redis and Zipikin.

The dashboards are:

  • JVM Metrics
  • Postgres Metrics
  • RabbitMQ Metrics
  • Redis Metrics
  • Zipikin Metrics
  • Spring Boot Metrics

When you try to access Grafana it will ask you to log in and the credentials are:

  • Username: admin
  • Password: admin

If you want to change it, just change the value of the env vars GF_SECURITY_ADMIN_USER and GF_SECURITY_ADMIN_PASSWORD in the Grafana's Service on docker-compose-infra.yml.

TODO List

References

More Repositories

1

study-guide

If you want to learn Java and don't know how to start, this repo is for you!
51
star
2

j-api-filter

The purpose of JApiFilter is a simplification of the use of REST for filters by parameters!
Java
17
star
3

microservices-with-spring-cloud

This is an Example of a Microservices Architecture using Spring Cloud.
Java
8
star
4

docker-compose-prometheus-service-discovery

This tool is responsible to auto discovery the configured services running in a docker container and create a file that will be used for Prometheus as a service discovery source
Shell
5
star
5

react-native-maps-router-boilerplate

Fontes da talk de React Native + Google Maps + Google API
JavaScript
3
star
6

data-structures-and-algorithms

The purpose of this repository is to store tests and examples of using some of the most famous data structures and some common algorithms.
Java
3
star
7

spring-security-jwt-auth

Fontes do treinamento de Spring Security com JWT - S2IT Incubadora
Java
2
star
8

architecture-pattern-validation

The goal of this project is to show how we can validate a pattern chosen to create our architecture
Java
2
star
9

devops

Docker + Kubernetes + Helm + Jenkins + Ingress
JavaScript
2
star
10

microservice-javaee8-payara-micro

POC of Microservice RESTful API with JavaEE 8 and Payara Micro
Java
1
star
11

client-cert-auth-and-cert-pinning

Ruby
1
star
12

react-native-app5-navigation

App5 do curso Desenvolvedor Multiplataforma Android/IOS com React e Redux utilizando a nova lib para Navegação
JavaScript
1
star
13

tradeshift

Tradeshift Challenge - Backend Position
Java
1
star
14

avaliacaoS2IT

Solução dos desafios propostos em uma avaliação da S2IT.
CSS
1
star
15

react-native-ducks-boilerplate

Projeto criado com o objetivo de facilitar a inicialização de um projeto React Native com uma arquitetura visando escalabilidade.
JavaScript
1
star