How mohamed-taman/springy-store-microservices works
Identify the Project Type and Purpose
Project Type:
Springy Store μServices is a Spring Boot-based Microservices architecture designed to implement cloud-native, reactive programming, and event-driven design patterns. It adheres to CloudNative recommendations and the Twelve-Factor App methodology, focusing on building scalable and maintainable software-as-a-service applications.
Purpose:
The project aims to demonstrate best practices in developing and deploying microservices using modern technologies like Docker, Kubernetes (planned for future milestones), Elasticsearch, MySQL, MongoDB, and messaging systems like RabbitMQ and Kafka. It emphasizes test-driven development (TDD), integration, and performance testing.
Analyze the File Structure
• Top-Level Directories:
• config: Contains all system configuration files, including keystores and various service configurations (e.g., Eureka, Gateway).
• store-base: Houses parent POMs and common build configurations (store-build-chassis, store-cloud-chassis, store-service-chassis).
• store-cloud-infra: Infrastructure services such as authorization-server, edge-server (API Gateway), eureka-server (Service Discovery), and config-server (Centralized Configuration).
• store-common: Shared components like store-api (API Endpoints) and store-utils (Common Utilities).
• store-services: Individual microservices including product-service, recommendation-service, review-service, and store-service.
• docker-compose files: Define different deployment scenarios using RabbitMQ and Kafka.
• Scripts: run-em-all.sh, setup.sh, stop-em-all.sh, test-em-all.sh for managing the lifecycle of services.
• Patterns and Architectural Choices:
• Microservices Architecture: Clearly separated services for product, recommendation, review, and store functionalities.
• Infrastructure Services: Centralized services for configuration, discovery, authorization, and API Gateway.
• Shared Libraries: Common APIs and utilities to promote code reuse and consistency across microservices.
• Containerization: Use of Docker Compose for deploying services, indicating a move towards container orchestration (future Kubernetes integration).
Examine the README for Additional Insights
• Technologies Used:
• Backend: Spring Boot, Java SE 15
• Databases: MySQL, MongoDB
• Messaging: RabbitMQ, Kafka
• Containerization: Docker, Docker Compose (with plans for Kubernetes)
• Monitoring & Logging: Elasticsearch Stack, Zipkin
• Build Tools: Maven
• Version Control: Git
• Design Principles:
• Cloud-Native: Designed for scalability and resilience in cloud environments.
• Reactive Programming: Ensures non-blocking, asynchronous communication between services.
• Event-Driven: Utilizes messaging systems for inter-service communication.
• TDD: Emphasizes test-driven development with comprehensive testing suites.
• Deployment Scenarios:
• Different Docker Compose files cater to varied deployment needs, such as using RabbitMQ with or without partitions and integrating Kafka with Zookeeper.
a. Identify Main Components:
• Infrastructure Services:
• Config Server: Centralized configuration management.
• Eureka Server: Service discovery mechanism.
• Authorization Server: Handles authentication and authorization.
• Edge Server (API Gateway): Manages API routing and acts as a single entry point.
• Microservices:
• Product Service: Manages product-related operations.
• Recommendation Service: Provides product recommendations.
• Review Service: Handles customer reviews.
• Store Service: Core store functionalities.
• Shared Components:
• Store API: Defines API endpoints for all services.
• Store Utils: Common utilities and helper functions.
• Databases:
• MySQL: Likely used by services requiring relational data storage.
• MongoDB: Used for services that benefit from NoSQL storage.
• Messaging Systems:
• RabbitMQ: Facilitates event-driven communication.
• Kafka: Alternative messaging system for handling high-throughput messaging.
• Monitoring & Logging:
• Elasticsearch Stack: For logging and monitoring.
• Zipkin: Distributed tracing of service interactions.
b. Determine Relationships and Interactions:
• Service Discovery: Microservices register with Eureka Server; services discover each other through Eureka.
• API Gateway: All external requests pass through the Edge Server, which routes them to the appropriate microservice.
• Configuration Management: All services fetch their configurations from the Config Server.
• Authentication: Authorization Server manages security, ensuring that only authenticated requests reach the microservices.
• Inter-Service Communication: Services communicate asynchronously via RabbitMQ or Kafka, enabling event-driven interactions.
• Data Flow: Each microservice interacts with its respective database (MySQL or MongoDB) for data persistence.
• Monitoring: Zipkin traces requests across services, while Elasticsearch aggregates logs for analysis.
c. Highlight Architectural Patterns and Design Principles:
• Microservices Architecture: Decoupled services focusing on specific business capabilities.
• API Gateway Pattern: Centralized entry point managing routing, security, and composition.
• Service Discovery Pattern: Dynamic discovery of service instances.
• Centralized Configuration: Externalized configuration management for consistency and flexibility.
• Event-Driven Architecture: Asynchronous communication through messaging systems.
• Reactive Programming: Ensures responsive and resilient interactions.
d. Include Relevant Technologies, Frameworks, or Libraries:
• Spring Boot: Framework for building microservices.
• Maven: Build and dependency management.
• Docker: Containerization of services.
• RabbitMQ/Kafka: Messaging systems for inter-service communication.
• Elasticsearch, Zipkin: Tools for monitoring and logging.
• MySQL, MongoDB: Data storage solutions.
Elements
• Clear Labels: Each component (e.g., Product Service, Eureka Server) should be distinctly labeled.
• Monitoring Tools: Unique identifiers.