This project is a microservices-based application built using Java Spring, integrating with public APIs, utilizing a service discovery server, and monitoring activities with observability tools such as Prometheus, Grafana, and Zipkin. The project is containerized using Docker and deployed on AWS.
This application is designed to demonstrate the use of microservices architecture by integrating various public APIs. It includes three main microservices:
- NBA Microservice: Fetches data about NBA teams.
- Population Microservice: Retrieves population data from data.gov.il.
- News Microservice: Provides top headlines from gnews.io.
All services are managed and routed through an API Gateway, with service discovery enabled to manage service instances dynamically.
The architecture consists of:
- Clients: Postman, Mobile App, Web Client
- API Gateway: Manages routing of requests to appropriate microservices
- Microservices:
- NBA Microservice
- Population Microservice
- News Microservice
- Databases: MongoDB for data persistence
- Service Discovery: Handles dynamic discovery of services. This project is using "Netflix Eurika Server"
- Java Spring: For building microservices
- Prometheus: For metrics collection and monitoring
- Grafana: For visualization of metrics
- Zipkin: For distributed tracing
- Docker: For containerization
- AWS: For deployment
-
Clone the repository:
git clone https://github.com/your-username/your-repo.git cd your-repo -
Build and run the Docker containers:
docker-compose up --build
-
Access the services:
- UI:
http://localhost:8035 - API Gateway:
http://localhost:8080 - NBA Microservice:
http://localhost:8081 - Population Microservice:
http://localhost:8082 - News Microservice:
http://localhost:8083 - Prometheus:
http://localhost:9090 - Grafana:
http://localhost:3000 - Zipkin:
http://localhost:9411
- UI:
- News Headlines:
GET /news/top-headlines
- Population Data:
GET /population/city
- NBA Teams:
GET /nba/teams
Use Postman, a web client, or a mobile app to interact with these endpoints through the API Gateway.
The application is monitored using Prometheus and Grafana, and traced using Zipkin.
Prometheus scrapes metrics from the microservices and the API Gateway. It provides a powerful query language to analyze metrics and alerting capabilities.
Grafana is used to visualize the metrics collected by Prometheus. Pre-configured dashboards display the health and performance of the services.
Zipkin provides distributed tracing capabilities. It helps in understanding the flow of requests across various microservices and identifying bottlenecks.
This microservices architecture project demonstrates the integration of various public APIs, dynamic service discovery, and monitoring using Prometheus, Grafana, and Zipkin. It is containerized with Docker and ready for deployment on AWS.