Online flight reservation system
User service : operations on User service
Booking service : Flight service and User service to perform operations on booking. It will use flight search and its associated table
Flight service : operations and searching based on criteria, providing association between Flight and flight trip
localhost:9200/flights/external/_bulk
localhost:9200/flights/_search?q=*&pretty
Billing service : operations on billing
Passenger service
Organisation service
Account service
Cash flow service
Bid service
Back up service : Back up microservice database Schedule distributed +
Booking-client
Auth-server : User / Passenger need to register/ login - authorized
Twitter Service : read twitter streams(from Airline branch twitter) and persist them on MongoDB and served them as a REST API(HATEOAS) to other service
Search twitter service : Read tweets from twitter service and push it on ElasticSearch as a search engine and produce userful search for these tweet
social-network-service : send flights and passengers data to Agency social network
Booking Request Service : passenger will confirm the flight booking request or cancel request
Applied to the principles of the 12 Factor App
Microservice architecture : Spring cloud, Netflix Eureka, Ribbon, Zuul, Hystrix, Service discovery, Load Balancing, API gateway, Circuit breaker (Hystrix)
Spring framework : Spring Boot, Spring cloud, Spring data, Spring Stream , Spring Reactor
CQRS - Event sourcing
Database : PostgreSQL, MongoDB, Cassandra, MySQL - MariaDB, Neo4J , MySQL
Caching : Redis
Messaging system : RabbitMQ , Kafka(Zookeeper)
Batch process
Apache Avro
ElasticSearch - Logstash - Kibana
sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server
http://ip:8080
Container: Docker - Docker compose
REST API testing using Postman
Testing : JUnit, E2E test with Cucumber
Event - driven system
Security : OAuth/ JWT
Log analysis : ELK stack - Logstash - ElasticSearch - Kibana to index logs
API documentation : Swagger - Curl -
API UI testing: Postman
Service Logging / Monitoring
Correlation ID for service call for all services
Flight service
v1/flights/id
: get one flight by id / infov1/flights
: retrieve all the flights that matches the value of query paramv1/flights
: create new flightv1/airports
: get a list of airportsv1/airports/{airport-name}
: list of flights from this airportv1/airports/flights/code
Booking service : User can book a flight ticket and fill the personal information - billing information
v1/flights/{flight-id}/booking
:Billing service : User can pay the flight order
v1/flights/{flight-id}/payment
User can unsubscribe to the flight ticket info
v1/flights/{flight-id}/payment/ubsubscribed
Passenger service
v1/passengers
v1/passengers/id
v1/passengers
: create one passengerv1/passengers/organisations/id
: find passengers by organisationOrganisation service
Run everything :
docker-compose up
: RabbitMQ port set up (in the docker folder) : it will start the RabbitMQ and MongoDB instance
java -jar eureka-server/target/eureka-server.jar : Start Eureke server - Eureka server port set up java -jar dashboard-server/target/dashboard-server.jar : Start Hystrix dashboard - Hystrix port set up java -jar turbine-server/target/turbine-server.jar
java -jar flight-service/target/restaurant-service.jar java -jar user-service/target/user-service.jar java -jar booking-service/target/booking-service.jar java -jar api-service/target/api-service.jar
Before start Zuul service, make sure that all of the services are up in the Eureka dashboad : localhost:8761
java -jar zuul-server/target/zuul-server.jar
How to double check all components are setting up
Browser : Eureka server
http://localhost:8761/
Service instances are register with Eureka
Browser : Hystrix monitor : http://localhost:7979/
- Hystrix dashboard
http://localhost:15672/
(guest- guest )docker run --name mongo -p 27017:27017 -d mongo
dockewr run --name redis -p 6379:6379 -d redis
Service discovery and registration - Eureka
http://localhost:8761/
Config service
Edge or proxy server (API gateway) - Zuul - Gateway service
Load balancing : Ribbon is used for load balancing . It is integrated with the Zuul and Eureka services to provide load balancing for both internal and external calls
Circuit breaker : Netflix hystrix
Distributed tracing : Zipkin, Spring Cloud Sleuth - distributed tracing via logs - distributed tracing system with request visualization
Monitoring : Netflix Turbine - and Dashboard
locahost:7979
http://localhost:8989/turbine.stream
UUA servvice
Integration
Batch processing
Security service
Dependency management : Maven
Data Lake
Testing microservices
Event sourcing
HTTP listener
Containers / Virtual Machines
Cluster Control and Provisioning
Admin server
Spring cloud DataFlow server
dataflow-service
is a Spring Boot app that loads the local DataFlow server. Port 9393Microservice service design : contract design and protocol selection
API documentation : Swagger, RAML, API blueprint
API versioning
Authentication - Authorization
ELK stack
docker run -d -it --name es -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -m 1500m elasticsearch
: start ElasticSearch container on 9200/9300 portdocker run -d -it --name kibanak --link es:elasticsearch -p 5601:5601 kibana
: start Kibana on 5601 port and it will also link it with ElasticSearch containerdocker run -d -it --name logstash -p 5000:5000 logstash -e 'input { tcp { port => 5000 codec => "json" } } output { elasticsearch { hosts => ["192.168.99.100"] index => "micro-%{serviceName}"} }'
: start Logstash container on 5000 port and also create an index with name micro-*docker ps
command, all the container should be runningDefault port used for docker container is 192.168.99.100
Kibana : check logs on Kibana
Log.info
statement and logback.xml
configuration we can index and view log from KibanaGrafana - Graphite - StatsD
Alert and Monitor tools :
Zipkin server
localhost:9411
Docker
Docker containers in this microservice group - Mongo - RabbitMQ - Config-service - Discovery - service , Gateway- service, Command-service, Query-service
Using docker- compose, run : docker-compose -f docker-compose.yml up
To see the running containers docker ps
Run MongoDB and RabbitMQ
docker-compose up -d mongodb rabbitmq
Jenkins
Deploy on AWS
Scaling
Flight service
Catalog service
User service - Account service
Account service
Booking service
Billing service
Subscription service
Route service
Notification service
Ticker order service : before book for ticker, user can choose to order (reserve the flight ticker in a certain of time )
Payment service : After sending bill to user(customer), payment service is used for pay the fee of the flight ticket
third party payment service
Credit risk engine :