diff --git a/.DS_Store b/.DS_Store
index f071087..333b5d0 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/.gitignore b/.gitignore
index 485dee6..dfc2fd7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
.idea
+.DS_Store
+.fake
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..e0f15db
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "java.configuration.updateBuildConfiguration": "automatic"
+}
\ No newline at end of file
diff --git a/IMPLEMENTATION-GUIDE.md b/IMPLEMENTATION-GUIDE.md
new file mode 100644
index 0000000..4300080
--- /dev/null
+++ b/IMPLEMENTATION-GUIDE.md
@@ -0,0 +1,474 @@
+# Complete Implementation Summary & Deployment Guide
+
+## π― Project Overview
+
+This comprehensive microservices architecture implementation showcases advanced patterns including Circuit Breaker, Saga Pattern, and Blue-Green deployment with Kubernetes. The project demonstrates real-world enterprise-grade solutions for distributed systems.
+
+## ποΈ Architecture Components
+
+### Core Infrastructure Services
+- **Discovery Service** (Eureka) - Service registration and discovery
+- **Config Server** - Centralized configuration management
+- **API Gateway** - Single entry point with load balancing
+
+### Business Microservices
+- **Customer Service** - Customer profile management (MongoDB)
+- **Product Service** - Product catalog and inventory (PostgreSQL)
+- **Order Service** - Order processing with Saga orchestration (PostgreSQL + MongoDB for saga state)
+- **Payment Service** - Payment processing with circuit breakers (PostgreSQL)
+- **Notification Service** - Event-driven notifications (MongoDB)
+
+### Advanced Patterns Implemented
+
+#### 1. Circuit Breaker Pattern
+- **Implementation**: Resilience4j
+- **Services**: All inter-service communications
+- **Features**:
+ - Configurable failure thresholds (30-50%)
+ - Automatic recovery mechanisms
+ - Fallback strategies
+ - Metrics and monitoring integration
+
+#### 2. Saga Pattern (Orchestration)
+- **Implementation**: Event-driven with Kafka
+- **Coordinator**: OrderSagaOrchestrator
+- **State Management**: MongoDB for saga persistence
+- **Features**:
+ - Automatic compensation logic
+ - Timeout and retry mechanisms
+ - Saga recovery manager
+ - Comprehensive error handling
+
+#### 3. Blue-Green Deployment
+- **Implementation**: Kubernetes + Helm
+- **Strategy**: Zero-downtime deployments
+- **Features**:
+ - Automated health checks
+ - Traffic switching
+ - Canary deployment support
+ - Instant rollback capability
+
+## π Project Structure
+
+```
+fully-completed-microservices/
+βββ services/ # All microservices
+β βββ discovery/ # Eureka server
+β βββ config-server/ # Spring Cloud Config
+β βββ gateway/ # API Gateway
+β βββ customer/ # Customer management
+β βββ product/ # Product catalog
+β βββ order/ # Order processing + Saga
+β β βββ src/main/java/com/alibou/ecommerce/
+β β βββ order/ # Order entities and controllers
+β β βββ saga/ # Saga pattern implementation
+β β βββ OrderSaga.java # Saga state entity
+β β βββ SagaStatus.java # Saga states enum
+β β βββ OrderSagaOrchestrator.java # Saga coordinator
+β β βββ OrderSagaRepository.java # Data access
+β β βββ SagaRecoveryManager.java # Timeout handling
+β β βββ events/ # Kafka event classes
+β β βββ handlers/ # Event handlers
+β βββ payment/ # Payment processing
+β βββ notification/ # Email notifications
+βββ k8s/ # Kubernetes deployments
+β βββ helm-charts/ # Helm chart templates
+β β βββ Chart.yaml # Chart metadata
+β β βββ values.yaml # Configuration values
+β β βββ templates/ # K8s resource templates
+β βββ blue-green-deploy.sh # Deployment automation
+β βββ build-images.sh # Docker image builder
+β βββ README.md # K8s deployment guide
+βββ learning-platform/ # Interactive learning platform
+βββ docker-compose.yml # Local development setup
+βββ README.md # Main project documentation
+```
+
+## π Quick Start Guide
+
+### Prerequisites
+- Java 17+
+- Maven 3.6+
+- Docker & Docker Compose
+- Kubernetes cluster (optional, for K8s deployment)
+- Git
+
+### 1. Clone Repository
+```bash
+git clone https://github.com/PramithaMJ/fully-completed-microservices.git
+cd fully-completed-microservices
+```
+
+### 2. Start Infrastructure (Local Development)
+```bash
+# Start databases, Kafka, Zipkin
+docker-compose up -d
+
+# Wait for services to be ready (about 60 seconds)
+docker-compose ps
+```
+
+### 3. Start Core Services (in order)
+```bash
+# 1. Config Server (Port 8888)
+cd services/config-server
+./mvnw spring-boot:run
+
+# 2. Discovery Service (Port 8761)
+cd ../discovery
+./mvnw spring-boot:run
+
+# 3. API Gateway (Port 8222)
+cd ../gateway
+./mvnw spring-boot:run
+```
+
+### 4. Start Business Services
+```bash
+# Start all business services (any order)
+cd ../customer && ./mvnw spring-boot:run &
+cd ../product && ./mvnw spring-boot:run &
+cd ../order && ./mvnw spring-boot:run &
+cd ../payment && ./mvnw spring-boot:run &
+cd ../notification && ./mvnw spring-boot:run &
+```
+
+### 5. Verify Deployment
+```bash
+# Check service registry
+curl http://localhost:8761
+
+# Test API endpoints
+curl http://localhost:8222/api/customers
+curl http://localhost:8222/api/products
+```
+
+## π§ͺ Testing Advanced Patterns
+
+### Circuit Breaker Testing
+```bash
+# Generate load to trigger circuit breaker
+for i in {1..50}; do
+ curl -X GET "http://localhost:8222/api/customers/999" &
+done
+
+# Check circuit breaker metrics
+curl http://localhost:8222/actuator/prometheus | grep resilience4j
+```
+
+### Saga Pattern Testing
+```bash
+# 1. Create a customer
+curl -X POST http://localhost:8222/api/customers \
+ -H "Content-Type: application/json" \
+ -d '{
+ "firstname": "John",
+ "lastname": "Doe",
+ "email": "john@example.com",
+ "address": {
+ "street": "123 Main St",
+ "houseNumber": "123",
+ "zipCode": "12345"
+ }
+ }'
+
+# 2. Create a product
+curl -X POST http://localhost:8222/api/products \
+ -H "Content-Type: application/json" \
+ -d '{
+ "name": "MacBook Pro",
+ "description": "Apple MacBook Pro 16-inch",
+ "availableQuantity": 10,
+ "price": 2499.99
+ }'
+
+# 3. Place order (triggers Saga)
+curl -X POST http://localhost:8222/api/orders \
+ -H "Content-Type: application/json" \
+ -d '{
+ "customerId": "CUSTOMER_ID_FROM_STEP_1",
+ "products": [
+ {
+ "productId": PRODUCT_ID_FROM_STEP_2,
+ "quantity": 1
+ }
+ ],
+ "paymentMethod": "CREDIT_CARD"
+ }'
+
+# 4. Check saga state in MongoDB
+# Connect to MongoDB and check order_saga collection
+```
+
+## βΈοΈ Kubernetes Deployment
+
+### Prerequisites for K8s
+```bash
+# Install required tools
+brew install kubectl helm
+
+# For local development
+brew install kind
+
+# Create Kind cluster
+kind create cluster --config=k8s/kind-config.yaml
+```
+
+### Deploy with Blue-Green Strategy
+```bash
+cd k8s
+
+# Build Docker images
+./build-images.sh
+
+# Deploy with Helm (Blue-Green enabled)
+helm install ecommerce-microservices ./helm-charts \
+ --namespace ecommerce \
+ --create-namespace \
+ --set bluegreen.enabled=true \
+ --set bluegreen.activeSlot=blue \
+ --wait
+
+# Check deployment status
+./blue-green-deploy.sh status
+```
+
+### Blue-Green Deployment Operations
+```bash
+# Deploy to inactive slot (Green)
+./blue-green-deploy.sh deploy
+
+# Switch traffic to new deployment
+./blue-green-deploy.sh switch
+
+# Complete deployment (with cleanup)
+./blue-green-deploy.sh full-deploy
+
+# Rollback if needed
+./blue-green-deploy.sh rollback
+
+# Canary deployment (10% traffic)
+./blue-green-deploy.sh canary 10
+
+# Promote canary to full
+./blue-green-deploy.sh promote
+```
+
+## π Monitoring & Observability
+
+### Service Discovery Dashboard
+- **URL**: http://localhost:8761
+- **Purpose**: View all registered services and health status
+
+### Distributed Tracing
+- **Zipkin UI**: http://localhost:9411
+- **Features**: Request tracing across services, performance analysis
+
+### Database Management
+- **PostgreSQL**: http://localhost:5050 (PgAdmin)
+- **MongoDB**: http://localhost:8081 (Mongo Express)
+
+### Email Testing
+- **MailDev**: http://localhost:1080
+- **Purpose**: View sent emails from notification service
+
+### Prometheus Metrics (K8s)
+- **Circuit Breaker**: `resilience4j_circuitbreaker_*`
+- **Saga Pattern**: `saga_*`
+- **Application**: `http_server_requests_*`
+
+## π― Learning Outcomes
+
+### Design Patterns Mastered
+1. **Service Registry & Discovery** - Dynamic service location
+2. **API Gateway** - Single entry point with cross-cutting concerns
+3. **Database per Service** - Data isolation and independence
+4. **Event-Driven Architecture** - Asynchronous communication
+5. **Circuit Breaker** - Fault tolerance and resilience
+6. **Saga Pattern** - Distributed transaction management
+7. **Blue-Green Deployment** - Zero-downtime deployments
+
+### Technical Skills Developed
+- **Spring Boot 3.2.5** - Modern Java development
+- **Spring Cloud** - Microservices infrastructure
+- **Kafka** - Event streaming and messaging
+- **MongoDB & PostgreSQL** - Polyglot persistence
+- **Docker** - Containerization
+- **Kubernetes** - Container orchestration
+- **Helm** - Package management
+- **Resilience4j** - Circuit breaker implementation
+
+### Enterprise Best Practices
+- **Configuration Management** - Externalized configuration
+- **Service Mesh Patterns** - Service-to-service communication
+- **Monitoring & Alerting** - Observability implementation
+- **Security** - Network policies and secrets management
+- **CI/CD** - Automated deployment pipelines
+
+## π§ Advanced Configuration
+
+### Circuit Breaker Settings
+```yaml
+# In values.yaml
+order:
+ circuitBreaker:
+ enabled: true
+ failureRateThreshold: 30 # 30% failure rate
+ waitDurationInOpenState: 60000 # 60 seconds
+ slidingWindowSize: 20 # 20 calls window
+```
+
+### Saga Pattern Settings
+```yaml
+order:
+ saga:
+ enabled: true
+ retryAttempts: 3 # Max retry attempts
+ compensationTimeout: 30000 # 30 seconds timeout
+```
+
+### Scaling Configuration
+```yaml
+order:
+ autoscaling:
+ enabled: true
+ minReplicas: 3
+ maxReplicas: 10
+ targetCPUUtilizationPercentage: 70
+```
+
+## π Troubleshooting
+
+### Common Issues
+
+#### 1. Service Registration Problems
+```bash
+# Check Eureka dashboard
+curl http://localhost:8761
+
+# Verify service configuration
+curl http://localhost:8888/order-service/default
+```
+
+#### 2. Circuit Breaker Not Working
+```bash
+# Check circuit breaker metrics
+curl http://localhost:8070/actuator/prometheus | grep resilience4j
+
+# Verify configuration
+curl http://localhost:8070/actuator/circuitbreakers
+```
+
+#### 3. Saga State Issues
+```bash
+# Connect to MongoDB and check saga collection
+docker exec -it mongodb mongo ecommerce --eval "db.order_saga.find().pretty()"
+
+# Check Kafka topics
+docker exec -it kafka kafka-topics --list --bootstrap-server localhost:9092
+```
+
+#### 4. Kubernetes Deployment Issues
+```bash
+# Check pod status
+kubectl get pods -n ecommerce
+
+# Check service logs
+kubectl logs -f deployment/order-service-blue -n ecommerce
+
+# Check ingress
+kubectl describe ingress -n ecommerce
+```
+
+## π Performance Optimization
+
+### JVM Tuning
+```yaml
+order:
+ env:
+ - name: JAVA_OPTS
+ value: "-Xmx768m -XX:+UseG1GC -XX:G1HeapRegionSize=16m"
+```
+
+### Database Connection Pooling
+```yaml
+spring:
+ datasource:
+ hikari:
+ maximum-pool-size: 20
+ minimum-idle: 5
+ connection-timeout: 30000
+```
+
+### Kafka Optimization
+```yaml
+spring:
+ kafka:
+ producer:
+ batch-size: 16384
+ linger-ms: 10
+ compression-type: snappy
+```
+
+## π Security Best Practices
+
+### Network Policies (K8s)
+- Enabled by default in Helm chart
+- Restricts inter-service communication
+- Database access controls
+
+### Secrets Management
+- All sensitive data in Kubernetes secrets
+- Environment-specific configurations
+- Encrypted at rest
+
+### Authentication & Authorization
+- JWT tokens for service-to-service communication
+- RBAC configuration for K8s resources
+- API Gateway security filters
+
+## π Production Readiness
+
+### Deployment Checklist
+- [ ] Resource limits configured
+- [ ] Health checks implemented
+- [ ] Monitoring and alerting setup
+- [ ] Security policies applied
+- [ ] Backup strategy implemented
+- [ ] Disaster recovery plan
+- [ ] Load testing completed
+- [ ] Documentation updated
+
+### Operational Procedures
+- **Deployment**: Use blue-green strategy
+- **Monitoring**: Prometheus + Grafana dashboards
+- **Alerting**: Critical alerts for circuit breakers and saga failures
+- **Backup**: Automated database backups
+- **Scaling**: HPA based on CPU/memory metrics
+
+## π¨βπ» Author & Support
+
+**Created by**: Pramitha Jayasooriya
+**GitHub**: https://github.com/PramithaMJ/fully-completed-microservices
+**Website**: https://pramithamj.live
+**Support**: https://buymeacoffee.com/lpramithamm
+
+### Contributing
+1. Fork the repository
+2. Create your feature branch
+3. Commit your changes
+4. Push to the branch
+5. Create a Pull Request
+
+### License
+This project is licensed under the MIT License - see the LICENSE file for details.
+
+---
+
+## π Conclusion
+
+This implementation provides a complete, production-ready microservices architecture with advanced patterns that are essential for enterprise applications. The combination of Circuit Breaker, Saga Pattern, and Blue-Green deployment ensures high availability, data consistency, and zero-downtime deployments.
+
+The project serves as both a learning platform and a reference implementation for building scalable, resilient distributed systems using modern Java and Kubernetes technologies.
+
+**Happy Learning and Coding! π**
diff --git a/README.md b/README.md
index fc76934..80802ff 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,50 @@
-# Fully Completed Microservices Project
+# Complete Microservices Architecture with Advanced Patterns
+
+[](https://www.oracle.com/java/)
+[](https://spring.io/projects/spring-boot)
+[](https://spring.io/projects/spring-cloud)
+[](https://kubernetes.io/)
+[](https://www.docker.com/)
+[](LICENSE)
+
+> A comprehensive, production-ready microservices implementation featuring **Circuit Breaker Pattern**, **Saga Pattern**, and **Blue-Green Deployment** with Kubernetes orchestration.
+
+## Project Overview
+
+This project demonstrates enterprise-grade microservices architecture patterns through a complete e-commerce platform implementation. It showcases advanced distributed systems patterns essential for building resilient, scalable applications.
+
+### Key Features
+
+- β
**6 Production-Ready Microservices**
+- β
**Circuit Breaker Pattern** with Resilience4j
+- β
**Saga Pattern** for distributed transactions
+- β
**Blue-Green Deployment** with Kubernetes
+- β
**Event-Driven Architecture** with Kafka
+- β
**Distributed Tracing** with Zipkin
+- β
**Interactive Learning Platform**
+- β
**Zero-Downtime Deployments**
+
+## Advanced Patterns Implemented
+
+### Circuit Breaker Pattern
+
+- **Technology**: Resilience4j
+- **Implementation**: All inter-service communications
+- **Features**: Configurable thresholds, automatic recovery, fallback strategies
+- **Monitoring**: Prometheus metrics integration
+
+### Saga Pattern (Orchestration)
+
+- **Coordinator**: OrderSagaOrchestrator
+- **State Storage**: MongoDB
+- **Event Bus**: Apache Kafka
+- **Features**: Automatic compensation, timeout handling, retry mechanisms
+
+### Blue-Green Deployment
+
+- **Platform**: Kubernetes with Helm
+- **Features**: Zero-downtime deployment, instant rollback, canary support
+- **Automation**: Custom deployment scripts with health checks
## Overview
@@ -7,35 +53,36 @@ This repository contains a collection of fully completed microservices built wit
## Microservices Description
1. **Config Server**
+
- Provides centralized configuration for all microservices.
- Uses Spring Cloud Config Server.
-
2. **Customer Service**
+
- Manages customer data and operations.
- Integrated with Eureka Discovery.
-
3. **Discovery Service**
+
- Service registry using Netflix Eureka.
- Enables service discovery for other microservices.
-
4. **Gateway Service**
+
- API Gateway for routing requests to appropriate microservices.
- Uses Spring Cloud Gateway.
- Includes distributed tracing and circuit breaker.
-
5. **Notification Service**
+
- Handles notifications and alerts.
- Uses Kafka for messaging.
-
6. **Order Service**
+
- Manages orders and their statuses.
- Integrated with Eureka Discovery.
-
7. **Payment Service**
+
- Processes payments.
- Uses Eureka Discovery and Zipkin for tracing.
-
8. **Product Service**
+
- Manages product information.
- Integrated with Eureka Discovery.
@@ -57,23 +104,23 @@ This repository contains a collection of fully completed microservices built wit
## Running the Microservices
1. **Clone the repository**
+
```sh
git clone https://github.com/PramithaMJ/fully-completed-microservices.git
cd fully-completed-microservices
```
-
2. **Start Config Server**
+
```sh
cd config-server
mvn spring-boot:run
```
-
3. **Start Discovery Service**
+
```sh
cd discovery
mvn spring-boot:run
```
-
4. **Start Other Microservices**
Start the remaining microservices in any order. Ensure they are configured to register with the Discovery Service.
@@ -119,10 +166,11 @@ https://pramithamj.live
+
## Donation
***If you like what I do, maybe consider buying me a coffee***
-***
+---
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 0000000..bc115a5
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,491 @@
+# Microservices Architecture Learning Platform
+
+An interactive web-based learning platform that explains microservices architecture through a complete e-commerce implementation using Spring Boot and Java, featuring advanced patterns like Saga orchestration, Circuit Breakers, and Kubernetes deployment strategies.
+
+## π Features
+
+### Interactive Learning Experience
+- **Visual Architecture Diagram**: Click on any service to see detailed information
+- **Step-by-Step Explanations**: Understand how each component works
+- **Hands-On Testing**: Real API examples and testing scenarios
+- **Progress Tracking**: Track your learning progress through sections
+- **GitHub Integration**: Direct access to complete source code
+- **Responsive Design**: Works on desktop, tablet, and mobile devices
+- **Circuit Breaker Demonstrations**: Interactive circuit breaker pattern visualization
+- **Saga Pattern Examples**: Learn distributed transaction management
+- **Deployment Scenarios**: Kubernetes and Helm chart explanations
+
+### Complete Source Code Access
+- **GitHub Repository**: Direct links to the complete implementation
+- **Author Information**: Learn about the creator and get support
+- **Quick Actions**: Fork, download, or report issues directly from the platform
+- **Live Repository Stats**: See the latest information about the codebase
+
+### Comprehensive Coverage
+- **8 Microservices**: Customer, Product, Order, Payment, Notification, Config Server, Discovery, and Gateway
+- **Advanced Patterns**: Saga orchestration, Circuit Breakers, Event-Driven Architecture, Service Registry, API Gateway
+- **12+ Technologies**: Spring Boot, Spring Cloud, PostgreSQL, MongoDB, Kafka, Docker, Zipkin, Kubernetes, Helm, Resilience4j, and more
+- **Deployment Strategies**: Blue-green deployment, rolling updates, canary deployments
+
+### Real-World Implementation
+- **Business Problem**: Based on actual e-commerce requirements
+- **Complete Solution**: From customer management to payment processing
+- **Production-Ready**: Includes monitoring, tracing, resilience patterns, and Kubernetes deployment
+- **Enterprise-Grade**: Saga patterns for distributed transactions, circuit breakers for fault tolerance
+
+## π File Structure
+
+```
+learning-platform/
+βββ index.html # Main HTML file with all content
+βββ styles.css # Complete CSS styling
+βββ script.js # Interactive JavaScript functionality
+βββ README.md # This documentation
+```
+
+## π οΈ How to Use
+
+### 1. Open the Learning Platform
+Simply open `index.html` in your web browser:
+```bash
+open index.html
+```
+Or use a local server:
+```bash
+# Using Python
+python -m http.server 8000
+
+# Using Node.js
+npx serve .
+
+# Then visit http://localhost:8000
+```
+
+### 2. Navigate Through Sections
+- **Overview**: Understand the business problem and solution
+- **Architecture**: Interactive diagram of all services
+- **Repository**: Access complete source code and GitHub integration
+- **Services**: Deep dive into each microservice
+- **Patterns**: Learn microservices design patterns including Saga and Circuit Breaker
+- **Deployment**: Kubernetes, Helm charts, and blue-green deployment strategies
+- **Hands-On**: Step-by-step implementation guide
+
+### 3. Interactive Features
+- **Click service boxes** to see detailed information
+- **Copy code examples** with one click
+- **Follow hands-on tutorials** for practical learning
+- **Track your progress** with the built-in progress bar
+
+## π― Learning Objectives
+
+After completing this platform, you will understand:
+
+1. **Microservices Architecture Principles**
+ - Service decomposition strategies
+ - Inter-service communication
+ - Data management patterns
+
+2. **Spring Cloud Ecosystem**
+ - Config Server for centralized configuration
+ - Eureka for service discovery
+ - Gateway for API routing
+
+3. **Event-Driven Architecture**
+ - Kafka for asynchronous messaging
+ - Event sourcing patterns
+ - Notification systems
+ - Saga orchestration patterns
+
+4. **Resilience Patterns**
+ - Circuit breakers with Resilience4j
+ - Saga pattern for distributed transactions
+ - Compensation and recovery strategies
+ - Fault tolerance mechanisms
+
+5. **Production Concerns**
+ - Distributed tracing with Zipkin
+ - Database per service pattern
+ - Monitoring and observability
+
+6. **Kubernetes Deployment**
+ - Container orchestration strategies
+ - Helm charts for package management
+ - Blue-green deployment processes
+ - Service mesh considerations
+
+7. **Hands-On Implementation**
+ - Setting up the complete system
+ - Testing API endpoints
+ - Viewing distributed traces
+ - Deploying to Kubernetes
+
+## π§ Technical Implementation
+
+### Technologies Explained
+
+#### Core Services
+- **Config Server (Port 8888)**: Centralized configuration management
+- **Discovery Service (Port 8761)**: Service registry using Netflix Eureka
+- **API Gateway (Port 8222)**: Single entry point with Spring Cloud Gateway
+
+#### Business Services
+- **Customer Service**: MongoDB for flexible customer profiles with validation circuit breakers
+- **Product Service**: PostgreSQL for structured product data
+- **Order Service**: Orchestrates order workflow with Saga patterns and multiple circuit breakers
+- **Payment Service**: Handles secure payment processing with compensation logic
+- **Notification Service**: Event-driven email notifications
+
+#### Infrastructure
+- **PostgreSQL**: Relational database for transactional data
+- **MongoDB**: Document database for flexible schemas
+- **Apache Kafka**: Event streaming platform
+- **Zipkin**: Distributed tracing system
+- **Docker Compose**: Container orchestration
+- **Kubernetes**: Production container orchestration
+- **Helm**: Kubernetes package manager
+- **Resilience4j**: Circuit breakers and resilience patterns
+
+### Design Patterns Demonstrated
+
+1. **Service Registry & Discovery**
+ - Implementation: Netflix Eureka
+ - Benefits: Dynamic service location, load balancing, health monitoring
+
+2. **API Gateway**
+ - Implementation: Spring Cloud Gateway
+ - Benefits: Single entry point, cross-cutting concerns, request routing
+
+3. **Database per Service**
+ - Implementation: PostgreSQL + MongoDB
+ - Benefits: Data isolation, technology diversity, independent scaling
+
+4. **Event-Driven Architecture**
+ - Implementation: Apache Kafka
+ - Benefits: Loose coupling, asynchronous processing, scalability
+
+5. **Externalized Configuration**
+ - Implementation: Spring Cloud Config
+ - Benefits: Environment-specific configs, runtime updates, security
+
+6. **Distributed Tracing**
+ - Implementation: Zipkin
+ - Benefits: Performance monitoring, debugging, dependency visualization
+
+7. **Saga Orchestration Pattern**
+ - Implementation: OrderSagaOrchestrator with compensation logic
+ - Benefits: Distributed transaction management, data consistency, failure recovery
+
+8. **Circuit Breaker Pattern**
+ - Implementation: Resilience4j with specialized saga circuit breakers
+ - Benefits: Fault tolerance, graceful degradation, system stability
+
+9. **Blue-Green Deployment**
+ - Implementation: Kubernetes deployment strategies
+ - Benefits: Zero-downtime deployments, quick rollback, risk mitigation
+
+10. **Package Management**
+ - Implementation: Helm charts for Kubernetes
+ - Benefits: Templated deployments, version management, configuration management
+
+## π§ͺ Testing Scenarios
+
+The platform includes practical testing scenarios:
+
+### 1. Create Customer
+```bash
+curl -X POST http://localhost:8222/api/customers \
+ -H "Content-Type: application/json" \
+ -d '{
+ "firstname": "John",
+ "lastname": "Doe",
+ "email": "john.doe@example.com",
+ "address": {
+ "street": "123 Main St",
+ "houseNumber": "123",
+ "zipCode": "12345"
+ }
+ }'
+```
+
+### 2. Add Product
+```bash
+curl -X POST http://localhost:8222/api/products \
+ -H "Content-Type: application/json" \
+ -d '{
+ "name": "MacBook Pro",
+ "description": "Apple MacBook Pro 16-inch",
+ "availableQuantity": 10,
+ "price": 2499.99
+ }'
+```
+
+### 3. Simulate Saga Compensation
+```bash
+# Trigger a failed order to see saga compensation in action
+curl -X POST http://localhost:8222/api/orders \
+ -H "Content-Type: application/json" \
+ -d '{
+ "customerId": "invalid_customer_id",
+ "products": [
+ {
+ "productId": "product_id_here",
+ "quantity": 999
+ }
+ ],
+ "paymentMethod": "PAYPAL"
+ }'
+```
+
+### 4. Circuit Breaker Testing
+```bash
+# Test circuit breaker resilience by making multiple rapid requests
+for i in {1..10}; do
+ curl -X GET http://localhost:8222/api/customers/invalid_id
+ sleep 0.1
+done
+```
+
+## π Monitoring Dashboards
+
+Access these URLs once your microservices are running:
+
+- **Eureka Discovery**: http://localhost:8761 - Service registry dashboard
+- **PostgreSQL Admin**: http://localhost:5050 - Database administration
+- **MongoDB Admin**: http://localhost:8081 - MongoDB management
+- **Zipkin Tracing**: http://localhost:9411 - Distributed tracing visualization
+- **Email Testing**: http://localhost:1080 - Email notification testing
+- **Circuit Breaker Metrics**: Available through Spring Boot Actuator endpoints
+
+## π³ Kubernetes Deployment
+
+### Prerequisites for Kubernetes
+- Kubernetes cluster (local with minikube or cloud provider)
+- kubectl CLI tool
+- Helm 3.x
+- Docker registry access
+
+### Deploy with Helm
+
+1. **Add Helm Repository** (if using external charts):
+ ```bash
+ helm repo add microservices-chart ./helm-charts
+ helm repo update
+ ```
+
+2. **Deploy Infrastructure**:
+ ```bash
+ helm install postgres stable/postgresql
+ helm install mongodb stable/mongodb
+ helm install kafka strimzi/strimzi-kafka-operator
+ ```
+
+3. **Deploy Microservices**:
+ ```bash
+ # Deploy each service with Helm
+ helm install config-server ./helm-charts/config-server
+ helm install discovery-service ./helm-charts/discovery
+ helm install api-gateway ./helm-charts/gateway
+
+ # Deploy business services
+ helm install customer-service ./helm-charts/customer
+ helm install product-service ./helm-charts/product
+ helm install order-service ./helm-charts/order
+ helm install payment-service ./helm-charts/payment
+ helm install notification-service ./helm-charts/notification
+ ```
+
+### Blue-Green Deployment
+
+1. **Prepare Green Environment**:
+ ```bash
+ kubectl apply -f k8s/green-deployment.yaml
+ ```
+
+2. **Switch Traffic**:
+ ```bash
+ kubectl patch service api-gateway -p '{"spec":{"selector":{"version":"green"}}}'
+ ```
+
+3. **Rollback if Needed**:
+ ```bash
+ kubectl patch service api-gateway -p '{"spec":{"selector":{"version":"blue"}}}'
+ ```
+
+## π Getting Started with the Actual System
+
+### Prerequisites
+- Java 17+
+- Maven 3.6+
+- Docker & Docker Compose
+- IDE (IntelliJ IDEA or VS Code)
+- kubectl (for Kubernetes deployment)
+- Helm 3.x (for package management)
+
+### Local Development Setup
+
+1. **Start Infrastructure**:
+ ```bash
+ docker-compose up -d
+ ```
+
+2. **Start Core Services** (in order):
+ ```bash
+ # Config Server first
+ cd services/config-server && mvn spring-boot:run
+
+ # Discovery Service
+ cd services/discovery && mvn spring-boot:run
+
+ # Gateway
+ cd services/gateway && mvn spring-boot:run
+ ```
+
+3. **Start Business Services**:
+ ```bash
+ # Customer Service
+ cd services/customer && mvn spring-boot:run
+
+ # Product Service
+ cd services/product && mvn spring-boot:run
+
+ # Order Service (with Saga orchestration)
+ cd services/order && mvn spring-boot:run
+
+ # Payment Service
+ cd services/payment && mvn spring-boot:run
+
+ # Notification Service
+ cd services/notification && mvn spring-boot:run
+ ```
+
+### Production Kubernetes Setup
+
+1. **Build Container Images**:
+ ```bash
+ # Build all service images
+ docker build -t pramithamj/config-server:latest services/config-server/
+ docker build -t pramithamj/discovery:latest services/discovery/
+ docker build -t pramithamj/gateway:latest services/gateway/
+ docker build -t pramithamj/customer:latest services/customer/
+ docker build -t pramithamj/product:latest services/product/
+ docker build -t pramithamj/order:latest services/order/
+ docker build -t pramithamj/payment:latest services/payment/
+ docker build -t pramithamj/notification:latest services/notification/
+ ```
+
+2. **Deploy to Kubernetes**:
+ ```bash
+ # Apply namespace
+ kubectl create namespace microservices
+
+ # Deploy infrastructure
+ kubectl apply -f k8s/infrastructure/ -n microservices
+
+ # Deploy services
+ kubectl apply -f k8s/services/ -n microservices
+
+ # Or use Helm
+ helm install microservices-stack ./helm-charts/ -n microservices
+ ```
+
+## π‘ Learning Tips
+
+1. **Start with the Overview** to understand the business context
+2. **Explore the Architecture** interactively before diving into code
+3. **Read each Service section** to understand responsibilities
+4. **Study the Design Patterns** to grasp architectural concepts including Saga and Circuit Breaker patterns
+5. **Learn the Deployment section** to understand Kubernetes and Helm deployment strategies
+6. **Follow the Hands-On guide** to see everything in action
+7. **Use the monitoring tools** to observe system behavior
+8. **Test circuit breakers** by simulating failures
+9. **Observe saga compensation** during failed transactions
+10. **Practice blue-green deployment** in a safe environment
+
+## π¨ Customization
+
+### Adding New Content
+- Edit `index.html` to add new sections
+- Update `serviceDetails` in `script.js` for new services
+- Modify `styles.css` for visual customizations
+
+### Extending Functionality
+- Add new interactive features in `script.js`
+- Create additional testing scenarios
+- Integrate with actual running services for live data
+
+## π± Mobile Experience
+
+The platform is fully responsive and works on:
+- Desktop computers
+- Tablets
+- Mobile phones
+
+Navigation is optimized for touch interfaces with collapsible menus and touch-friendly buttons.
+
+## π Educational Value
+
+This platform serves as:
+- **University coursework** for distributed systems and microservices architecture
+- **Professional training** for enterprise microservices adoption
+- **Self-study resource** for developers learning modern patterns
+- **Architecture reference** for teams implementing saga patterns and circuit breakers
+- **Interview preparation** for system design and microservices questions
+- **DevOps training** for Kubernetes and Helm deployment strategies
+- **Resilience engineering** education for fault-tolerant system design
+
+## π Advanced Topics Covered
+
+### Saga Pattern Implementation
+- **Orchestration vs Choreography**: Learn when to use each approach
+- **Compensation Logic**: Understand rollback mechanisms for distributed transactions
+- **Saga Recovery**: Handle partial failures and system resilience
+
+### Circuit Breaker Patterns
+- **Failure Thresholds**: Configure appropriate failure rates for different scenarios
+- **Fallback Strategies**: Implement graceful degradation when services fail
+- **Recovery Mechanisms**: Automatic and manual circuit breaker recovery
+
+### Kubernetes Deployment Strategies
+- **Blue-Green Deployments**: Zero-downtime deployment strategies
+- **Rolling Updates**: Gradual service updates with minimal disruption
+- **Canary Releases**: Risk-mitigated feature rollouts
+
+### Observability and Monitoring
+- **Distributed Tracing**: Track requests across multiple services
+- **Circuit Breaker Metrics**: Monitor system resilience patterns
+- **Saga Transaction Monitoring**: Observe distributed transaction flows
+
+## π Support
+
+For questions about the microservices implementation:
+1. Review the business needs in `resources/business needs.txt`
+2. Check the curriculum in `resources/curriculum.txt`
+3. Study the patterns in `resources/distributed patterns.txt`
+4. Explore the source code in the `services/` directory
+
+## π Updates
+
+This learning platform includes the latest features:
+
+### Recently Added
+- **Saga Orchestration Patterns**: Complete implementation with compensation logic
+- **Circuit Breaker Integration**: Five specialized circuit breakers for different scenarios
+- **Kubernetes Deployment Guide**: Step-by-step production deployment instructions
+- **Helm Charts Documentation**: Package management for Kubernetes deployments
+- **Blue-Green Deployment**: Zero-downtime deployment strategies
+- **Interactive Circuit Breaker Demo**: Visual learning tool for resilience patterns
+
+### Upcoming Features
+- Additional microservices patterns (CQRS, Event Sourcing)
+- Advanced monitoring examples with Prometheus and Grafana
+- Performance optimization techniques and load testing
+- Security implementation details (OAuth2, JWT, API Security)
+- Service mesh implementation with Istio
+- Cloud-native deployment strategies (AWS EKS, Google GKE, Azure AKS)
+- GitOps workflows with ArgoCD
+
+---
+
+**Happy Learning! π**
+
+Master modern microservices architecture with advanced patterns, resilience strategies, and production-ready Kubernetes deployment through this comprehensive, interactive learning experience.
diff --git a/docs/index.html b/docs/index.html
new file mode 100644
index 0000000..59cab61
--- /dev/null
+++ b/docs/index.html
@@ -0,0 +1,1296 @@
+
+
+
+
+
+ Microservices Architecture Learning Platform
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Master Microservices Architecture
+
Learn through a complete e-commerce implementation with Spring Boot & Java
+
+
+
+
+
+
+
+
+
+
+
+
Business Problem & Solution
+
+
+
+
The Challenge
+
+ E-commerce business with no digital solutions
+ Manual product catalog management
+ Customer data scattered across systems
+ Payment processing inefficiencies
+ No automated notifications
+ Scalability concerns for growth
+
+
+
+
+
+
The Solution
+
+ Product Service: Centralized catalog with unique codes
+ Customer Service: Complete customer profiles
+ Order Service: Automated order processing
+ Payment Service: Secure payment handling
+ Notification Service: Automated email confirmations
+ Gateway & Discovery: Scalable infrastructure
+
+
+
+
+
+
+
+
+
+
+
Interactive Architecture Diagram
+
+
+
Client Layer
+
+
+ Web Client
+
+
+
+
+
Gateway Layer
+
+
+ API Gateway
+ Port: 8222
+
+
+
+
+
Core Services
+
+
+ Config Server
+ Port: 8888
+
+
+
+ Discovery Service
+ Port: 8761
+
+
+
+
+
Business Services
+
+
+ Customer Service
+ MongoDB
+
+
+
+ Product Service
+ PostgreSQL
+
+
+
+ Order Service
+ PostgreSQL
+
+
+
+ Payment Service
+ PostgreSQL
+
+
+
+ Notification Service
+ MongoDB
+
+
+
+
+
Infrastructure
+
+
+
+ PostgreSQL
+
+
+
+ MongoDB
+
+
+
+ Kafka
+
+
+
+ Zipkin
+
+
+
+
+
+
+
+
+
+
+
Microservices Deep Dive
+
+
+
+
+ Config Server
+
+
+ Discovery
+
+
+ Gateway
+
+
+ Customer
+
+
+ Order
+
+
+ Notification
+
+
+
+
+
+
+
+
+
+
+
+
Config Server
+
Port: 8888
+
Technology: Spring Cloud Config
+
Database: File System
+
+
+
+
+
Purpose & Functionality
+
The Config Server acts as a centralized configuration management system for all microservices. It eliminates the need to rebuild and redeploy services when configuration changes.
+
+
Key Features:
+
+ Centralized configuration for all services
+ Environment-specific configurations (dev, staging, prod)
+ Dynamic configuration refresh without restart
+ Version control integration with Git
+ Security for sensitive configurations
+
+
+
How it Works:
+
+ Stores all service configurations in a central location
+ Services request their configuration on startup
+ Provides environment-specific overrides
+ Enables runtime configuration updates via refresh endpoints
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Discovery Service
+
Port: 8761
+
Technology: Netflix Eureka
+
Database: In-Memory Registry
+
+
+
+
+
Service Registry & Discovery
+
The Discovery Service maintains a registry of all available microservice instances, enabling dynamic service-to-service communication without hardcoded URLs.
+
+
Key Features:
+
+ Automatic service registration
+ Health check monitoring
+ Load balancing support
+ Failover and resilience
+ Web dashboard for monitoring
+
+
+
Service Registration Flow:
+
+ Services register themselves on startup
+ Send periodic heartbeats to maintain registration
+ Other services discover available instances
+ Automatic deregistration on shutdown
+
+
+
+
+
+
+
+
+
+
+
+
+
+
API Gateway
+
Port: 8222
+
Technology: Spring Cloud Gateway
+
Features: Routing, Load Balancing, Tracing
+
+
+
+
+
Single Entry Point
+
The API Gateway serves as the single entry point for all client requests, routing them to appropriate microservices while providing cross-cutting concerns.
+
+
Key Responsibilities:
+
+ Request routing to appropriate services
+ Load balancing across service instances
+ Authentication and authorization
+ Request/response transformation
+ Rate limiting and throttling
+ Distributed tracing integration
+
+
+
Routing Example:
+
+
+ /api/customers/** β Customer Service
+ /api/products/** β Product Service
+ /api/orders/** β Order Service
+ /api/payments/** β Payment Service
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Customer Service
+
Database: MongoDB
+
Technology: Spring Data MongoDB
+
Pattern: Document Store
+
+
+
+
+
Customer Profile Management
+
Manages all customer-related data and operations, storing flexible customer profiles in MongoDB for scalability and schema evolution.
+
+
Data Model:
+
+ Personal Info: First name, Last name, Email
+ Address: Street, City, Zipcode
+ Metadata: Creation date, Update history
+
+
+
API Endpoints:
+
+
+ POST /api/customers - Create customer
+
+
+ GET /api/customers/{id} - Get customer details
+
+
+ PUT /api/customers/{id} - Update customer
+
+
+ GET /api/customers/exists/{id} - Check existence
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Order Service
+
Database: PostgreSQL
+
Technology: Spring Data JPA
+
Integration: OpenFeign, Kafka
+
+
+
+
+
Order Processing Hub
+
Orchestrates the complete order lifecycle, integrating with multiple services to validate customers, check product availability, process payments, and trigger notifications.
+
+
Order Processing Flow:
+
+ Validation: Check customer exists via Customer Service
+ Inventory: Validate products and quantities via Product Service
+ Order Creation: Create order with PENDING status
+ Payment: Process payment via Payment Service
+ Confirmation: Send confirmation via Kafka to Notification Service
+ Status Update: Update order status based on payment result
+
+
+
Service Dependencies:
+
+ CustomerClient: Customer validation
+ ProductClient: Product verification
+ PaymentClient: Payment processing
+ Kafka Producer: Event notifications
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Notification Service
+
Database: MongoDB
+
Technology: Kafka, Thymeleaf
+
Integration: Java Mail Sender
+
+
+
+
+
Event-Driven Notifications
+
Handles all notification requirements using event-driven architecture. Listens to Kafka events and sends appropriate email notifications to customers.
+
+
Notification Types:
+
+ Order Confirmation: When order is successfully created
+ Payment Success: When payment is processed successfully
+ Payment Failure: When payment processing fails
+ Order Updates: Status changes and updates
+
+
+
Event Processing Flow:
+
+ Listen to Kafka topics (order-topic, payment-topic)
+ Parse incoming event messages
+ Generate HTML email using Thymeleaf templates
+ Send email via configured SMTP server
+ Store notification history in MongoDB
+
+
+
Email Templates:
+
+ order-confirmation.html
+ payment-confirmation.html
+ payment-failed.html
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Microservices Design Patterns
+
+
+
+
+
+
+
Service Registry & Discovery
+
Implementation: Netflix Eureka
+
Services automatically register themselves and discover other services dynamically.
+
+
Benefits:
+
+ Dynamic service location
+ Load balancing
+ Health monitoring
+ Fault tolerance
+
+
+
+
+
+
+
+
+
+
API Gateway
+
Implementation: Spring Cloud Gateway
+
Single entry point for all client requests with routing and cross-cutting concerns.
+
+
Benefits:
+
+ Simplified client interactions
+ Centralized security
+ Request transformation
+ Rate limiting
+
+
+
+
+
+
+
+
+
+
Database per Service
+
Implementation: PostgreSQL + MongoDB
+
Each service owns its data and database, ensuring loose coupling.
+
+
Benefits:
+
+ Data isolation
+ Technology diversity
+ Independent scaling
+ Fault isolation
+
+
+
+
+
+
+
+
+
+
Event-Driven Architecture
+
Implementation: Apache Kafka
+
Services communicate through events for loose coupling and resilience.
+
+
Benefits:
+
+ Loose coupling
+ Asynchronous processing
+ Event sourcing
+ Scalability
+
+
+
+
+
+
+
+
+
+
Externalized Configuration
+
Implementation: Spring Cloud Config
+
Configuration management separated from application code for flexibility.
+
+
Benefits:
+
+ Environment-specific configs
+ Runtime updates
+ Version control
+ Security separation
+
+
+
+
+
+
+
+
+
+
Distributed Tracing
+
Implementation: Zipkin
+
Track requests across multiple services for debugging and monitoring.
+
+
Benefits:
+
+ Performance monitoring
+ Debugging assistance
+ Service dependencies
+ Bottleneck identification
+
+
+
+
+
+
+
+
+
+
Circuit Breaker
+
Implementation: Resilience4j
+
Prevents cascading failures by monitoring service calls and failing fast when downstream services are unavailable.
+
+
Benefits:
+
+ Fault tolerance
+ Automatic recovery
+ Resource protection
+ Cascading failure prevention
+
+
+
+
Saga-Specific Circuit Breakers:
+
+ Saga Orchestration: 40% failure threshold
+ Saga Compensation: 25% failure threshold
+ Saga Recovery: 60% failure threshold
+ Customer Validation: 35% failure threshold
+ Inventory Reservation: 45% failure threshold
+
+
+
+
+
+
+
+
+
+
Saga Pattern
+
Implementation: Choreography + Orchestration
+
Manages distributed transactions across multiple services with compensation logic for rollback scenarios.
+
+
Benefits:
+
+ Distributed transaction management
+ Automatic compensation
+ Eventual consistency
+ Resilience to failures
+
+
+
+
Saga Flow:
+
+ Customer Validation: Verify customer exists
+ Inventory Reservation: Reserve products
+ Payment Processing: Process payment
+ Order Completion: Finalize order
+
+
Recovery: Automatic timeout handling and retry mechanisms with exponential backoff
+
+
+
+
+
+
+
+
+
+
Hands-On Learning
+
+
+
+
Getting Started
+
+
+
+
+
+
+
1
+
+
Prerequisites
+
+ Java 17+
+ Maven 3.6+
+ Docker & Docker Compose
+ IDE (IntelliJ IDEA or VS Code)
+
+
+
+
+
+
2
+
+
Start Infrastructure
+
+ docker-compose up -d
+
+
This starts PostgreSQL, MongoDB, Kafka, Zipkin, and admin tools.
+
+
+
+
+
3
+
+
Start Core Services
+
+
+ 1. Config Server (Port 8888)
+
+
+ 2. Discovery Service (Port 8761)
+
+
+ 3. API Gateway (Port 8222)
+
+
+
+
+
+
+
4
+
+
Start Business Services
+
Start Customer, Product, Order, Payment, and Notification services in any order.
+
+
+
+
+
+
+
+
Testing Scenarios
+
+
+
+ Create Customer
+
+
+ Add Product
+
+
+ Place Order
+
+
+ View Tracing
+
+
+
+
+
+
+
Create a Customer
+
+
API Request:
+
curl -X POST http://localhost:8222/api/customers \
+ -H "Content-Type: application/json" \
+ -d '{
+ "firstname": "John",
+ "lastname": "Doe",
+ "email": "john.doe@example.com",
+ "address": {
+ "street": "123 Main St",
+ "houseNumber": "123",
+ "zipCode": "12345"
+ }
+ }'
+
+
+
What Happens:
+
+ Request hits API Gateway on port 8222
+ Gateway routes to Customer Service via Eureka discovery
+ Customer data stored in MongoDB
+ Response includes generated customer ID
+ Trace information sent to Zipkin
+
+
+
+
+
+
+
+
Add a Product
+
+
API Request:
+
curl -X POST http://localhost:8222/api/products \
+ -H "Content-Type: application/json" \
+ -d '{
+ "name": "MacBook Pro",
+ "description": "Apple MacBook Pro 16-inch",
+ "availableQuantity": 10,
+ "price": 2499.99
+ }'
+
+
+
What Happens:
+
+ Request routed through Gateway to Product Service
+ Product stored in PostgreSQL database
+ Auto-generated product ID returned
+ Inventory tracking initialized
+
+
+
+
+
+
+
+
Place an Order
+
+
API Request:
+
curl -X POST http://localhost:8222/api/orders \
+ -H "Content-Type: application/json" \
+ -d '{
+ "customerId": "customer_id_here",
+ "products": [
+ {
+ "productId": "product_id_here",
+ "quantity": 1
+ }
+ ],
+ "paymentMethod": "PAYPAL"
+ }'
+
+
+
Complete Order Flow:
+
+ Validation: Order Service validates customer exists
+ Inventory: Checks product availability
+ Order Creation: Creates order with PENDING status
+ Payment: Processes payment via Payment Service
+ Kafka Event: Publishes order confirmation event
+ Email: Notification Service sends confirmation email
+ Status Update: Order status updated to PAID
+
+
+
+
+
+
+
+
View Distributed Tracing
+
+
Zipkin Dashboard:
+
Open Zipkin UI
+
+
What You'll See:
+
+ Complete request trace across all services
+ Service call duration and timing
+ Service dependencies visualization
+ Performance bottlenecks identification
+ Error propagation tracking
+
+
+
Trace Components:
+
+
Gateway
+
β
+
Order Service
+
β
+
Customer Service
+
β
+
Product Service
+
β
+
Payment Service
+
+
+
+
+
+
+
+
+
+
+
Monitoring Dashboards
+
+
+
Eureka Discovery
+
View all registered services and their health status
+
Open Dashboard
+
+
+
PostgreSQL Admin
+
Manage PostgreSQL databases for Order, Payment, and Product services
+
Open PgAdmin
+
+
+
MongoDB Admin
+
View MongoDB collections for Customer and Notification services
+
Open Mongo Express
+
+
+
Email Testing
+
View sent emails and test notification functionality
+
Open MailDev
+
+
+
+
+
+
+
+
+
+
+
+
Enterprise Deployment with Kubernetes
+
+
+
+
+
+
+
+
+
Kubernetes Native
+
Complete Kubernetes deployment manifests with Helm charts for production-ready deployment.
+
+ Deployment configurations for all services
+ Service discovery and load balancing
+ ConfigMaps and Secrets management
+ Ingress controllers and networking
+
+
+
+
+
+
+
+
+
Blue-Green Deployment
+
Zero-downtime deployment strategy with automated rollback capabilities for production environments.
+
+ Automated blue-green switching
+ Health checks and readiness probes
+ Instant rollback on failure
+ Traffic splitting for gradual rollouts
+
+
+
+
+
+
+
+
Helm Chart Deployment
+
+
+
+
Deploy the entire microservices stack:
+
+ # Install the complete microservices platform
+helm install ecommerce-platform ./k8s/helm-charts \
+ --namespace microservices \
+ --create-namespace
+
+# Verify deployment
+kubectl get pods -n microservices
+
+# Check services
+kubectl get svc -n microservices
+
+
+
+
+
+
Helm Features:
+
+ Parameterized deployments
+ Environment-specific values
+ Dependency management
+ Release versioning
+ Easy upgrades & rollbacks
+
+
+
+
+
+
+
+
+
Blue-Green Deployment Process
+
+
+
1
+
Prepare Green Environment
+
Deploy new version to green environment while blue serves production traffic
+
+ ./k8s/blue-green-deploy.sh prepare-green v2.0.0
+
+
+
+
+
2
+
Health Check & Validation
+
Automated health checks ensure green environment is ready for production
+
+ ./k8s/blue-green-deploy.sh validate-green
+
+
+
+
+
3
+
Switch Traffic
+
Instantly switch production traffic from blue to green environment
+
+ ./k8s/blue-green-deploy.sh switch-to-green
+
+
+
+
+
4
+
Rollback if Needed
+
Instant rollback to blue environment if issues are detected
+
+ ./k8s/blue-green-deploy.sh rollback-to-blue
+
+
+
+
+
+
+
+
Production-Ready Kubernetes Features
+
+
+
+
Security
+
+ Network policies for isolation
+ RBAC (Role-Based Access Control)
+ Secrets management
+ Pod security contexts
+
+
+
+
+
+
Monitoring & Observability
+
+ Prometheus metrics collection
+ Grafana dashboards
+ Distributed tracing with Jaeger
+ Centralized logging with ELK stack
+
+
+
+
+
+
Scalability
+
+ Horizontal Pod Autoscaling (HPA)
+ Vertical Pod Autoscaling (VPA)
+ Resource quotas and limits
+ Load balancing with ingress
+
+
+
+
+
+
+
+
+
Quick Start with Kubernetes
+
+
Prerequisites:
+
+ Docker Desktop with Kubernetes enabled
+ kubectl CLI tool
+ Helm 3.x installed
+
+
+
+
+ # 1. Build and push Docker images
+./k8s/build-images.sh
+
+# 2. Deploy with Helm
+helm install microservices ./k8s/helm-charts \
+ --namespace microservices \
+ --create-namespace \
+ --set global.environment=production
+
+# 3. Access the application
+kubectl port-forward svc/gateway-service 8222:8222 -n microservices
+
+# 4. Monitor deployment
+kubectl get all -n microservices
+kubectl logs -f deployment/gateway-service -n microservices
+
+
+
+
+
+
+
+
+
+
+
+
+ Complete Source Code Available
+
+
+ Access the complete, production-ready microservices implementation with detailed documentation,
+ configuration files, and step-by-step commit history.
+
+
+
+
+
+
+ Complete Spring Boot 3.2.5 implementation
+ Docker Compose configuration
+ Detailed README documentation
+ Step-by-step commit history
+
+
+
+
+ Production-ready configurations
+ Comprehensive testing examples
+ MIT License - Free to use
+ Active community support
+
+
+
+
+
+
+
+
+
+
+
fully-completed-microservices
+
Spring Boot Microservices Architecture
+
+
+ Java
+
+
+ Production Ready
+
+
+ Educational
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/script.js b/docs/script.js
new file mode 100644
index 0000000..100d468
--- /dev/null
+++ b/docs/script.js
@@ -0,0 +1,1133 @@
+// Learning Platform Interactive JavaScript
+
+document.addEventListener('DOMContentLoaded', function() {
+ // Initialize the application
+ initializeApp();
+});
+
+function initializeApp() {
+ // Setup navigation
+ setupSmoothScrolling();
+
+ // Setup interactive architecture diagram
+ setupArchitectureDiagram();
+
+ // Setup service modals
+ setupServiceModals();
+
+ // Setup copy code functionality
+ setupCodeCopying();
+
+ // Setup progress tracking
+ setupProgressTracking();
+
+ // Setup dynamic content loading
+ setupDynamicContent();
+
+ console.log('π Microservices Learning Platform Initialized');
+}
+
+// Smooth scrolling navigation
+function setupSmoothScrolling() {
+ const navLinks = document.querySelectorAll('a[href^="#"]');
+
+ navLinks.forEach(link => {
+ link.addEventListener('click', function(e) {
+ e.preventDefault();
+
+ const targetId = this.getAttribute('href').substring(1);
+ const targetElement = document.getElementById(targetId);
+
+ if (targetElement) {
+ const headerOffset = 80;
+ const elementPosition = targetElement.getBoundingClientRect().top;
+ const offsetPosition = elementPosition + window.pageYOffset - headerOffset;
+
+ window.scrollTo({
+ top: offsetPosition,
+ behavior: 'smooth'
+ });
+
+ // Update active navigation
+ updateActiveNavigation(targetId);
+ }
+ });
+ });
+}
+
+// Update active navigation item
+function updateActiveNavigation(activeId) {
+ const navLinks = document.querySelectorAll('.navbar-nav .nav-link');
+ navLinks.forEach(link => {
+ link.classList.remove('active');
+ if (link.getAttribute('href') === `#${activeId}`) {
+ link.classList.add('active');
+ }
+ });
+}
+
+// Interactive Architecture Diagram
+function setupArchitectureDiagram() {
+ const serviceBoxes = document.querySelectorAll('.service-box, .infra-box');
+
+ serviceBoxes.forEach(box => {
+ box.addEventListener('click', function() {
+ const serviceName = this.getAttribute('data-service');
+ showServiceDetails(serviceName);
+ });
+
+ // Add hover effects
+ box.addEventListener('mouseenter', function() {
+ this.style.transform = 'translateY(-10px) scale(1.05)';
+ showServiceTooltip(this);
+ });
+
+ box.addEventListener('mouseleave', function() {
+ this.style.transform = 'translateY(0) scale(1)';
+ hideServiceTooltip();
+ });
+ });
+}
+
+// Service details data
+const serviceDetails = {
+ config: {
+ title: 'Config Server',
+ icon: 'fas fa-cog',
+ port: '8888',
+ technology: 'Spring Cloud Config',
+ description: 'Centralized configuration management for all microservices',
+ features: [
+ 'Environment-specific configurations',
+ 'Dynamic configuration refresh',
+ 'Git integration for version control',
+ 'Encrypted sensitive properties',
+ 'Configuration validation'
+ ],
+ endpoints: [
+ { method: 'GET', path: '/{application}/{profile}', description: 'Get configuration' },
+ { method: 'POST', path: '/refresh', description: 'Refresh configuration' }
+ ]
+ },
+ discovery: {
+ title: 'Discovery Service',
+ icon: 'fas fa-search',
+ port: '8761',
+ technology: 'Netflix Eureka',
+ description: 'Service registry and discovery for dynamic service location',
+ features: [
+ 'Automatic service registration',
+ 'Health check monitoring',
+ 'Load balancing support',
+ 'Failover capabilities',
+ 'Service instance management'
+ ],
+ endpoints: [
+ { method: 'GET', path: '/eureka/apps', description: 'List all services' },
+ { method: 'GET', path: '/eureka/apps/{service}', description: 'Get service instances' }
+ ]
+ },
+ gateway: {
+ title: 'API Gateway',
+ icon: 'fas fa-door-open',
+ port: '8222',
+ technology: 'Spring Cloud Gateway',
+ description: 'Single entry point for all client requests with routing and filtering',
+ features: [
+ 'Dynamic request routing',
+ 'Load balancing',
+ 'Authentication & authorization',
+ 'Rate limiting',
+ 'Request/response transformation',
+ 'Distributed tracing integration'
+ ],
+ routes: [
+ { path: '/api/customers/**', target: 'Customer Service' },
+ { path: '/api/products/**', target: 'Product Service' },
+ { path: '/api/orders/**', target: 'Order Service' },
+ { path: '/api/payments/**', target: 'Payment Service' }
+ ]
+ },
+ customer: {
+ title: 'Customer Service',
+ icon: 'fas fa-users',
+ database: 'MongoDB',
+ technology: 'Spring Data MongoDB',
+ description: 'Manages customer profiles and related operations',
+ dataModel: {
+ fields: ['firstname', 'lastname', 'email', 'address'],
+ collections: ['customers']
+ },
+ apis: [
+ { method: 'POST', path: '/api/customers', description: 'Create customer' },
+ { method: 'GET', path: '/api/customers/{id}', description: 'Get customer details' },
+ { method: 'PUT', path: '/api/customers/{id}', description: 'Update customer' },
+ { method: 'GET', path: '/api/customers/exists/{id}', description: 'Check existence' }
+ ]
+ },
+ product: {
+ title: 'Product Service',
+ icon: 'fas fa-box',
+ database: 'PostgreSQL',
+ technology: 'Spring Data JPA',
+ description: 'Manages product catalog and inventory',
+ features: [
+ 'Product catalog management',
+ 'Inventory tracking',
+ 'Price management',
+ 'Product categorization'
+ ]
+ },
+ order: {
+ title: 'Order Service',
+ icon: 'fas fa-shopping-cart',
+ database: 'PostgreSQL',
+ technology: 'Spring Data JPA + OpenFeign + Kafka',
+ description: 'Orchestrates order processing workflow',
+ workflow: [
+ 'Validate customer via Customer Service',
+ 'Check product availability via Product Service',
+ 'Create order with PENDING status',
+ 'Process payment via Payment Service',
+ 'Publish order event to Kafka',
+ 'Update order status based on payment result'
+ ]
+ },
+ payment: {
+ title: 'Payment Service',
+ icon: 'fas fa-credit-card',
+ database: 'PostgreSQL',
+ technology: 'Spring Data JPA',
+ description: 'Handles payment processing and transactions'
+ },
+ notification: {
+ title: 'Notification Service',
+ icon: 'fas fa-envelope',
+ database: 'MongoDB',
+ technology: 'Kafka Consumer + Java Mail + Thymeleaf',
+ description: 'Event-driven email notification system',
+ events: [
+ 'Order confirmation',
+ 'Payment success',
+ 'Payment failure',
+ 'Order status updates'
+ ]
+ },
+ postgres: {
+ title: 'PostgreSQL',
+ icon: 'fas fa-database',
+ port: '5432',
+ description: 'Relational database for Order, Payment, and Product services',
+ features: ['ACID compliance', 'Complex queries', 'Transactions', 'Relationships']
+ },
+ mongodb: {
+ title: 'MongoDB',
+ icon: 'fas fa-leaf',
+ port: '27017',
+ description: 'Document database for Customer and Notification services',
+ features: ['Schema flexibility', 'Horizontal scaling', 'JSON documents', 'Rich queries']
+ },
+ kafka: {
+ title: 'Apache Kafka',
+ icon: 'fas fa-stream',
+ port: '9092',
+ description: 'Distributed streaming platform for event-driven communication',
+ topics: ['order-topic', 'payment-topic', 'notification-topic']
+ },
+ zipkin: {
+ title: 'Zipkin',
+ icon: 'fas fa-route',
+ port: '9411',
+ description: 'Distributed tracing system for monitoring microservices',
+ features: ['Request tracing', 'Performance monitoring', 'Service dependencies', 'Error tracking']
+ }
+};
+
+// Show service details modal
+function showServiceDetails(serviceName) {
+ const service = serviceDetails[serviceName];
+ if (!service) return;
+
+ const modal = document.getElementById('serviceModal');
+ const title = document.getElementById('serviceModalTitle');
+ const body = document.getElementById('serviceModalBody');
+
+ title.innerHTML = ` ${service.title}`;
+ body.innerHTML = generateServiceModalContent(service);
+
+ const bsModal = new bootstrap.Modal(modal);
+ bsModal.show();
+}
+
+// Generate service modal content
+function generateServiceModalContent(service) {
+ let content = `
+
+
+
+
Overview
+
${service.description}
+
+
+
+ `;
+
+ if (service.port) content += `
Port: ${service.port}
`;
+ if (service.database) content += `
Database: ${service.database}
`;
+ if (service.technology) content += `
Technology: ${service.technology}
`;
+
+ content += `
+
+
+
+ `;
+
+ if (service.features) {
+ content += `
+
+
Key Features
+
+ ${service.features.map(feature => `${feature} `).join('')}
+
+
+ `;
+ }
+
+ if (service.workflow) {
+ content += `
+
+
Workflow
+
+ ${service.workflow.map(step => `${step} `).join('')}
+
+
+ `;
+ }
+
+ if (service.apis) {
+ content += `
+
+
API Endpoints
+
+ ${service.apis.map(api => `
+
+ ${api.method}
+ ${api.path}
+ ${api.description}
+
+ `).join('')}
+
+
+ `;
+ }
+
+ if (service.routes) {
+ content += `
+
+
Routes
+
+ ${service.routes.map(route => `
+
+ ${route.path} β ${route.target}
+
+ `).join('')}
+
+
+ `;
+ }
+
+ if (service.topics) {
+ content += `
+
+
Kafka Topics
+
+ ${service.topics.map(topic => `${topic} `).join(' ')}
+
+
+ `;
+ }
+
+ content += `
`;
+ return content;
+}
+
+// Tooltip functionality
+let tooltip = null;
+
+function showServiceTooltip(element) {
+ const serviceName = element.getAttribute('data-service');
+ const service = serviceDetails[serviceName];
+ if (!service) return;
+
+ // Remove existing tooltip
+ hideServiceTooltip();
+
+ // Create tooltip
+ tooltip = document.createElement('div');
+ tooltip.className = 'service-tooltip';
+ tooltip.innerHTML = `
+ ${service.title}
+ ${service.description}
+ ${service.port ? `Port: ${service.port}
` : ''}
+ `;
+
+ document.body.appendChild(tooltip);
+
+ // Position tooltip
+ const rect = element.getBoundingClientRect();
+ tooltip.style.left = rect.left + rect.width / 2 - tooltip.offsetWidth / 2 + 'px';
+ tooltip.style.top = rect.top - tooltip.offsetHeight - 10 + 'px';
+
+ // Show tooltip
+ setTimeout(() => tooltip.classList.add('show'), 10);
+}
+
+function hideServiceTooltip() {
+ if (tooltip) {
+ tooltip.remove();
+ tooltip = null;
+ }
+}
+
+// Setup service modals
+function setupServiceModals() {
+ // Modal styles
+ const modalStyles = `
+
+ `;
+
+ document.head.insertAdjacentHTML('beforeend', modalStyles);
+}
+
+// Code copying functionality
+function setupCodeCopying() {
+ const codeBlocks = document.querySelectorAll('pre code, .code-block code');
+
+ codeBlocks.forEach(block => {
+ const container = block.closest('pre, .code-block');
+ if (container && !container.querySelector('.copy-btn')) {
+ const copyBtn = document.createElement('button');
+ copyBtn.className = 'copy-btn';
+ copyBtn.innerHTML = ' ';
+ copyBtn.title = 'Copy to clipboard';
+
+ copyBtn.addEventListener('click', () => {
+ navigator.clipboard.writeText(block.textContent).then(() => {
+ copyBtn.innerHTML = ' ';
+ copyBtn.style.background = '#28a745';
+
+ setTimeout(() => {
+ copyBtn.innerHTML = ' ';
+ copyBtn.style.background = '#667eea';
+ }, 2000);
+ });
+ });
+
+ container.style.position = 'relative';
+ container.appendChild(copyBtn);
+ }
+ });
+
+ // Copy button styles
+ const copyStyles = `
+
+ `;
+
+ document.head.insertAdjacentHTML('beforeend', copyStyles);
+}
+
+// Progress tracking
+function setupProgressTracking() {
+ const sections = document.querySelectorAll('section[id]');
+ let currentSection = '';
+
+ window.addEventListener('scroll', () => {
+ const scrollPosition = window.pageYOffset + 100;
+
+ sections.forEach(section => {
+ const sectionTop = section.offsetTop;
+ const sectionBottom = sectionTop + section.offsetHeight;
+
+ if (scrollPosition >= sectionTop && scrollPosition < sectionBottom) {
+ if (currentSection !== section.id) {
+ currentSection = section.id;
+ updateActiveNavigation(currentSection);
+ updateProgressBar(section.id);
+ }
+ }
+ });
+ });
+
+ // Create progress bar
+ const progressBar = document.createElement('div');
+ progressBar.className = 'learning-progress';
+ progressBar.innerHTML = `
+
+ Learning Progress
+ `;
+ document.body.appendChild(progressBar);
+
+ // Progress bar styles
+ const progressStyles = `
+
+ `;
+ document.head.insertAdjacentHTML('beforeend', progressStyles);
+}
+
+function updateProgressBar(sectionId) {
+ const sections = ['home', 'overview', 'architecture', 'repository', 'services', 'patterns', 'hands-on'];
+ const currentIndex = sections.indexOf(sectionId);
+ const progress = currentIndex >= 0 ? ((currentIndex + 1) / sections.length) * 100 : 0;
+
+ const progressFill = document.querySelector('.progress-fill');
+ if (progressFill) {
+ progressFill.style.width = progress + '%';
+ }
+}
+
+// Dynamic content loading
+function setupDynamicContent() {
+ // Service status checking
+ const statusIndicators = document.querySelectorAll('.service-status');
+ statusIndicators.forEach(indicator => {
+ checkServiceStatus(indicator);
+ });
+
+ // Auto-refresh service statuses every 30 seconds
+ setInterval(() => {
+ statusIndicators.forEach(indicator => {
+ checkServiceStatus(indicator);
+ });
+ }, 30000);
+}
+
+function checkServiceStatus(indicator) {
+ const serviceName = indicator.getAttribute('data-service');
+ const url = getServiceHealthUrl(serviceName);
+
+ if (!url) return;
+
+ fetch(url)
+ .then(response => {
+ if (response.ok) {
+ indicator.className = 'service-status online';
+ indicator.textContent = 'Online';
+ } else {
+ indicator.className = 'service-status offline';
+ indicator.textContent = 'Offline';
+ }
+ })
+ .catch(() => {
+ indicator.className = 'service-status offline';
+ indicator.textContent = 'Offline';
+ });
+}
+
+function getServiceHealthUrl(serviceName) {
+ const healthUrls = {
+ 'config': 'http://localhost:8888/actuator/health',
+ 'discovery': 'http://localhost:8761/actuator/health',
+ 'gateway': 'http://localhost:8222/actuator/health',
+ 'zipkin': 'http://localhost:9411/health'
+ };
+
+ return healthUrls[serviceName];
+}
+
+// Keyboard shortcuts
+document.addEventListener('keydown', function(e) {
+ // Press 'h' to go home
+ if (e.key === 'h' && !e.ctrlKey && !e.metaKey) {
+ document.getElementById('home').scrollIntoView({ behavior: 'smooth' });
+ }
+
+ // Press 'a' to go to architecture
+ if (e.key === 'a' && !e.ctrlKey && !e.metaKey) {
+ document.getElementById('architecture').scrollIntoView({ behavior: 'smooth' });
+ }
+
+ // Press 's' to go to services
+ if (e.key === 's' && !e.ctrlKey && !e.metaKey) {
+ document.getElementById('services').scrollIntoView({ behavior: 'smooth' });
+ }
+
+ // Press 'p' to go to patterns
+ if (e.key === 'p' && !e.ctrlKey && !e.metaKey) {
+ document.getElementById('patterns').scrollIntoView({ behavior: 'smooth' });
+ }
+});
+
+// Print functionality
+function printLearningGuide() {
+ window.print();
+}
+
+// Export learning progress
+function exportProgress() {
+ const progress = {
+ timestamp: new Date().toISOString(),
+ sectionsVisited: getSectionsVisited(),
+ currentSection: getCurrentSection(),
+ timeSpent: getTimeSpent()
+ };
+
+ const blob = new Blob([JSON.stringify(progress, null, 2)], { type: 'application/json' });
+ const url = URL.createObjectURL(blob);
+ const a = document.createElement('a');
+ a.href = url;
+ a.download = 'microservices-learning-progress.json';
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ URL.revokeObjectURL(url);
+}
+
+function getSectionsVisited() {
+ return JSON.parse(localStorage.getItem('sectionsVisited') || '[]');
+}
+
+function getCurrentSection() {
+ return document.querySelector('section:target')?.id || 'home';
+}
+
+function getTimeSpent() {
+ return parseInt(localStorage.getItem('timeSpent') || '0');
+}
+
+// Initialize time tracking
+let startTime = Date.now();
+setInterval(() => {
+ const timeSpent = parseInt(localStorage.getItem('timeSpent') || '0');
+ localStorage.setItem('timeSpent', (timeSpent + 60).toString());
+}, 60000);
+
+// Add utility functions for external use
+window.MicroservicesLearningPlatform = {
+ showServiceDetails,
+ exportProgress,
+ printLearningGuide,
+ getCurrentSection,
+ getSectionsVisited
+};
+
+console.log('π Welcome to the Microservices Learning Platform!');
+console.log('Press "h" for home, "a" for architecture, "s" for services, "p" for patterns');
+console.log('Click on any service box to see detailed information');
+
+// Kubernetes Deployment Interactive Features
+function setupDeploymentInteractions() {
+ // Setup blue-green deployment visualization
+ setupBlueGreenVisualization();
+
+ // Setup Helm command examples
+ setupHelmCommands();
+
+ // Setup deployment step animations
+ setupDeploymentAnimations();
+
+ // Setup circuit breaker demonstration
+ setupCircuitBreakerDemo();
+
+ console.log('π’ Deployment interactions initialized');
+}
+
+// Blue-Green Deployment Visualization
+function setupBlueGreenVisualization() {
+ const deploymentSteps = document.querySelectorAll('.deployment-step');
+
+ deploymentSteps.forEach((step, index) => {
+ step.addEventListener('click', function() {
+ // Reset all steps
+ deploymentSteps.forEach(s => s.classList.remove('active', 'completed'));
+
+ // Mark current and previous steps as completed
+ for (let i = 0; i <= index; i++) {
+ deploymentSteps[i].classList.add('completed');
+ }
+
+ // Mark current step as active
+ this.classList.add('active');
+
+ // Show deployment status
+ showDeploymentStatus(index);
+ });
+ });
+}
+
+function showDeploymentStatus(step) {
+ const statusMessages = [
+ 'π Preparing green environment... Building and deploying new version.',
+ 'β
Running health checks... Validating green environment readiness.',
+ 'π Switching traffic... Routing production traffic to green environment.',
+ 'π Rollback ready... Blue environment available for instant rollback.'
+ ];
+
+ // Create or update status display
+ let statusDiv = document.querySelector('.deployment-status');
+ if (!statusDiv) {
+ statusDiv = document.createElement('div');
+ statusDiv.className = 'deployment-status alert alert-info mt-3';
+ document.querySelector('.blue-green-section').appendChild(statusDiv);
+ }
+
+ statusDiv.innerHTML = `
+
+
+
Step ${step + 1}: ${statusMessages[step]}
+
+ `;
+
+ // Remove spinner after 2 seconds
+ setTimeout(() => {
+ statusDiv.querySelector('.spinner-border')?.remove();
+ }, 2000);
+}
+
+// Helm Command Examples
+function setupHelmCommands() {
+ const helmSection = document.querySelector('.helm-section');
+ if (!helmSection) return;
+
+ // Create interactive Helm command builder
+ const commandBuilder = document.createElement('div');
+ commandBuilder.className = 'helm-command-builder mt-3 p-3 bg-light border rounded';
+ commandBuilder.innerHTML = `
+ Interactive Helm Command Builder
+
+
+ Namespace:
+
+ microservices
+ production
+ staging
+ development
+
+
+
+ Environment:
+
+ production
+ staging
+ development
+
+
+
+
+ helm install ecommerce-platform ./k8s/helm-charts --namespace microservices --create-namespace --set global.environment=production
+
+
+ Copy Command
+
+ `;
+
+ helmSection.appendChild(commandBuilder);
+
+ // Update command on change
+ const inputs = commandBuilder.querySelectorAll('select');
+ inputs.forEach(input => {
+ input.addEventListener('change', updateHelmCommand);
+ });
+}
+
+function updateHelmCommand() {
+ const namespace = document.getElementById('namespace').value;
+ const environment = document.getElementById('environment').value;
+ const command = `helm install ecommerce-platform ./k8s/helm-charts --namespace ${namespace} --create-namespace --set global.environment=${environment}`;
+ document.getElementById('helmCommand').textContent = command;
+}
+
+function copyHelmCommand() {
+ const command = document.getElementById('helmCommand').textContent;
+ copyToClipboard(command);
+
+ // Show feedback
+ const btn = event.target.closest('button');
+ const originalText = btn.innerHTML;
+ btn.innerHTML = ' Copied!';
+ btn.classList.add('btn-success');
+ btn.classList.remove('btn-primary');
+
+ setTimeout(() => {
+ btn.innerHTML = originalText;
+ btn.classList.remove('btn-success');
+ btn.classList.add('btn-primary');
+ }, 2000);
+}
+
+// Deployment Step Animations
+function setupDeploymentAnimations() {
+ // Intersection Observer for step animations
+ const observer = new IntersectionObserver((entries) => {
+ entries.forEach(entry => {
+ if (entry.isIntersecting) {
+ entry.target.style.animationDelay = entry.target.dataset.delay + 'ms';
+ entry.target.classList.add('animate-in');
+ }
+ });
+ });
+
+ document.querySelectorAll('.deployment-step').forEach((step, index) => {
+ step.dataset.delay = index * 200;
+ observer.observe(step);
+ });
+}
+
+// Circuit Breaker Demonstration
+function setupCircuitBreakerDemo() {
+ const circuitBreakerCard = document.querySelector('.pattern-card:has(.fa-plug-circle-xmark)');
+ if (!circuitBreakerCard) return;
+
+ // Add interactive demo button
+ const demoSection = document.createElement('div');
+ demoSection.className = 'circuit-breaker-demo mt-3';
+ demoSection.innerHTML = `
+
+
+ Test Saga Orchestration CB
+
+
+ Test Saga Compensation CB
+
+
+ Test Saga Recovery CB
+
+
+
+ `;
+
+ circuitBreakerCard.appendChild(demoSection);
+}
+
+function simulateCircuitBreaker(type) {
+ const statusDiv = document.querySelector('.demo-status');
+ const states = ['CLOSED', 'OPEN', 'HALF_OPEN'];
+ let currentState = 0;
+
+ const typeNames = {
+ 'saga-orchestration': 'Saga Orchestration',
+ 'saga-compensation': 'Saga Compensation',
+ 'saga-recovery': 'Saga Recovery'
+ };
+
+ const interval = setInterval(() => {
+ const state = states[currentState];
+ const color = state === 'CLOSED' ? 'success' : state === 'OPEN' ? 'danger' : 'warning';
+
+ statusDiv.innerHTML = `
+
+ ${typeNames[type]} Circuit Breaker:
+ ${state}
+ ${getCircuitBreakerMessage(state)}
+
+ `;
+
+ currentState = (currentState + 1) % states.length;
+
+ if (currentState === 0) {
+ clearInterval(interval);
+ setTimeout(() => {
+ statusDiv.innerHTML = '';
+ }, 3000);
+ }
+ }, 2000);
+}
+
+function getCircuitBreakerMessage(state) {
+ switch (state) {
+ case 'CLOSED': return 'All requests passing through normally';
+ case 'OPEN': return 'Failing fast, requests blocked';
+ case 'HALF_OPEN': return 'Testing with limited requests';
+ default: return '';
+ }
+}
+
+// Saga Pattern Visualization
+function setupSagaVisualization() {
+ const sagaCard = document.querySelector('.pattern-card:has(.fa-project-diagram)');
+ if (!sagaCard) return;
+
+ const visualizer = document.createElement('div');
+ visualizer.className = 'saga-visualizer mt-3';
+ visualizer.innerHTML = `
+
+
+ Run Saga Flow Demo
+
+
+
+ `;
+
+ sagaCard.appendChild(visualizer);
+}
+
+function runSagaDemo() {
+ const stepsContainer = document.querySelector('.saga-steps');
+ const steps = [
+ { name: 'Customer Validation', status: 'running', duration: 1000 },
+ { name: 'Inventory Reservation', status: 'pending', duration: 1500 },
+ { name: 'Payment Processing', status: 'pending', duration: 2000 },
+ { name: 'Order Completion', status: 'pending', duration: 1000 }
+ ];
+
+ let currentStep = 0;
+
+ function updateDisplay() {
+ stepsContainer.innerHTML = steps.map((step, index) => {
+ let statusClass = 'secondary';
+ let icon = 'fas fa-clock';
+
+ if (index < currentStep) {
+ statusClass = 'success';
+ icon = 'fas fa-check';
+ } else if (index === currentStep) {
+ statusClass = 'primary';
+ icon = 'fas fa-spinner fa-spin';
+ }
+
+ return `
+
+
+
+
+ ${step.name}
+
+ `;
+ }).join('');
+ }
+
+ updateDisplay();
+
+ const stepInterval = setInterval(() => {
+ if (currentStep < steps.length) {
+ currentStep++;
+ updateDisplay();
+
+ if (currentStep >= steps.length) {
+ clearInterval(stepInterval);
+ setTimeout(() => {
+ stepsContainer.innerHTML = 'β
Saga completed successfully!
';
+ setTimeout(() => stepsContainer.innerHTML = '', 3000);
+ }, 1000);
+ }
+ }
+ }, 2000);
+}
+
+// Update the main initialization function
+const originalInitializeApp = initializeApp;
+initializeApp = function() {
+ originalInitializeApp();
+
+ // Initialize deployment features
+ setupDeploymentInteractions();
+ setupSagaVisualization();
+
+ console.log('π― Enhanced with Kubernetes deployment features');
+};
+
+// Add CSS animations for deployment steps
+const deploymentCSS = `
+.deployment-step {
+ opacity: 0;
+ transform: translateY(20px);
+ transition: all 0.6s ease;
+}
+
+.deployment-step.animate-in {
+ opacity: 1;
+ transform: translateY(0);
+}
+
+.deployment-step.active {
+ border-top-width: 6px;
+ box-shadow: 0 15px 35px rgba(0,0,0,0.2);
+}
+
+.deployment-step.completed {
+ background: linear-gradient(135deg, #f8f9fa, #e9ecef);
+}
+
+.deployment-step.completed .step-number {
+ background: #28a745 !important;
+}
+`;
+
+// Inject CSS
+const style = document.createElement('style');
+style.textContent = deploymentCSS;
+document.head.appendChild(style);
+
+console.log('π Kubernetes & Circuit Breaker features loaded!');
+console.log('Click deployment steps to see the blue-green process in action');
+console.log('Try the circuit breaker demos to see resilience patterns');
diff --git a/docs/styles.css b/docs/styles.css
new file mode 100644
index 0000000..2df50ef
--- /dev/null
+++ b/docs/styles.css
@@ -0,0 +1,1172 @@
+/* Reset and Base Styles */
+* {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+}
+
+body {
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
+ line-height: 1.6;
+ color: #333;
+}
+
+/* Hero Section */
+.hero-section {
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ color: white;
+ min-height: 100vh;
+ display: flex;
+ align-items: center;
+ padding-top: 80px;
+}
+
+.hero-title {
+ font-size: 3.5rem;
+ font-weight: 700;
+ margin-bottom: 1rem;
+ text-shadow: 0 2px 4px rgba(0,0,0,0.3);
+}
+
+.hero-subtitle {
+ font-size: 1.3rem;
+ margin-bottom: 2rem;
+ opacity: 0.9;
+}
+
+.hero-stats {
+ display: flex;
+ justify-content: center;
+ gap: 3rem;
+ margin: 2rem 0;
+}
+
+.stat {
+ text-align: center;
+}
+
+.stat h3 {
+ font-size: 2.5rem;
+ font-weight: 700;
+ color: #ffd700;
+}
+
+.stat p {
+ font-size: 1rem;
+ text-transform: uppercase;
+ letter-spacing: 1px;
+}
+
+/* GitHub Integration Styles */
+.hero-buttons {
+ margin: 2rem 0;
+}
+
+.github-info {
+ background: rgba(255, 255, 255, 0.1);
+ backdrop-filter: blur(10px);
+ border-radius: 15px;
+ padding: 1.5rem;
+ margin: 2rem auto;
+ max-width: 600px;
+}
+
+.repo-stats {
+ text-align: center;
+}
+
+.repo-link {
+ color: #ffd700;
+ text-decoration: none;
+ font-size: 1.1rem;
+ font-weight: 600;
+ display: inline-block;
+ margin-bottom: 0.5rem;
+ transition: all 0.3s ease;
+}
+
+.repo-link:hover {
+ color: #ffffff;
+ transform: scale(1.05);
+}
+
+.repo-link i {
+ margin-right: 0.5rem;
+ font-size: 1.3rem;
+}
+
+.author-info {
+ margin-top: 1rem;
+ font-size: 0.95rem;
+}
+
+.author-link {
+ color: #e2e8f0;
+ text-decoration: none;
+ margin-left: 1rem;
+ transition: color 0.3s ease;
+}
+
+.author-link:hover {
+ color: #ffd700;
+}
+
+.author-link i {
+ margin-right: 0.25rem;
+}
+
+/* GitHub Clone Section */
+.github-clone-section {
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ border-radius: 15px;
+ padding: 2rem;
+ color: white;
+ border: none !important;
+}
+
+.github-clone-section .alert-info {
+ background: rgba(255, 255, 255, 0.1);
+ backdrop-filter: blur(10px);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ color: white;
+}
+
+.github-clone-section h5 {
+ color: #ffd700;
+ margin-bottom: 1rem;
+}
+
+.github-clone-section .code-block {
+ background: rgba(0, 0, 0, 0.3);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+}
+
+.github-clone-section .text-primary {
+ color: #ffd700 !important;
+}
+
+/* Sections */
+.section {
+ padding: 80px 0;
+}
+
+.section-title {
+ text-align: center;
+ font-size: 2.5rem;
+ font-weight: 700;
+ margin-bottom: 3rem;
+ color: #2c3e50;
+}
+
+.section-title::after {
+ content: '';
+ display: block;
+ width: 80px;
+ height: 4px;
+ background: linear-gradient(90deg, #667eea, #764ba2);
+ margin: 1rem auto;
+}
+
+/* Business Problem & Solution */
+.business-problem, .business-solution {
+ background: #f8f9fa;
+ padding: 2rem;
+ border-radius: 10px;
+ box-shadow: 0 5px 15px rgba(0,0,0,0.1);
+ height: 100%;
+}
+
+.business-problem {
+ border-left: 5px solid #e74c3c;
+}
+
+.business-solution {
+ border-left: 5px solid #27ae60;
+}
+
+.problem-list, .solution-list {
+ list-style: none;
+ padding: 0;
+}
+
+.problem-list li, .solution-list li {
+ padding: 0.5rem 0;
+ position: relative;
+ padding-left: 1.5rem;
+}
+
+.problem-list li::before {
+ content: 'β οΈ';
+ position: absolute;
+ left: 0;
+}
+
+.solution-list li::before {
+ content: 'β
';
+ position: absolute;
+ left: 0;
+}
+
+/* Architecture Diagram */
+.architecture-diagram {
+ background: #f8f9fa;
+ padding: 2rem;
+ border-radius: 15px;
+ margin: 2rem 0;
+}
+
+.service-layer {
+ margin: 2rem 0;
+ text-align: center;
+}
+
+.service-layer h4 {
+ margin-bottom: 1rem;
+ color: #2c3e50;
+ font-weight: 600;
+}
+
+.service-box {
+ display: inline-block;
+ background: white;
+ padding: 1.5rem;
+ margin: 0.5rem;
+ border-radius: 10px;
+ box-shadow: 0 5px 15px rgba(0,0,0,0.1);
+ cursor: pointer;
+ transition: all 0.3s ease;
+ min-width: 150px;
+ position: relative;
+}
+
+.service-box:hover {
+ transform: translateY(-5px);
+ box-shadow: 0 10px 25px rgba(0,0,0,0.15);
+}
+
+.service-box i {
+ font-size: 2rem;
+ display: block;
+ margin-bottom: 0.5rem;
+}
+
+.service-box span {
+ display: block;
+ font-weight: 600;
+ margin-bottom: 0.5rem;
+}
+
+.service-box small {
+ color: #666;
+ font-size: 0.85rem;
+}
+
+/* Service Box Colors */
+.client-box { border-top: 4px solid #3498db; }
+.client-box i { color: #3498db; }
+
+.gateway-box { border-top: 4px solid #27ae60; }
+.gateway-box i { color: #27ae60; }
+
+.config-box { border-top: 4px solid #f39c12; }
+.config-box i { color: #f39c12; }
+
+.discovery-box { border-top: 4px solid #17a2b8; }
+.discovery-box i { color: #17a2b8; }
+
+.business-box { border-top: 4px solid #6f42c1; }
+.business-box i { color: #6f42c1; }
+
+.infra-box { border-top: 4px solid #dc3545; }
+.infra-box i { color: #dc3545; }
+
+.infrastructure-grid {
+ display: flex;
+ justify-content: center;
+ flex-wrap: wrap;
+ gap: 1rem;
+}
+
+.infra-box {
+ background: white;
+ padding: 1rem;
+ border-radius: 8px;
+ text-align: center;
+ min-width: 120px;
+ box-shadow: 0 3px 10px rgba(0,0,0,0.1);
+}
+
+/* Service Detail Tabs */
+.nav-pills .nav-link {
+ color: #6c757d;
+ background: transparent;
+ border: 2px solid #dee2e6;
+ margin: 0 0.25rem;
+ border-radius: 25px;
+ padding: 0.75rem 1.5rem;
+ transition: all 0.3s ease;
+}
+
+.nav-pills .nav-link:hover {
+ background: #f8f9fa;
+ color: #495057;
+}
+
+.nav-pills .nav-link.active {
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ color: white;
+ border-color: transparent;
+}
+
+/* Service Detail Cards */
+.service-detail {
+ background: white;
+ padding: 2rem;
+ border-radius: 15px;
+ box-shadow: 0 5px 20px rgba(0,0,0,0.1);
+ margin-top: 2rem;
+}
+
+.service-info {
+ background: #f8f9fa;
+ padding: 1.5rem;
+ border-radius: 10px;
+ border-left: 5px solid #667eea;
+}
+
+.service-info h4 {
+ margin-bottom: 1rem;
+}
+
+.service-info p {
+ margin-bottom: 0.5rem;
+ font-weight: 500;
+}
+
+.service-description h5 {
+ color: #2c3e50;
+ margin-bottom: 1rem;
+ font-weight: 600;
+}
+
+.service-description h6 {
+ color: #495057;
+ margin: 1.5rem 0 0.5rem 0;
+ font-weight: 600;
+}
+
+/* API Endpoints */
+.api-endpoints {
+ background: #f8f9fa;
+ padding: 1rem;
+ border-radius: 8px;
+ margin: 1rem 0;
+}
+
+.endpoint {
+ display: flex;
+ align-items: center;
+ margin: 0.5rem 0;
+ padding: 0.5rem;
+ background: white;
+ border-radius: 5px;
+}
+
+.method {
+ padding: 0.25rem 0.75rem;
+ border-radius: 4px;
+ color: white;
+ font-weight: 600;
+ font-size: 0.85rem;
+ margin-right: 1rem;
+ min-width: 60px;
+ text-align: center;
+}
+
+.method.get { background: #28a745; }
+.method.post { background: #007bff; }
+.method.put { background: #ffc107; color: #333; }
+.method.delete { background: #dc3545; }
+
+.code-example {
+ background: #f8f9fa;
+ border-radius: 10px;
+ padding: 1.5rem;
+ border-left: 4px solid #007bff;
+}
+
+.code-example h6 {
+ color: #495057;
+ margin-bottom: 1rem;
+ font-weight: 600;
+}
+
+.code-block {
+ background: #2d3748;
+ border-radius: 8px;
+ padding: 1.5rem;
+ margin: 1rem 0;
+}
+
+.code-block code {
+ color: #e2e8f0;
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
+ line-height: 1.8;
+ font-size: 0.9rem;
+}
+
+/* Design Patterns */
+.pattern-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
+ gap: 2rem;
+ margin: 2rem 0;
+}
+
+.pattern-card {
+ background: white;
+ padding: 2rem;
+ border-radius: 15px;
+ box-shadow: 0 5px 20px rgba(0,0,0,0.1);
+ transition: transform 0.3s ease;
+ border-top: 5px solid #667eea;
+}
+
+.pattern-card:hover {
+ transform: translateY(-5px);
+}
+
+.pattern-icon {
+ text-align: center;
+ margin-bottom: 1rem;
+}
+
+.pattern-icon i {
+ font-size: 3rem;
+ color: #667eea;
+}
+
+.pattern-card h4 {
+ text-align: center;
+ color: #2c3e50;
+ margin-bottom: 1rem;
+}
+
+.pattern-benefits h6 {
+ color: #495057;
+ margin: 1rem 0 0.5rem 0;
+}
+
+.pattern-benefits ul {
+ list-style-type: none;
+ padding: 0;
+}
+
+.pattern-benefits li {
+ padding: 0.25rem 0;
+ position: relative;
+ padding-left: 1.5rem;
+}
+
+.pattern-benefits li::before {
+ content: 'βΈ';
+ position: absolute;
+ left: 0;
+ color: #667eea;
+ font-weight: bold;
+}
+
+/* Hands-On Section */
+.setup-steps {
+ margin: 2rem 0;
+}
+
+.step {
+ display: flex;
+ align-items: flex-start;
+ margin: 2rem 0;
+ background: white;
+ padding: 1.5rem;
+ border-radius: 10px;
+ box-shadow: 0 3px 15px rgba(0,0,0,0.1);
+}
+
+.step-number {
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ color: white;
+ width: 40px;
+ height: 40px;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-weight: bold;
+ margin-right: 1.5rem;
+ flex-shrink: 0;
+}
+
+.step-content {
+ flex: 1;
+}
+
+.step-content h5 {
+ color: #2c3e50;
+ margin-bottom: 1rem;
+}
+
+.code-block {
+ background: #2d3748;
+ border-radius: 8px;
+ padding: 1.5rem;
+ margin: 1rem 0;
+}
+
+.service-startup {
+ margin: 1rem 0;
+}
+
+.startup-order {
+ display: flex;
+ align-items: center;
+ margin: 0.5rem 0;
+ padding: 0.5rem;
+ background: #f8f9fa;
+ border-radius: 5px;
+}
+
+.order-number {
+ background: #667eea;
+ color: white;
+ width: 25px;
+ height: 25px;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 0.85rem;
+ font-weight: bold;
+ margin-right: 1rem;
+}
+
+/* Testing Scenarios */
+.scenario-content {
+ padding: 1.5rem;
+}
+
+.curl-example {
+ margin: 1rem 0;
+}
+
+.curl-example pre {
+ background: #2d3748;
+ color: #e2e8f0;
+ padding: 1rem;
+ border-radius: 8px;
+ font-size: 0.9rem;
+ overflow-x: auto;
+}
+
+.expected-result {
+ background: #e8f5e8;
+ padding: 1rem;
+ border-radius: 8px;
+ border-left: 5px solid #28a745;
+ margin: 1rem 0;
+}
+
+.trace-flow {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-wrap: wrap;
+ margin: 1rem 0;
+}
+
+.trace-step {
+ background: #667eea;
+ color: white;
+ padding: 0.5rem 1rem;
+ border-radius: 25px;
+ margin: 0.25rem;
+ font-size: 0.9rem;
+}
+
+.trace-arrow {
+ color: #667eea;
+ font-size: 1.5rem;
+ margin: 0 0.5rem;
+}
+
+/* Monitoring Dashboards */
+.dashboard-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
+ gap: 1.5rem;
+ margin: 2rem 0;
+}
+
+.dashboard-card {
+ background: white;
+ padding: 1.5rem;
+ border-radius: 10px;
+ box-shadow: 0 5px 15px rgba(0,0,0,0.1);
+ text-align: center;
+ border-top: 4px solid #667eea;
+}
+
+.dashboard-card h5 {
+ color: #2c3e50;
+ margin-bottom: 1rem;
+}
+
+.dashboard-card p {
+ color: #666;
+ margin-bottom: 1.5rem;
+}
+
+/* Footer */
+.footer {
+ background: #2c3e50 !important;
+}
+
+.tech-stack {
+ margin-top: 0.5rem;
+}
+
+.tech-stack .badge {
+ margin: 0.25rem;
+ padding: 0.5rem 0.75rem;
+ font-size: 0.85rem;
+}
+
+/* Kubernetes Deployment Section Styles */
+.deployment-feature {
+ background: white;
+ border-radius: 15px;
+ padding: 2rem;
+ box-shadow: 0 8px 25px rgba(0,0,0,0.1);
+ transition: all 0.3s ease;
+ height: 100%;
+ border-left: 4px solid #007bff;
+}
+
+.deployment-feature:hover {
+ transform: translateY(-5px);
+ box-shadow: 0 15px 35px rgba(0,0,0,0.15);
+}
+
+.feature-icon {
+ width: 60px;
+ height: 60px;
+ background: linear-gradient(135deg, #007bff, #0056b3);
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-bottom: 1.5rem;
+}
+
+.feature-icon i {
+ font-size: 1.5rem;
+ color: white;
+}
+
+.feature-list {
+ list-style: none;
+ padding: 0;
+}
+
+.feature-list li {
+ padding: 0.5rem 0;
+ padding-left: 1.5rem;
+ position: relative;
+}
+
+.feature-list li::before {
+ content: 'β';
+ position: absolute;
+ left: 0;
+ color: #28a745;
+ font-weight: bold;
+}
+
+/* Helm Section Styles */
+.helm-section {
+ background: #f8f9fa;
+ border-radius: 15px;
+ padding: 2rem;
+}
+
+.helm-features h6 {
+ color: #495057;
+ margin-bottom: 1rem;
+ font-weight: 600;
+}
+
+.helm-features ul {
+ list-style-type: none;
+ padding: 0;
+}
+
+.helm-features li {
+ padding: 0.5rem 0;
+ padding-left: 1.5rem;
+ position: relative;
+ color: #6c757d;
+}
+
+.helm-features li::before {
+ content: 'β‘';
+ position: absolute;
+ left: 0;
+ color: #007bff;
+}
+
+/* Blue-Green Deployment Flow */
+.deployment-flow {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
+ gap: 1.5rem;
+ margin: 2rem 0;
+}
+
+.deployment-step {
+ background: white;
+ border-radius: 15px;
+ padding: 1.5rem;
+ text-align: center;
+ box-shadow: 0 5px 15px rgba(0,0,0,0.1);
+ transition: all 0.3s ease;
+ border-top: 4px solid transparent;
+}
+
+.deployment-step:nth-child(1) { border-top-color: #007bff; }
+.deployment-step:nth-child(2) { border-top-color: #28a745; }
+.deployment-step:nth-child(3) { border-top-color: #ffc107; }
+.deployment-step:nth-child(4) { border-top-color: #dc3545; }
+
+.deployment-step:hover {
+ transform: translateY(-5px);
+ box-shadow: 0 10px 25px rgba(0,0,0,0.15);
+}
+
+.step-number {
+ width: 40px;
+ height: 40px;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin: 0 auto 1rem auto;
+ color: white;
+ font-weight: bold;
+ font-size: 1.2rem;
+}
+
+.code-snippet {
+ background: #f8f9fa;
+ border-radius: 8px;
+ padding: 0.75rem;
+ margin-top: 1rem;
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
+}
+
+.code-snippet code {
+ color: #e83e8c;
+ font-size: 0.9rem;
+}
+
+/* Kubernetes Features Grid */
+.k8s-features {
+ margin: 2rem 0;
+}
+
+.feature-card {
+ background: white;
+ border-radius: 15px;
+ padding: 2rem;
+ height: 100%;
+ box-shadow: 0 5px 15px rgba(0,0,0,0.1);
+ transition: all 0.3s ease;
+ border-bottom: 4px solid #007bff;
+}
+
+.feature-card:hover {
+ transform: translateY(-3px);
+ box-shadow: 0 10px 25px rgba(0,0,0,0.15);
+}
+
+.feature-card h5 {
+ color: #495057;
+ margin-bottom: 1rem;
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.feature-card h5 i {
+ color: #007bff;
+}
+
+.feature-card ul {
+ list-style: none;
+ padding: 0;
+}
+
+.feature-card li {
+ padding: 0.5rem 0;
+ padding-left: 1.5rem;
+ position: relative;
+ color: #6c757d;
+}
+
+.feature-card li::before {
+ content: 'βΆ';
+ position: absolute;
+ left: 0;
+ color: #007bff;
+ font-size: 0.8rem;
+}
+
+/* Quick Start Kubernetes Section */
+.quick-start-k8s {
+ background: linear-gradient(135deg, #28a745, #20c997);
+ border-radius: 15px;
+ padding: 2rem;
+ color: white;
+ margin: 2rem 0;
+}
+
+.quick-start-k8s h3 {
+ color: white;
+ margin-bottom: 1.5rem;
+}
+
+.quick-start-k8s .alert-info {
+ background: rgba(255, 255, 255, 0.15);
+ border: 1px solid rgba(255, 255, 255, 0.3);
+ color: white;
+}
+
+.quick-start-k8s .code-block {
+ background: rgba(0, 0, 0, 0.3);
+ border-radius: 10px;
+ padding: 1.5rem;
+ margin-top: 1rem;
+}
+
+.quick-start-k8s .code-block code {
+ color: #fff;
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
+ line-height: 1.8;
+}
+
+/* Enhanced Pattern Cards for Circuit Breakers and Saga */
+.pattern-card .implementation-details {
+ margin-top: 1.5rem;
+ padding-top: 1rem;
+ border-top: 1px solid #dee2e6;
+}
+
+.pattern-card .implementation-details h6 {
+ color: #495057;
+ margin-bottom: 0.75rem;
+ font-weight: 600;
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.pattern-card .implementation-details h6::before {
+ content: 'βοΈ';
+ font-size: 1rem;
+}
+
+.pattern-card .implementation-details ul {
+ list-style: none;
+ padding: 0;
+}
+
+.pattern-card .implementation-details li {
+ padding: 0.25rem 0;
+ padding-left: 1.5rem;
+ position: relative;
+ color: #6c757d;
+ font-size: 0.9rem;
+}
+
+.pattern-card .implementation-details li::before {
+ content: 'π§';
+ position: absolute;
+ left: 0;
+ font-size: 0.8rem;
+}
+
+.pattern-card .implementation-details ol {
+ padding-left: 1rem;
+}
+
+.pattern-card .implementation-details ol li {
+ padding-left: 0.5rem;
+ list-style: decimal;
+}
+
+.pattern-card .implementation-details ol li::before {
+ content: '';
+}
+
+/* Circuit Breaker Specific Styling */
+.pattern-card:has(.fa-plug-circle-xmark) {
+ border-left: 4px solid #dc3545;
+}
+
+.pattern-card:has(.fa-plug-circle-xmark) .pattern-icon {
+ background: linear-gradient(135deg, #dc3545, #c82333);
+}
+
+/* Saga Pattern Specific Styling */
+.pattern-card:has(.fa-project-diagram) {
+ border-left: 4px solid #6f42c1;
+}
+
+.pattern-card:has(.fa-project-diagram) .pattern-icon {
+ background: linear-gradient(135deg, #6f42c1, #5a32a3);
+}
+
+/* Responsive Design for Deployment Section */
+@media (max-width: 768px) {
+ .deployment-flow {
+ grid-template-columns: 1fr;
+ }
+
+ .hero-stats {
+ grid-template-columns: repeat(2, 1fr);
+ gap: 1rem;
+ }
+
+ .hero-stats .stat {
+ margin-bottom: 1rem;
+ }
+
+ .feature-card {
+ margin-bottom: 1rem;
+ }
+}
+
+/* Animation for Circuit Breaker Icons */
+.pattern-card .fa-plug-circle-xmark {
+ animation: pulse 2s infinite;
+}
+
+@keyframes pulse {
+ 0% { transform: scale(1); }
+ 50% { transform: scale(1.1); }
+ 100% { transform: scale(1); }
+}
+
+/* Animation for Saga Flow Icons */
+.pattern-card .fa-project-diagram {
+ animation: rotate 3s linear infinite;
+}
+
+@keyframes rotate {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+}
+
+/* Enhanced Code Blocks */
+.code-example {
+ background: #f8f9fa;
+ border-radius: 10px;
+ padding: 1.5rem;
+ border-left: 4px solid #007bff;
+}
+
+.code-example h6 {
+ color: #495057;
+ margin-bottom: 1rem;
+ font-weight: 600;
+}
+
+.code-block {
+ background: #2d3748;
+ border-radius: 8px;
+ padding: 1.5rem;
+ margin: 1rem 0;
+}
+
+.code-block code {
+ color: #e2e8f0;
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
+ line-height: 1.8;
+ font-size: 0.9rem;
+}
+
+/* Animations */
+@keyframes fadeInUp {
+ from {
+ opacity: 0;
+ transform: translateY(30px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+.service-box, .pattern-card, .step, .dashboard-card {
+ animation: fadeInUp 0.6s ease forwards;
+}
+
+/* Scrollbar Styling */
+::-webkit-scrollbar {
+ width: 8px;
+}
+
+::-webkit-scrollbar-track {
+ background: #f1f1f1;
+}
+
+::-webkit-scrollbar-thumb {
+ background: #667eea;
+ border-radius: 4px;
+}
+
+::-webkit-scrollbar-thumb:hover {
+ background: #5a67d8;
+}
+
+/* Loading Animation */
+.loading {
+ display: inline-block;
+ width: 20px;
+ height: 20px;
+ border: 3px solid #f3f3f3;
+ border-top: 3px solid #667eea;
+ border-radius: 50%;
+ animation: spin 1s linear infinite;
+}
+
+@keyframes spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+}
+
+/* GitHub Repository Section */
+.bg-primary {
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
+}
+
+.github-card {
+ background: rgba(255, 255, 255, 0.1);
+ backdrop-filter: blur(10px);
+ border-radius: 20px;
+ padding: 2rem;
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ transition: transform 0.3s ease;
+}
+
+.github-card:hover {
+ transform: translateY(-5px);
+}
+
+.github-card-header {
+ text-align: center;
+ margin-bottom: 1.5rem;
+}
+
+.github-icon {
+ font-size: 4rem;
+ margin-bottom: 1rem;
+ color: #ffd700;
+}
+
+.github-card-header h4 {
+ color: white;
+ margin: 0;
+}
+
+.github-card-body {
+ text-align: center;
+ margin-bottom: 1.5rem;
+}
+
+.github-card-body h5 {
+ color: white;
+ font-weight: 600;
+ margin-bottom: 0.5rem;
+}
+
+.github-card-body p {
+ color: rgba(255, 255, 255, 0.8);
+ margin-bottom: 1rem;
+}
+
+.github-stats {
+ display: flex;
+ justify-content: center;
+ flex-wrap: wrap;
+ gap: 0.5rem;
+}
+
+.github-card-footer .btn-light {
+ background: rgba(255, 255, 255, 0.9);
+ border: none;
+ font-weight: 600;
+ transition: all 0.3s ease;
+}
+
+.github-card-footer .btn-light:hover {
+ background: white;
+ transform: translateY(-2px);
+ box-shadow: 0 5px 15px rgba(0,0,0,0.2);
+}
+
+.repo-features {
+ background: rgba(255, 255, 255, 0.1);
+ border-radius: 15px;
+ padding: 2rem;
+ margin: 2rem 0;
+}
+
+.repo-features ul li {
+ padding: 0.5rem 0;
+ font-size: 1rem;
+}
+
+.quick-actions {
+ text-align: center;
+ background: rgba(255, 255, 255, 0.1);
+ border-radius: 15px;
+ padding: 2rem;
+}
+
+.action-buttons {
+ display: flex;
+ justify-content: center;
+ flex-wrap: wrap;
+ gap: 1rem;
+}
+
+.action-buttons .btn {
+ padding: 0.75rem 1.5rem;
+ font-weight: 600;
+ border-radius: 25px;
+ transition: all 0.3s ease;
+}
+
+.action-buttons .btn:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 5px 15px rgba(0,0,0,0.2);
+}
+
+.action-buttons .btn-warning {
+ background: #ffd700;
+ border-color: #ffd700;
+ color: #333;
+}
+
+.action-buttons .btn-warning:hover {
+ background: #ffed4e;
+ border-color: #ffed4e;
+}
diff --git a/k8s/README.md b/k8s/README.md
new file mode 100644
index 0000000..e579575
--- /dev/null
+++ b/k8s/README.md
@@ -0,0 +1,513 @@
+# Kubernetes Deployment Guide for E-commerce Microservices
+
+## Overview
+
+This guide provides comprehensive instructions for deploying the e-commerce microservices platform on Kubernetes using Helm charts with advanced patterns including:
+
+- **Circuit Breaker Pattern** with Resilience4j
+- **Saga Pattern** for distributed transactions
+- **Blue-Green Deployment** for zero-downtime deployments
+- **Auto-scaling** and **Health Monitoring**
+- **Security** with Network Policies
+
+## Architecture
+
+### Microservices Components
+
+- **Discovery Service** (Eureka) - Service registration and discovery
+- **Config Server** - Centralized configuration management
+- **API Gateway** - Single entry point with routing and load balancing
+- **Customer Service** - Customer management with circuit breakers
+- **Product Service** - Product catalog with inventory management
+- **Order Service** - Order processing with Saga orchestration
+- **Payment Service** - Payment processing with circuit breakers
+- **Notification Service** - Email and messaging notifications
+
+### Infrastructure Components
+
+- **MongoDB** - Document database for orders and saga state
+- **PostgreSQL** - Relational database for customers and products
+- **Apache Kafka** - Event streaming for saga pattern
+- **Prometheus** - Metrics collection and monitoring
+- **Grafana** - Metrics visualization
+
+## Prerequisites
+
+### Required Tools
+
+```bash
+# Install kubectl
+curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
+chmod +x kubectl
+sudo mv kubectl /usr/local/bin/
+
+# Install Helm
+brew install helm
+
+# Install jq for JSON parsing
+brew install jq
+```
+
+### Kubernetes Cluster
+
+You need a Kubernetes cluster with:
+- **Minimum 4 CPU cores and 8GB RAM**
+- **LoadBalancer support** (for cloud providers)
+- **Storage Class** for persistent volumes
+- **Ingress Controller** (nginx recommended)
+
+#### Local Development with Kind
+
+```bash
+# Install Kind
+brew install kind
+
+# Create cluster with ingress support
+cat <10%)
+3. **ServiceDown** - Service unavailability
+4. **HighMemoryUsage** - Memory usage >85%
+5. **HighCPUUsage** - CPU usage >80%
+
+## Testing the Deployment
+
+### Health Checks
+
+```bash
+# Check all services health
+kubectl get pods -n ecommerce
+
+# Check specific service
+kubectl describe pod -l app.kubernetes.io/component=order-service -n ecommerce
+
+# Check service logs
+kubectl logs -f deployment/order-service-blue -n ecommerce
+```
+
+### API Testing
+
+```bash
+# Get external IP
+export GATEWAY_IP=$(kubectl get service api-gateway-blue -n ecommerce -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
+
+# Test API endpoints
+curl -X GET "http://$GATEWAY_IP:8080/api/v1/customers"
+curl -X GET "http://$GATEWAY_IP:8080/api/v1/products"
+
+# Test order creation (Saga Pattern)
+curl -X POST "http://$GATEWAY_IP:8080/api/v1/orders" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "customerId": "1",
+ "products": [
+ {"productId": 1, "quantity": 2}
+ ],
+ "paymentMethod": "CREDIT_CARD"
+ }'
+```
+
+### Circuit Breaker Testing
+
+```bash
+# Generate load to trigger circuit breaker
+for i in {1..100}; do
+ curl -X GET "http://$GATEWAY_IP:8080/api/v1/customers/999" &
+done
+
+# Check circuit breaker metrics
+curl -s "http://$GATEWAY_IP:8080/actuator/prometheus" | grep circuit
+```
+
+## Troubleshooting
+
+### Common Issues
+
+#### 1. Services Not Starting
+```bash
+# Check pod events
+kubectl describe pod -n ecommerce
+
+# Check service logs
+kubectl logs -n ecommerce --previous
+
+# Common causes:
+# - Database connection issues
+# - Configuration server unavailable
+# - Resource constraints
+```
+
+#### 2. Circuit Breaker Not Working
+```bash
+# Verify circuit breaker configuration
+kubectl get configmap order-service-config -n ecommerce -o yaml
+
+# Check metrics endpoint
+curl "http://:8070/actuator/prometheus" | grep resilience4j
+```
+
+#### 3. Saga Pattern Issues
+```bash
+# Check Kafka connectivity
+kubectl exec -it -n ecommerce -- kafka-topics.sh --list --bootstrap-server localhost:9092
+
+# Check saga state in MongoDB
+kubectl exec -it -n ecommerce -- mongo --eval "db.order_saga.find().pretty()"
+
+# Check order service logs for saga execution
+kubectl logs -f deployment/order-service-blue -n ecommerce | grep -i saga
+```
+
+#### 4. Blue-Green Deployment Issues
+```bash
+# Check deployment status
+./blue-green-deploy.sh status
+
+# Rollback if needed
+./blue-green-deploy.sh rollback
+
+# Check ingress configuration
+kubectl get ingress -n ecommerce -o yaml
+```
+
+### Performance Tuning
+
+#### 1. Resource Optimization
+```yaml
+# Adjust resource requests/limits in values.yaml
+order:
+ resources:
+ requests:
+ cpu: 500m
+ memory: 512Mi
+ limits:
+ cpu: 1000m
+ memory: 1Gi
+```
+
+#### 2. JVM Tuning
+```yaml
+# Add JVM options as environment variables
+order:
+ env:
+ - name: JAVA_OPTS
+ value: "-Xmx768m -XX:+UseG1GC -XX:G1HeapRegionSize=16m"
+```
+
+#### 3. Database Connection Pooling
+```yaml
+# Configure database connection pools
+order:
+ env:
+ - name: SPRING_DATASOURCE_HIKARI_MAXIMUM_POOL_SIZE
+ value: "20"
+ - name: SPRING_DATASOURCE_HIKARI_MINIMUM_IDLE
+ value: "5"
+```
+
+## Security Best Practices
+
+### 1. Network Policies
+Network policies are enabled by default and restrict inter-service communication.
+
+### 2. Secrets Management
+All sensitive data is stored in Kubernetes secrets:
+```bash
+# View secrets (base64 encoded)
+kubectl get secret ecommerce-microservices-secrets -n ecommerce -o yaml
+```
+
+### 3. RBAC Configuration
+```yaml
+# Create service account with minimal permissions
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ecommerce-service-account
+ namespace: ecommerce
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
+metadata:
+ namespace: ecommerce
+ name: ecommerce-role
+rules:
+- apiGroups: [""]
+ resources: ["configmaps", "secrets"]
+ verbs: ["get", "list"]
+```
+
+## Backup and Disaster Recovery
+
+### Database Backups
+```bash
+# MongoDB backup
+kubectl exec -n ecommerce -- mongodump --out /tmp/backup
+kubectl cp ecommerce/:/tmp/backup ./mongodb-backup
+
+# PostgreSQL backup
+kubectl exec -n ecommerce -- pg_dump -U ecommerce ecommerce > postgresql-backup.sql
+```
+
+### Configuration Backups
+```bash
+# Backup Helm values
+helm get values ecommerce-microservices -n ecommerce > values-backup.yaml
+
+# Backup all Kubernetes resources
+kubectl get all -n ecommerce -o yaml > kubernetes-backup.yaml
+```
+
+## Upgrading
+
+### Application Updates
+```bash
+# Update application version
+helm upgrade ecommerce-microservices ./helm-charts \
+ --namespace ecommerce \
+ --set order.image.tag=v1.1.0 \
+ --reuse-values
+
+# Blue-green upgrade
+./blue-green-deploy.sh full-deploy
+```
+
+### Infrastructure Updates
+```bash
+# Update Helm dependencies
+helm dependency update ./helm-charts
+
+# Upgrade with new dependencies
+helm upgrade ecommerce-microservices ./helm-charts \
+ --namespace ecommerce \
+ --reuse-values
+```
+
+## Production Checklist
+
+- [ ] Resource limits configured appropriately
+- [ ] Health checks configured and working
+- [ ] Monitoring and alerting setup
+- [ ] Network policies enabled
+- [ ] Secrets properly managed
+- [ ] Backup strategy implemented
+- [ ] Disaster recovery plan documented
+- [ ] Load testing completed
+- [ ] Security scanning performed
+- [ ] Documentation updated
+
+## Support and Troubleshooting
+
+For issues and support:
+1. Check the troubleshooting section above
+2. Review application logs: `kubectl logs -f deployment/ -n ecommerce`
+3. Check cluster events: `kubectl get events -n ecommerce --sort-by='.lastTimestamp'`
+4. Contact: **Pramitha Jayasooriya** - pramithajayasooriya@example.com
+
+---
+
+**Author**: Pramitha Jayasooriya
+**Version**: 1.0.0
+**Last Updated**: August 2025
diff --git a/k8s/blue-green-deploy.sh b/k8s/blue-green-deploy.sh
new file mode 100755
index 0000000..bbed38f
--- /dev/null
+++ b/k8s/blue-green-deploy.sh
@@ -0,0 +1,324 @@
+#!/bin/bash
+
+# Blue-Green Deployment Manager for E-commerce Microservices
+# Author: Pramitha Jayasooriya
+# Version: 1.0.0
+
+set -e
+
+# Configuration
+NAMESPACE=${NAMESPACE:-"ecommerce"}
+RELEASE_NAME=${RELEASE_NAME:-"ecommerce-microservices"}
+CHART_PATH=${CHART_PATH:-"./k8s/helm-charts"}
+TIMEOUT=${TIMEOUT:-"600s"}
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+BLUE='\033[0;34m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+# Logging functions
+log_info() {
+ echo -e "${BLUE}[INFO]${NC} $1"
+}
+
+log_success() {
+ echo -e "${GREEN}[SUCCESS]${NC} $1"
+}
+
+log_warning() {
+ echo -e "${YELLOW}[WARNING]${NC} $1"
+}
+
+log_error() {
+ echo -e "${RED}[ERROR]${NC} $1"
+}
+
+# Function to get current active slot
+get_active_slot() {
+ helm get values $RELEASE_NAME -n $NAMESPACE -o json | jq -r '.bluegreen.activeSlot // "blue"'
+}
+
+# Function to get inactive slot
+get_inactive_slot() {
+ local active_slot=$(get_active_slot)
+ if [ "$active_slot" = "blue" ]; then
+ echo "green"
+ else
+ echo "blue"
+ fi
+}
+
+# Function to check if deployment is healthy
+check_deployment_health() {
+ local slot=$1
+ local services=("discovery-service" "config-server" "api-gateway" "customer-service" "product-service" "order-service" "payment-service" "notification-service")
+
+ log_info "Checking health of $slot deployment..."
+
+ for service in "${services[@]}"; do
+ local deployment_name="${service}-${slot}"
+
+ # Check if deployment exists
+ if ! kubectl get deployment $deployment_name -n $NAMESPACE > /dev/null 2>&1; then
+ log_warning "Deployment $deployment_name not found, skipping health check"
+ continue
+ fi
+
+ # Check deployment status
+ local ready_replicas=$(kubectl get deployment $deployment_name -n $NAMESPACE -o jsonpath='{.status.readyReplicas}' 2>/dev/null || echo "0")
+ local desired_replicas=$(kubectl get deployment $deployment_name -n $NAMESPACE -o jsonpath='{.spec.replicas}')
+
+ if [ "$ready_replicas" != "$desired_replicas" ]; then
+ log_error "Deployment $deployment_name is not ready ($ready_replicas/$desired_replicas)"
+ return 1
+ fi
+
+ log_info "β $deployment_name is healthy ($ready_replicas/$desired_replicas)"
+ done
+
+ log_success "$slot deployment is healthy"
+ return 0
+}
+
+# Function to run health checks
+run_health_checks() {
+ local slot=$1
+ local gateway_service="api-gateway-${slot}"
+
+ log_info "Running health checks for $slot deployment..."
+
+ # Wait for gateway to be ready
+ kubectl wait --for=condition=available --timeout=$TIMEOUT deployment/api-gateway-$slot -n $NAMESPACE
+
+ # Get gateway service endpoint
+ local gateway_url=$(kubectl get service $gateway_service -n $NAMESPACE -o jsonpath='{.status.loadBalancer.ingress[0].ip}' 2>/dev/null || echo "")
+
+ if [ -z "$gateway_url" ]; then
+ gateway_url=$(kubectl get service $gateway_service -n $NAMESPACE -o jsonpath='{.spec.clusterIP}')
+ log_warning "Using ClusterIP for health checks: $gateway_url"
+ fi
+
+ # Health check endpoints
+ local health_endpoints=(
+ "/actuator/health"
+ "/api/v1/customers/health"
+ "/api/v1/products/health"
+ "/api/v1/orders/health"
+ "/api/v1/payments/health"
+ )
+
+ for endpoint in "${health_endpoints[@]}"; do
+ log_info "Checking endpoint: http://$gateway_url:8080$endpoint"
+
+ # Use kubectl port-forward for local testing if needed
+ if ! curl -f -s "http://$gateway_url:8080$endpoint" > /dev/null; then
+ log_warning "Health check failed for $endpoint, but continuing..."
+ else
+ log_info "β Health check passed for $endpoint"
+ fi
+ done
+
+ log_success "Health checks completed for $slot deployment"
+}
+
+# Function to deploy to inactive slot
+deploy_to_inactive_slot() {
+ local inactive_slot=$(get_inactive_slot)
+
+ log_info "Deploying to inactive slot: $inactive_slot"
+
+ # Update values file to deploy to inactive slot
+ helm upgrade $RELEASE_NAME $CHART_PATH \
+ --namespace $NAMESPACE \
+ --create-namespace \
+ --set bluegreen.enabled=true \
+ --set bluegreen.activeSlot=$inactive_slot \
+ --timeout $TIMEOUT \
+ --wait
+
+ log_success "Deployed to $inactive_slot slot"
+
+ # Wait for deployments to be ready
+ sleep 30
+
+ # Check health of new deployment
+ if ! check_deployment_health $inactive_slot; then
+ log_error "Health check failed for $inactive_slot deployment"
+ return 1
+ fi
+
+ # Run additional health checks
+ run_health_checks $inactive_slot
+
+ log_success "Deployment to $inactive_slot slot completed successfully"
+}
+
+# Function to switch traffic to new deployment
+switch_traffic() {
+ local new_active_slot=$(get_inactive_slot)
+ local old_active_slot=$(get_active_slot)
+
+ log_info "Switching traffic from $old_active_slot to $new_active_slot"
+
+ # Update ingress to point to new deployment
+ helm upgrade $RELEASE_NAME $CHART_PATH \
+ --namespace $NAMESPACE \
+ --reuse-values \
+ --set bluegreen.activeSlot=$new_active_slot \
+ --timeout $TIMEOUT
+
+ log_success "Traffic switched to $new_active_slot"
+
+ # Wait a bit for traffic to stabilize
+ sleep 10
+
+ # Verify the switch worked
+ log_info "Verifying traffic switch..."
+ run_health_checks $new_active_slot
+
+ log_success "Traffic successfully switched to $new_active_slot"
+}
+
+# Function to rollback to previous deployment
+rollback() {
+ local current_active=$(get_active_slot)
+ local rollback_to=$(get_inactive_slot)
+
+ log_warning "Rolling back from $current_active to $rollback_to"
+
+ # Switch traffic back
+ helm upgrade $RELEASE_NAME $CHART_PATH \
+ --namespace $NAMESPACE \
+ --reuse-values \
+ --set bluegreen.activeSlot=$rollback_to \
+ --timeout $TIMEOUT
+
+ log_success "Rollback completed. Traffic switched to $rollback_to"
+}
+
+# Function to cleanup old deployment
+cleanup_old_deployment() {
+ local old_slot=$(get_inactive_slot)
+
+ log_info "Cleaning up old deployment in $old_slot slot"
+
+ # Scale down old deployments
+ local services=("discovery-service" "config-server" "api-gateway" "customer-service" "product-service" "order-service" "payment-service" "notification-service")
+
+ for service in "${services[@]}"; do
+ local deployment_name="${service}-${old_slot}"
+
+ if kubectl get deployment $deployment_name -n $NAMESPACE > /dev/null 2>&1; then
+ kubectl scale deployment $deployment_name --replicas=0 -n $NAMESPACE
+ log_info "Scaled down $deployment_name"
+ fi
+ done
+
+ log_success "Old deployment cleanup completed"
+}
+
+# Function to perform canary deployment
+canary_deploy() {
+ local weight=${1:-10}
+ local inactive_slot=$(get_inactive_slot)
+
+ log_info "Starting canary deployment to $inactive_slot slot with $weight% traffic"
+
+ # Deploy to inactive slot first
+ deploy_to_inactive_slot
+
+ # Update ingress canary weight
+ kubectl patch ingress ${RELEASE_NAME}-canary -n $NAMESPACE -p "{\"metadata\":{\"annotations\":{\"nginx.ingress.kubernetes.io/canary-weight\":\"$weight\"}}}"
+
+ log_success "Canary deployment started with $weight% traffic to $inactive_slot"
+ log_info "Monitor metrics and run 'promote_canary' when ready"
+}
+
+# Function to promote canary to full deployment
+promote_canary() {
+ log_info "Promoting canary to full deployment"
+
+ # Set canary weight to 100%
+ kubectl patch ingress ${RELEASE_NAME}-canary -n $NAMESPACE -p '{"metadata":{"annotations":{"nginx.ingress.kubernetes.io/canary-weight":"100"}}}'
+
+ sleep 10
+
+ # Switch main traffic
+ switch_traffic
+
+ # Disable canary
+ kubectl patch ingress ${RELEASE_NAME}-canary -n $NAMESPACE -p '{"metadata":{"annotations":{"nginx.ingress.kubernetes.io/canary-weight":"0"}}}'
+
+ log_success "Canary promoted to full deployment"
+}
+
+# Function to show deployment status
+status() {
+ local active_slot=$(get_active_slot)
+ local inactive_slot=$(get_inactive_slot)
+
+ echo "=== Blue-Green Deployment Status ==="
+ echo "Namespace: $NAMESPACE"
+ echo "Release: $RELEASE_NAME"
+ echo "Active Slot: $active_slot"
+ echo "Inactive Slot: $inactive_slot"
+ echo ""
+
+ echo "=== Active Deployments ==="
+ kubectl get deployments -n $NAMESPACE -l deployment.kubernetes.io/slot=$active_slot
+ echo ""
+
+ echo "=== Services ==="
+ kubectl get services -n $NAMESPACE
+ echo ""
+
+ echo "=== Ingress ==="
+ kubectl get ingress -n $NAMESPACE
+}
+
+# Main command dispatcher
+case "${1:-}" in
+ "deploy")
+ deploy_to_inactive_slot
+ ;;
+ "switch")
+ switch_traffic
+ ;;
+ "rollback")
+ rollback
+ ;;
+ "cleanup")
+ cleanup_old_deployment
+ ;;
+ "full-deploy")
+ deploy_to_inactive_slot
+ switch_traffic
+ cleanup_old_deployment
+ ;;
+ "canary")
+ canary_deploy ${2:-10}
+ ;;
+ "promote")
+ promote_canary
+ ;;
+ "status")
+ status
+ ;;
+ *)
+ echo "Usage: $0 {deploy|switch|rollback|cleanup|full-deploy|canary [weight]|promote|status}"
+ echo ""
+ echo "Commands:"
+ echo " deploy - Deploy to inactive slot"
+ echo " switch - Switch traffic to inactive slot"
+ echo " rollback - Rollback to previous deployment"
+ echo " cleanup - Cleanup old deployment"
+ echo " full-deploy - Complete blue-green deployment (deploy + switch + cleanup)"
+ echo " canary - Start canary deployment with specified weight (default: 10%)"
+ echo " promote - Promote canary to full deployment"
+ echo " status - Show deployment status"
+ exit 1
+ ;;
+esac
diff --git a/k8s/build-images.sh b/k8s/build-images.sh
new file mode 100755
index 0000000..0dcc48b
--- /dev/null
+++ b/k8s/build-images.sh
@@ -0,0 +1,325 @@
+#!/bin/bash
+
+# Docker Image Build Script for E-commerce Microservices
+# Author: Pramitha Jayasooriya
+# Version: 1.0.0
+
+set -e
+
+# Configuration
+DOCKER_REGISTRY=${DOCKER_REGISTRY:-""}
+IMAGE_TAG=${IMAGE_TAG:-"latest"}
+SERVICES_DIR="../services"
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+BLUE='\033[0;34m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+# Logging functions
+log_info() {
+ echo -e "${BLUE}[INFO]${NC} $1"
+}
+
+log_success() {
+ echo -e "${GREEN}[SUCCESS]${NC} $1"
+}
+
+log_warning() {
+ echo -e "${YELLOW}[WARNING]${NC} $1"
+}
+
+log_error() {
+ echo -e "${RED}[ERROR]${NC} $1"
+}
+
+# Function to build Docker image
+build_image() {
+ local service_name=$1
+ local service_dir=$2
+ local image_name="ecommerce/${service_name}"
+
+ if [ ! -z "$DOCKER_REGISTRY" ]; then
+ image_name="${DOCKER_REGISTRY}/${image_name}"
+ fi
+
+ log_info "Building image for ${service_name}..."
+
+ # Check if Dockerfile exists
+ if [ ! -f "${service_dir}/Dockerfile" ]; then
+ log_warning "Dockerfile not found for ${service_name}, creating one..."
+ create_dockerfile "$service_dir" "$service_name"
+ fi
+
+ # Build the Docker image
+ docker build -t "${image_name}:${IMAGE_TAG}" "$service_dir"
+
+ if [ $? -eq 0 ]; then
+ log_success "Successfully built ${image_name}:${IMAGE_TAG}"
+
+ # Tag as latest
+ docker tag "${image_name}:${IMAGE_TAG}" "${image_name}:latest"
+
+ return 0
+ else
+ log_error "Failed to build ${image_name}:${IMAGE_TAG}"
+ return 1
+ fi
+}
+
+# Function to create Dockerfile if not exists
+create_dockerfile() {
+ local service_dir=$1
+ local service_name=$2
+
+ cat > "${service_dir}/Dockerfile" << EOF
+FROM openjdk:17-jre-slim
+
+# Install curl for health checks
+RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
+
+# Create app directory
+WORKDIR /app
+
+# Copy the application jar
+COPY target/*.jar app.jar
+
+# Expose port
+EXPOSE 8080
+
+# Health check
+HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \\
+ CMD curl -f http://localhost:8080/actuator/health || exit 1
+
+# Run the application
+ENTRYPOINT ["java", "-jar", "/app/app.jar"]
+EOF
+
+ log_info "Created Dockerfile for ${service_name}"
+}
+
+# Function to push image to registry
+push_image() {
+ local service_name=$1
+ local image_name="ecommerce/${service_name}"
+
+ if [ ! -z "$DOCKER_REGISTRY" ]; then
+ image_name="${DOCKER_REGISTRY}/${image_name}"
+
+ log_info "Pushing ${image_name}:${IMAGE_TAG} to registry..."
+ docker push "${image_name}:${IMAGE_TAG}"
+ docker push "${image_name}:latest"
+
+ if [ $? -eq 0 ]; then
+ log_success "Successfully pushed ${image_name}"
+ else
+ log_error "Failed to push ${image_name}"
+ return 1
+ fi
+ else
+ log_warning "No registry specified, skipping push for ${service_name}"
+ fi
+}
+
+# Function to build all services
+build_all_services() {
+ local services=(
+ "discovery-service:discovery"
+ "config-server:config-server"
+ "api-gateway:gateway"
+ "customer-service:customer"
+ "product-service:product"
+ "order-service:order"
+ "payment-service:payment"
+ "notification-service:notification"
+ )
+
+ local failed_builds=()
+
+ log_info "Building all microservices Docker images..."
+ log_info "Registry: ${DOCKER_REGISTRY:-'local'}"
+ log_info "Tag: ${IMAGE_TAG}"
+
+ for service_info in "${services[@]}"; do
+ IFS=':' read -r service_name service_dir <<< "$service_info"
+ local full_service_dir="${SERVICES_DIR}/${service_dir}"
+
+ if [ -d "$full_service_dir" ]; then
+ # Build Maven project first
+ log_info "Building Maven project for ${service_name}..."
+ (cd "$full_service_dir" && ./mvnw clean package -DskipTests)
+
+ if [ $? -eq 0 ]; then
+ # Build Docker image
+ if build_image "$service_name" "$full_service_dir"; then
+ # Push to registry if specified
+ push_image "$service_name"
+ else
+ failed_builds+=("$service_name")
+ fi
+ else
+ log_error "Maven build failed for ${service_name}"
+ failed_builds+=("$service_name")
+ fi
+ else
+ log_error "Service directory not found: ${full_service_dir}"
+ failed_builds+=("$service_name")
+ fi
+ done
+
+ # Summary
+ echo ""
+ echo "=== Build Summary ==="
+ if [ ${#failed_builds[@]} -eq 0 ]; then
+ log_success "All services built successfully!"
+ else
+ log_error "Failed to build the following services:"
+ for failed_service in "${failed_builds[@]}"; do
+ echo " - $failed_service"
+ done
+ return 1
+ fi
+}
+
+# Function to build single service
+build_single_service() {
+ local service_name=$1
+
+ case $service_name in
+ "discovery-service"|"discovery")
+ build_service_by_name "discovery-service" "discovery"
+ ;;
+ "config-server"|"config")
+ build_service_by_name "config-server" "config-server"
+ ;;
+ "api-gateway"|"gateway")
+ build_service_by_name "api-gateway" "gateway"
+ ;;
+ "customer-service"|"customer")
+ build_service_by_name "customer-service" "customer"
+ ;;
+ "product-service"|"product")
+ build_service_by_name "product-service" "product"
+ ;;
+ "order-service"|"order")
+ build_service_by_name "order-service" "order"
+ ;;
+ "payment-service"|"payment")
+ build_service_by_name "payment-service" "payment"
+ ;;
+ "notification-service"|"notification")
+ build_service_by_name "notification-service" "notification"
+ ;;
+ *)
+ log_error "Unknown service: $service_name"
+ echo "Available services: discovery, config, gateway, customer, product, order, payment, notification"
+ return 1
+ ;;
+ esac
+}
+
+# Helper function to build service by name
+build_service_by_name() {
+ local service_name=$1
+ local service_dir=$2
+ local full_service_dir="${SERVICES_DIR}/${service_dir}"
+
+ if [ -d "$full_service_dir" ]; then
+ log_info "Building Maven project for ${service_name}..."
+ (cd "$full_service_dir" && ./mvnw clean package -DskipTests)
+
+ if [ $? -eq 0 ]; then
+ if build_image "$service_name" "$full_service_dir"; then
+ push_image "$service_name"
+ fi
+ else
+ log_error "Maven build failed for ${service_name}"
+ return 1
+ fi
+ else
+ log_error "Service directory not found: ${full_service_dir}"
+ return 1
+ fi
+}
+
+# Function to show usage
+show_usage() {
+ echo "Usage: $0 [OPTIONS] [SERVICE]"
+ echo ""
+ echo "Build Docker images for E-commerce microservices"
+ echo ""
+ echo "Options:"
+ echo " -r, --registry REGISTRY Docker registry to push images to"
+ echo " -t, --tag TAG Image tag (default: latest)"
+ echo " -h, --help Show this help message"
+ echo ""
+ echo "Services:"
+ echo " all Build all services (default)"
+ echo " discovery Discovery Service (Eureka)"
+ echo " config Config Server"
+ echo " gateway API Gateway"
+ echo " customer Customer Service"
+ echo " product Product Service"
+ echo " order Order Service"
+ echo " payment Payment Service"
+ echo " notification Notification Service"
+ echo ""
+ echo "Examples:"
+ echo " $0 Build all services with default settings"
+ echo " $0 order Build only Order Service"
+ echo " $0 -r docker.io/myuser -t v1.0.0 all"
+ echo " $0 --registry=harbor.company.com --tag=prod customer"
+}
+
+# Parse command line arguments
+while [[ $# -gt 0 ]]; do
+ case $1 in
+ -r|--registry)
+ DOCKER_REGISTRY="$2"
+ shift 2
+ ;;
+ -t|--tag)
+ IMAGE_TAG="$2"
+ shift 2
+ ;;
+ -h|--help)
+ show_usage
+ exit 0
+ ;;
+ -*)
+ log_error "Unknown option: $1"
+ show_usage
+ exit 1
+ ;;
+ *)
+ SERVICE_NAME="$1"
+ shift
+ ;;
+ esac
+done
+
+# Main execution
+log_info "E-commerce Microservices Docker Build Script"
+log_info "============================================"
+
+# Check if Docker is running
+if ! docker info > /dev/null 2>&1; then
+ log_error "Docker is not running. Please start Docker and try again."
+ exit 1
+fi
+
+# Build services
+if [ -z "${SERVICE_NAME:-}" ] || [ "${SERVICE_NAME}" = "all" ]; then
+ build_all_services
+else
+ build_single_service "$SERVICE_NAME"
+fi
+
+log_success "Build process completed!"
+
+# Show built images
+echo ""
+echo "=== Built Images ==="
+docker images | grep "ecommerce/"
diff --git a/k8s/helm-charts/Chart.yaml b/k8s/helm-charts/Chart.yaml
new file mode 100644
index 0000000..63efa05
--- /dev/null
+++ b/k8s/helm-charts/Chart.yaml
@@ -0,0 +1,24 @@
+apiVersion: v2
+name: ecommerce-microservices
+description: A Helm chart for E-commerce Microservices with Blue-Green Deployment
+type: application
+version: 1.0.0
+appVersion: "1.0.0"
+
+maintainers:
+- name: Pramitha Jayasooriya
+ email: pramithajayasooriya@example.com
+
+dependencies:
+ - name: kafka
+ version: 23.0.7
+ repository: https://charts.bitnami.com/bitnami
+ condition: kafka.enabled
+ - name: mongodb
+ version: 13.15.1
+ repository: https://charts.bitnami.com/bitnami
+ condition: mongodb.enabled
+ - name: postgresql
+ version: 12.6.6
+ repository: https://charts.bitnami.com/bitnami
+ condition: postgresql.enabled
diff --git a/k8s/helm-charts/templates/_helpers.tpl b/k8s/helm-charts/templates/_helpers.tpl
new file mode 100644
index 0000000..f15199e
--- /dev/null
+++ b/k8s/helm-charts/templates/_helpers.tpl
@@ -0,0 +1,100 @@
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "ecommerce.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Create a default fully qualified app name.
+*/}}
+{{- define "ecommerce.fullname" -}}
+{{- if .Values.fullnameOverride }}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- $name := default .Chart.Name .Values.nameOverride }}
+{{- if contains $name .Release.Name }}
+{{- .Release.Name | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "ecommerce.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Common labels
+*/}}
+{{- define "ecommerce.labels" -}}
+helm.sh/chart: {{ include "ecommerce.chart" . }}
+{{ include "ecommerce.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end }}
+
+{{/*
+Selector labels
+*/}}
+{{- define "ecommerce.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "ecommerce.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end }}
+
+{{/*
+Blue-Green deployment slot
+*/}}
+{{- define "ecommerce.slot" -}}
+{{- if .Values.bluegreen.enabled }}
+{{- .Values.bluegreen.activeSlot }}
+{{- else }}
+{{- "active" }}
+{{- end }}
+{{- end }}
+
+{{/*
+Create service name with slot suffix
+*/}}
+{{- define "ecommerce.serviceName" -}}
+{{- $serviceName := .serviceName -}}
+{{- if .Values.bluegreen.enabled }}
+{{- printf "%s-%s" $serviceName (include "ecommerce.slot" .) }}
+{{- else }}
+{{- $serviceName }}
+{{- end }}
+{{- end }}
+
+{{/*
+Environment variables for microservices
+*/}}
+{{- define "ecommerce.envVars" -}}
+- name: SPRING_PROFILES_ACTIVE
+ value: "kubernetes"
+- name: EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE
+ value: "http://{{ include "ecommerce.serviceName" (dict "serviceName" "discovery-service" "Values" .Values) }}:8761/eureka"
+- name: SPRING_CLOUD_CONFIG_URI
+ value: "http://{{ include "ecommerce.serviceName" (dict "serviceName" "config-server" "Values" .Values) }}:8888"
+{{- if .Values.kafka.enabled }}
+- name: SPRING_KAFKA_BOOTSTRAP_SERVERS
+ value: "{{ .Release.Name }}-kafka:9092"
+{{- end }}
+{{- if .Values.mongodb.enabled }}
+- name: SPRING_DATA_MONGODB_URI
+ value: "mongodb://admin:admin123@{{ .Release.Name }}-mongodb:27017/ecommerce?authSource=admin"
+{{- end }}
+{{- if .Values.postgresql.enabled }}
+- name: SPRING_DATASOURCE_URL
+ value: "jdbc:postgresql://{{ .Release.Name }}-postgresql:5432/ecommerce"
+- name: SPRING_DATASOURCE_USERNAME
+ value: "ecommerce"
+- name: SPRING_DATASOURCE_PASSWORD
+ value: "ecommerce123"
+{{- end }}
+{{- end }}
diff --git a/k8s/helm-charts/templates/config-server-configmap.yaml b/k8s/helm-charts/templates/config-server-configmap.yaml
new file mode 100644
index 0000000..7916a2b
--- /dev/null
+++ b/k8s/helm-charts/templates/config-server-configmap.yaml
@@ -0,0 +1,63 @@
+{{- if .Values.configServer.enabled }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ .Values.configServer.name }}-config
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ .Values.configServer.name }}
+data:
+ application.yml: |
+ server:
+ port: 8888
+
+ spring:
+ application:
+ name: config-server
+ profiles:
+ active: kubernetes
+ cloud:
+ config:
+ server:
+ git:
+ uri: https://github.com/PramithaMJ/microservices-config
+ clone-on-start: true
+ default-label: main
+ health:
+ repositories:
+ microservices-config:
+ label: main
+ name: microservices-config
+ profiles: default
+
+ eureka:
+ client:
+ service-url:
+ defaultZone: http://{{ include "ecommerce.serviceName" (dict "serviceName" "discovery-service" "Values" .Values) }}:8761/eureka
+ register-with-eureka: true
+ fetch-registry: true
+ instance:
+ prefer-ip-address: true
+ hostname: {{ .Values.configServer.name }}
+
+ management:
+ endpoints:
+ web:
+ exposure:
+ include: "*"
+ endpoint:
+ health:
+ show-details: always
+ health:
+ livenessstate:
+ enabled: true
+ readinessstate:
+ enabled: true
+
+ bootstrap.yml: |
+ spring:
+ application:
+ name: config-server
+ profiles:
+ active: kubernetes
+{{- end }}
diff --git a/k8s/helm-charts/templates/discovery-service.yaml b/k8s/helm-charts/templates/discovery-service.yaml
new file mode 100644
index 0000000..1f07dda
--- /dev/null
+++ b/k8s/helm-charts/templates/discovery-service.yaml
@@ -0,0 +1,103 @@
+{{- if .Values.discovery.enabled }}
+{{- $serviceName := .Values.discovery.name }}
+{{- $slot := include "ecommerce.slot" . }}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: {{ $serviceName }}-{{ $slot }}
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+ deployment.kubernetes.io/slot: {{ $slot }}
+spec:
+ replicas: {{ .Values.discovery.replicaCount }}
+ strategy:
+ type: RollingUpdate
+ rollingUpdate:
+ maxUnavailable: 1
+ maxSurge: 1
+ selector:
+ matchLabels:
+ {{- include "ecommerce.selectorLabels" . | nindent 6 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+ deployment.kubernetes.io/slot: {{ $slot }}
+ template:
+ metadata:
+ labels:
+ {{- include "ecommerce.selectorLabels" . | nindent 8 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+ deployment.kubernetes.io/slot: {{ $slot }}
+ spec:
+ containers:
+ - name: {{ $serviceName }}
+ image: "{{ .Values.discovery.image.repository }}:{{ .Values.discovery.image.tag }}"
+ imagePullPolicy: {{ .Values.discovery.image.pullPolicy }}
+ ports:
+ - containerPort: {{ .Values.discovery.service.port }}
+ name: http
+ env:
+ {{- include "ecommerce.envVars" . | nindent 8 }}
+ - name: SERVER_PORT
+ value: "{{ .Values.discovery.service.port }}"
+ livenessProbe:
+ httpGet:
+ path: /actuator/health/liveness
+ port: http
+ initialDelaySeconds: {{ .Values.healthChecks.livenessProbe.initialDelaySeconds }}
+ periodSeconds: {{ .Values.healthChecks.livenessProbe.periodSeconds }}
+ timeoutSeconds: {{ .Values.healthChecks.livenessProbe.timeoutSeconds }}
+ failureThreshold: {{ .Values.healthChecks.livenessProbe.failureThreshold }}
+ readinessProbe:
+ httpGet:
+ path: /actuator/health/readiness
+ port: http
+ initialDelaySeconds: {{ .Values.healthChecks.readinessProbe.initialDelaySeconds }}
+ periodSeconds: {{ .Values.healthChecks.readinessProbe.periodSeconds }}
+ timeoutSeconds: {{ .Values.healthChecks.readinessProbe.timeoutSeconds }}
+ failureThreshold: {{ .Values.healthChecks.readinessProbe.failureThreshold }}
+ resources:
+ {{- toYaml .Values.discovery.resources | nindent 10 }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "ecommerce.serviceName" (dict "serviceName" $serviceName "Values" .Values) }}
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+spec:
+ type: {{ .Values.discovery.service.type }}
+ ports:
+ - port: {{ .Values.discovery.service.port }}
+ targetPort: http
+ protocol: TCP
+ name: http
+ selector:
+ {{- include "ecommerce.selectorLabels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+ deployment.kubernetes.io/slot: {{ $slot }}
+{{- if .Values.discovery.autoscaling.enabled }}
+---
+apiVersion: autoscaling/v2
+kind: HorizontalPodAutoscaler
+metadata:
+ name: {{ $serviceName }}-{{ $slot }}
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+spec:
+ scaleTargetRef:
+ apiVersion: apps/v1
+ kind: Deployment
+ name: {{ $serviceName }}-{{ $slot }}
+ minReplicas: {{ .Values.discovery.autoscaling.minReplicas }}
+ maxReplicas: {{ .Values.discovery.autoscaling.maxReplicas }}
+ metrics:
+ - type: Resource
+ resource:
+ name: cpu
+ target:
+ type: Utilization
+ averageUtilization: {{ .Values.discovery.autoscaling.targetCPUUtilizationPercentage }}
+{{- end }}
+{{- end }}
diff --git a/k8s/helm-charts/templates/gateway-service.yaml b/k8s/helm-charts/templates/gateway-service.yaml
new file mode 100644
index 0000000..1a62cce
--- /dev/null
+++ b/k8s/helm-charts/templates/gateway-service.yaml
@@ -0,0 +1,105 @@
+{{- if .Values.gateway.enabled }}
+{{- $serviceName := .Values.gateway.name }}
+{{- $slot := include "ecommerce.slot" . }}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: {{ $serviceName }}-{{ $slot }}
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+ deployment.kubernetes.io/slot: {{ $slot }}
+spec:
+ replicas: {{ .Values.gateway.replicaCount }}
+ strategy:
+ type: RollingUpdate
+ rollingUpdate:
+ maxUnavailable: 1
+ maxSurge: 2
+ selector:
+ matchLabels:
+ {{- include "ecommerce.selectorLabels" . | nindent 6 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+ deployment.kubernetes.io/slot: {{ $slot }}
+ template:
+ metadata:
+ labels:
+ {{- include "ecommerce.selectorLabels" . | nindent 8 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+ deployment.kubernetes.io/slot: {{ $slot }}
+ spec:
+ containers:
+ - name: {{ $serviceName }}
+ image: "{{ .Values.gateway.image.repository }}:{{ .Values.gateway.image.tag }}"
+ imagePullPolicy: {{ .Values.gateway.image.pullPolicy }}
+ ports:
+ - containerPort: {{ .Values.gateway.service.targetPort }}
+ name: http
+ env:
+ {{- include "ecommerce.envVars" . | nindent 8 }}
+ - name: SERVER_PORT
+ value: "{{ .Values.gateway.service.targetPort }}"
+ - name: SPRING_CLOUD_GATEWAY_DISCOVERY_LOCATOR_ENABLED
+ value: "true"
+ livenessProbe:
+ httpGet:
+ path: /actuator/health/liveness
+ port: http
+ initialDelaySeconds: {{ .Values.healthChecks.livenessProbe.initialDelaySeconds }}
+ periodSeconds: {{ .Values.healthChecks.livenessProbe.periodSeconds }}
+ timeoutSeconds: {{ .Values.healthChecks.livenessProbe.timeoutSeconds }}
+ failureThreshold: {{ .Values.healthChecks.livenessProbe.failureThreshold }}
+ readinessProbe:
+ httpGet:
+ path: /actuator/health/readiness
+ port: http
+ initialDelaySeconds: {{ .Values.healthChecks.readinessProbe.initialDelaySeconds }}
+ periodSeconds: {{ .Values.healthChecks.readinessProbe.periodSeconds }}
+ timeoutSeconds: {{ .Values.healthChecks.readinessProbe.timeoutSeconds }}
+ failureThreshold: {{ .Values.healthChecks.readinessProbe.failureThreshold }}
+ resources:
+ {{- toYaml .Values.gateway.resources | nindent 10 }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "ecommerce.serviceName" (dict "serviceName" $serviceName "Values" .Values) }}
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+spec:
+ type: {{ .Values.gateway.service.type }}
+ ports:
+ - port: {{ .Values.gateway.service.port }}
+ targetPort: http
+ protocol: TCP
+ name: http
+ selector:
+ {{- include "ecommerce.selectorLabels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+ deployment.kubernetes.io/slot: {{ $slot }}
+{{- if .Values.gateway.autoscaling.enabled }}
+---
+apiVersion: autoscaling/v2
+kind: HorizontalPodAutoscaler
+metadata:
+ name: {{ $serviceName }}-{{ $slot }}
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+spec:
+ scaleTargetRef:
+ apiVersion: apps/v1
+ kind: Deployment
+ name: {{ $serviceName }}-{{ $slot }}
+ minReplicas: {{ .Values.gateway.autoscaling.minReplicas }}
+ maxReplicas: {{ .Values.gateway.autoscaling.maxReplicas }}
+ metrics:
+ - type: Resource
+ resource:
+ name: cpu
+ target:
+ type: Utilization
+ averageUtilization: {{ .Values.gateway.autoscaling.targetCPUUtilizationPercentage }}
+{{- end }}
+{{- end }}
diff --git a/k8s/helm-charts/templates/ingress.yaml b/k8s/helm-charts/templates/ingress.yaml
new file mode 100644
index 0000000..152ccaa
--- /dev/null
+++ b/k8s/helm-charts/templates/ingress.yaml
@@ -0,0 +1,113 @@
+{{- if .Values.ingress.enabled -}}
+{{- $fullName := include "ecommerce.fullname" . -}}
+{{- $svcPort := .Values.gateway.service.port -}}
+{{- if and .Values.ingress.className (not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class")) }}
+ {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
+{{- end }}
+{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
+apiVersion: networking.k8s.io/v1
+{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+apiVersion: networking.k8s.io/v1beta1
+{{- else -}}
+apiVersion: extensions/v1beta1
+{{- end }}
+kind: Ingress
+metadata:
+ name: {{ $fullName }}
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+ {{- with .Values.ingress.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ # Blue-Green deployment annotations
+ nginx.ingress.kubernetes.io/canary: "false"
+ nginx.ingress.kubernetes.io/canary-weight: "0"
+ {{- end }}
+spec:
+ {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
+ ingressClassName: {{ .Values.ingress.className }}
+ {{- end }}
+ {{- if .Values.ingress.tls }}
+ tls:
+ {{- range .Values.ingress.tls }}
+ - hosts:
+ {{- range .hosts }}
+ - {{ . | quote }}
+ {{- end }}
+ secretName: {{ .secretName }}
+ {{- end }}
+ {{- end }}
+ rules:
+ {{- range .Values.ingress.hosts }}
+ - host: {{ .host | quote }}
+ http:
+ paths:
+ {{- range .paths }}
+ - path: {{ .path }}
+ {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
+ pathType: {{ .pathType }}
+ {{- end }}
+ backend:
+ {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
+ service:
+ name: {{ include "ecommerce.serviceName" (dict "serviceName" $.Values.gateway.name "Values" $.Values) }}
+ port:
+ number: {{ $svcPort }}
+ {{- else }}
+ serviceName: {{ include "ecommerce.serviceName" (dict "serviceName" $.Values.gateway.name "Values" $.Values) }}
+ servicePort: {{ $svcPort }}
+ {{- end }}
+ {{- end }}
+ {{- end }}
+{{- if .Values.bluegreen.enabled }}
+---
+# Blue-Green Canary Ingress for gradual traffic shifting
+{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
+apiVersion: networking.k8s.io/v1
+{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+apiVersion: networking.k8s.io/v1beta1
+{{- else -}}
+apiVersion: extensions/v1beta1
+{{- end }}
+kind: Ingress
+metadata:
+ name: {{ $fullName }}-canary
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+ deployment.type: canary
+ annotations:
+ {{- with .Values.ingress.annotations }}
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+ nginx.ingress.kubernetes.io/canary: "true"
+ nginx.ingress.kubernetes.io/canary-weight: "0"
+ nginx.ingress.kubernetes.io/canary-by-header: "X-Canary-Deploy"
+ nginx.ingress.kubernetes.io/canary-by-header-value: "always"
+spec:
+ {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
+ ingressClassName: {{ .Values.ingress.className }}
+ {{- end }}
+ rules:
+ {{- range .Values.ingress.hosts }}
+ - host: {{ .host | quote }}
+ http:
+ paths:
+ {{- range .paths }}
+ - path: {{ .path }}
+ {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
+ pathType: {{ .pathType }}
+ {{- end }}
+ backend:
+ {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
+ service:
+ name: {{ $.Values.gateway.name }}-{{ if eq $.Values.bluegreen.activeSlot "blue" }}green{{ else }}blue{{ end }}
+ port:
+ number: {{ $svcPort }}
+ {{- else }}
+ serviceName: {{ $.Values.gateway.name }}-{{ if eq $.Values.bluegreen.activeSlot "blue" }}green{{ else }}blue{{ end }}
+ servicePort: {{ $svcPort }}
+ {{- end }}
+ {{- end }}
+ {{- end }}
+{{- end }}
+{{- end }}
diff --git a/k8s/helm-charts/templates/monitoring-configmap.yaml b/k8s/helm-charts/templates/monitoring-configmap.yaml
new file mode 100644
index 0000000..3e28f87
--- /dev/null
+++ b/k8s/helm-charts/templates/monitoring-configmap.yaml
@@ -0,0 +1,205 @@
+{{- if .Values.monitoring.enabled }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: prometheus-config
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+ app.kubernetes.io/component: monitoring
+data:
+ prometheus.yml: |
+ global:
+ scrape_interval: 15s
+ evaluation_interval: 15s
+
+ rule_files:
+ - "circuit_breaker_rules.yml"
+ - "saga_pattern_rules.yml"
+
+ scrape_configs:
+ # Discovery Service
+ - job_name: 'discovery-service'
+ kubernetes_sd_configs:
+ - role: endpoints
+ namespaces:
+ names:
+ - {{ .Release.Namespace }}
+ relabel_configs:
+ - source_labels: [__meta_kubernetes_service_name]
+ action: keep
+ regex: discovery-service.*
+ - source_labels: [__meta_kubernetes_endpoint_port_name]
+ action: keep
+ regex: http
+ scrape_interval: 30s
+ metrics_path: '/actuator/prometheus'
+
+ # Config Server
+ - job_name: 'config-server'
+ kubernetes_sd_configs:
+ - role: endpoints
+ namespaces:
+ names:
+ - {{ .Release.Namespace }}
+ relabel_configs:
+ - source_labels: [__meta_kubernetes_service_name]
+ action: keep
+ regex: config-server.*
+ - source_labels: [__meta_kubernetes_endpoint_port_name]
+ action: keep
+ regex: http
+ scrape_interval: 30s
+ metrics_path: '/actuator/prometheus'
+
+ # API Gateway
+ - job_name: 'api-gateway'
+ kubernetes_sd_configs:
+ - role: endpoints
+ namespaces:
+ names:
+ - {{ .Release.Namespace }}
+ relabel_configs:
+ - source_labels: [__meta_kubernetes_service_name]
+ action: keep
+ regex: api-gateway.*
+ - source_labels: [__meta_kubernetes_endpoint_port_name]
+ action: keep
+ regex: http
+ scrape_interval: 15s
+ metrics_path: '/actuator/prometheus'
+
+ # Microservices
+ - job_name: 'microservices'
+ kubernetes_sd_configs:
+ - role: endpoints
+ namespaces:
+ names:
+ - {{ .Release.Namespace }}
+ relabel_configs:
+ - source_labels: [__meta_kubernetes_service_name]
+ action: keep
+ regex: '(customer|product|order|payment|notification)-service.*'
+ - source_labels: [__meta_kubernetes_endpoint_port_name]
+ action: keep
+ regex: http
+ scrape_interval: 15s
+ metrics_path: '/actuator/prometheus'
+
+ # Kafka metrics
+ - job_name: 'kafka'
+ kubernetes_sd_configs:
+ - role: endpoints
+ namespaces:
+ names:
+ - {{ .Release.Namespace }}
+ relabel_configs:
+ - source_labels: [__meta_kubernetes_service_name]
+ action: keep
+ regex: '.*kafka.*'
+ - source_labels: [__meta_kubernetes_endpoint_port_name]
+ action: keep
+ regex: metrics
+ scrape_interval: 30s
+
+ circuit_breaker_rules.yml: |
+ groups:
+ - name: circuit_breaker
+ rules:
+ - alert: CircuitBreakerOpen
+ expr: resilience4j_circuitbreaker_state{state="open"} == 1
+ for: 1m
+ labels:
+ severity: critical
+ annotations:
+ summary: "Circuit breaker {{ $labels.name }} is open"
+ description: "Circuit breaker {{ $labels.name }} in service {{ $labels.job }} has been open for more than 1 minute"
+
+ - alert: CircuitBreakerHighFailureRate
+ expr: rate(resilience4j_circuitbreaker_calls_total{kind="failed"}[5m]) / rate(resilience4j_circuitbreaker_calls_total[5m]) > 0.5
+ for: 2m
+ labels:
+ severity: warning
+ annotations:
+ summary: "High failure rate detected for circuit breaker {{ $labels.name }}"
+ description: "Circuit breaker {{ $labels.name }} has a failure rate above 50% for the last 2 minutes"
+
+ - alert: CircuitBreakerSlowCalls
+ expr: rate(resilience4j_circuitbreaker_slow_calls_total[5m]) / rate(resilience4j_circuitbreaker_calls_total[5m]) > 0.3
+ for: 2m
+ labels:
+ severity: warning
+ annotations:
+ summary: "High slow call rate for circuit breaker {{ $labels.name }}"
+ description: "Circuit breaker {{ $labels.name }} has slow calls above 30% for the last 2 minutes"
+
+ saga_pattern_rules.yml: |
+ groups:
+ - name: saga_pattern
+ rules:
+ - alert: SagaHighFailureRate
+ expr: rate(saga_failures_total[5m]) / rate(saga_started_total[5m]) > 0.1
+ for: 2m
+ labels:
+ severity: critical
+ annotations:
+ summary: "High saga failure rate detected"
+ description: "Saga pattern has a failure rate above 10% for the last 2 minutes"
+
+ - alert: SagaLongRunningTransactions
+ expr: histogram_quantile(0.95, rate(saga_duration_seconds_bucket[5m])) > 300
+ for: 1m
+ labels:
+ severity: warning
+ annotations:
+ summary: "Long running saga transactions detected"
+ description: "95th percentile of saga duration is above 5 minutes"
+
+ - alert: SagaCompensationRate
+ expr: rate(saga_compensations_total[5m]) > 0.05
+ for: 1m
+ labels:
+ severity: warning
+ annotations:
+ summary: "High saga compensation rate"
+ description: "Saga compensations are occurring at a rate higher than expected"
+
+ - alert: SagaPendingTransactions
+ expr: saga_pending_total > 100
+ for: 5m
+ labels:
+ severity: warning
+ annotations:
+ summary: "High number of pending saga transactions"
+ description: "There are {{ $value }} pending saga transactions for more than 5 minutes"
+
+ general_rules.yml: |
+ groups:
+ - name: microservices
+ rules:
+ - alert: ServiceDown
+ expr: up{job=~"(discovery-service|config-server|api-gateway|customer-service|product-service|order-service|payment-service|notification-service)"} == 0
+ for: 1m
+ labels:
+ severity: critical
+ annotations:
+ summary: "Service {{ $labels.job }} is down"
+ description: "Service {{ $labels.job }} has been down for more than 1 minute"
+
+ - alert: HighMemoryUsage
+ expr: (container_memory_usage_bytes / container_spec_memory_limit_bytes) * 100 > 85
+ for: 5m
+ labels:
+ severity: warning
+ annotations:
+ summary: "High memory usage for {{ $labels.container }}"
+ description: "Container {{ $labels.container }} memory usage is above 85%"
+
+ - alert: HighCPUUsage
+ expr: (rate(container_cpu_usage_seconds_total[5m]) / container_spec_cpu_quota) * 100 > 80
+ for: 5m
+ labels:
+ severity: warning
+ annotations:
+ summary: "High CPU usage for {{ $labels.container }}"
+ description: "Container {{ $labels.container }} CPU usage is above 80%"
+{{- end }}
diff --git a/k8s/helm-charts/templates/network-policies.yaml b/k8s/helm-charts/templates/network-policies.yaml
new file mode 100644
index 0000000..a486bbe
--- /dev/null
+++ b/k8s/helm-charts/templates/network-policies.yaml
@@ -0,0 +1,283 @@
+{{- if .Values.security.networkPolicies.enabled }}
+# Discovery Service Network Policy
+apiVersion: networking.k8s.io/v1
+kind: NetworkPolicy
+metadata:
+ name: discovery-service-netpol
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+spec:
+ podSelector:
+ matchLabels:
+ app.kubernetes.io/component: discovery-service
+ policyTypes:
+ - Ingress
+ - Egress
+ ingress:
+ - from:
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/name: {{ include "ecommerce.name" . }}
+ ports:
+ - protocol: TCP
+ port: 8761
+ egress:
+ - {} # Allow all outbound traffic for service registration
+
+---
+# Config Server Network Policy
+apiVersion: networking.k8s.io/v1
+kind: NetworkPolicy
+metadata:
+ name: config-server-netpol
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+spec:
+ podSelector:
+ matchLabels:
+ app.kubernetes.io/component: config-server
+ policyTypes:
+ - Ingress
+ - Egress
+ ingress:
+ - from:
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/name: {{ include "ecommerce.name" . }}
+ ports:
+ - protocol: TCP
+ port: 8888
+ egress:
+ - {} # Allow all outbound traffic for Git access
+
+---
+# API Gateway Network Policy
+apiVersion: networking.k8s.io/v1
+kind: NetworkPolicy
+metadata:
+ name: api-gateway-netpol
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+spec:
+ podSelector:
+ matchLabels:
+ app.kubernetes.io/component: api-gateway
+ policyTypes:
+ - Ingress
+ - Egress
+ ingress:
+ - {} # Allow all inbound traffic (external access)
+ egress:
+ - to:
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/name: {{ include "ecommerce.name" . }}
+ ports:
+ - protocol: TCP
+ port: 8761 # Discovery Service
+ - protocol: TCP
+ port: 8888 # Config Server
+ - protocol: TCP
+ port: 8090 # Customer Service
+ - protocol: TCP
+ port: 8050 # Product Service
+ - protocol: TCP
+ port: 8070 # Order Service
+ - protocol: TCP
+ port: 8060 # Payment Service
+ - protocol: TCP
+ port: 8040 # Notification Service
+ - {} # DNS resolution
+
+---
+# Microservices Network Policy
+apiVersion: networking.k8s.io/v1
+kind: NetworkPolicy
+metadata:
+ name: microservices-netpol
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+spec:
+ podSelector:
+ matchLabels:
+ app.kubernetes.io/component: customer-service
+ policyTypes:
+ - Ingress
+ - Egress
+ ingress:
+ - from:
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/component: api-gateway
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/component: order-service # For saga pattern
+ ports:
+ - protocol: TCP
+ port: 8090
+ egress:
+ - to:
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/component: discovery-service
+ ports:
+ - protocol: TCP
+ port: 8761
+ - to:
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/component: config-server
+ ports:
+ - protocol: TCP
+ port: 8888
+ - to: # Database access
+ - podSelector: {}
+ ports:
+ - protocol: TCP
+ port: 5432
+ - protocol: TCP
+ port: 27017
+ - to: # Kafka access
+ - podSelector: {}
+ ports:
+ - protocol: TCP
+ port: 9092
+ - {} # DNS resolution
+
+---
+# Order Service Network Policy (Saga Coordinator)
+apiVersion: networking.k8s.io/v1
+kind: NetworkPolicy
+metadata:
+ name: order-service-netpol
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+spec:
+ podSelector:
+ matchLabels:
+ app.kubernetes.io/component: order-service
+ policyTypes:
+ - Ingress
+ - Egress
+ ingress:
+ - from:
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/component: api-gateway
+ ports:
+ - protocol: TCP
+ port: 8070
+ egress:
+ - to:
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/component: discovery-service
+ ports:
+ - protocol: TCP
+ port: 8761
+ - to:
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/component: config-server
+ ports:
+ - protocol: TCP
+ port: 8888
+ - to: # Communication with other services for saga pattern
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/component: customer-service
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/component: product-service
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/component: payment-service
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/component: notification-service
+ ports:
+ - protocol: TCP
+ port: 8090
+ - protocol: TCP
+ port: 8050
+ - protocol: TCP
+ port: 8060
+ - protocol: TCP
+ port: 8040
+ - to: # Database and Kafka access
+ - podSelector: {}
+ ports:
+ - protocol: TCP
+ port: 27017
+ - protocol: TCP
+ port: 9092
+ - {} # DNS resolution
+
+---
+# Database Network Policy
+apiVersion: networking.k8s.io/v1
+kind: NetworkPolicy
+metadata:
+ name: database-netpol
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+spec:
+ podSelector:
+ matchLabels:
+ app.kubernetes.io/name: mongodb
+ policyTypes:
+ - Ingress
+ ingress:
+ - from:
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/name: {{ include "ecommerce.name" . }}
+ ports:
+ - protocol: TCP
+ port: 27017
+
+---
+apiVersion: networking.k8s.io/v1
+kind: NetworkPolicy
+metadata:
+ name: postgresql-netpol
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+spec:
+ podSelector:
+ matchLabels:
+ app.kubernetes.io/name: postgresql
+ policyTypes:
+ - Ingress
+ ingress:
+ - from:
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/name: {{ include "ecommerce.name" . }}
+ ports:
+ - protocol: TCP
+ port: 5432
+
+---
+# Kafka Network Policy
+apiVersion: networking.k8s.io/v1
+kind: NetworkPolicy
+metadata:
+ name: kafka-netpol
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+spec:
+ podSelector:
+ matchLabels:
+ app.kubernetes.io/name: kafka
+ policyTypes:
+ - Ingress
+ ingress:
+ - from:
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/name: {{ include "ecommerce.name" . }}
+ ports:
+ - protocol: TCP
+ port: 9092
+{{- end }}
diff --git a/k8s/helm-charts/templates/order-service.yaml b/k8s/helm-charts/templates/order-service.yaml
new file mode 100644
index 0000000..6e20541
--- /dev/null
+++ b/k8s/helm-charts/templates/order-service.yaml
@@ -0,0 +1,117 @@
+{{- if .Values.order.enabled }}
+{{- $serviceName := .Values.order.name }}
+{{- $slot := include "ecommerce.slot" . }}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: {{ $serviceName }}-{{ $slot }}
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+ deployment.kubernetes.io/slot: {{ $slot }}
+spec:
+ replicas: {{ .Values.order.replicaCount }}
+ strategy:
+ type: RollingUpdate
+ rollingUpdate:
+ maxUnavailable: 1
+ maxSurge: 1
+ selector:
+ matchLabels:
+ {{- include "ecommerce.selectorLabels" . | nindent 6 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+ deployment.kubernetes.io/slot: {{ $slot }}
+ template:
+ metadata:
+ labels:
+ {{- include "ecommerce.selectorLabels" . | nindent 8 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+ deployment.kubernetes.io/slot: {{ $slot }}
+ spec:
+ containers:
+ - name: {{ $serviceName }}
+ image: "{{ .Values.order.image.repository }}:{{ .Values.order.image.tag }}"
+ imagePullPolicy: {{ .Values.order.image.pullPolicy }}
+ ports:
+ - containerPort: {{ .Values.order.service.port }}
+ name: http
+ env:
+ {{- include "ecommerce.envVars" . | nindent 8 }}
+ - name: SERVER_PORT
+ value: "{{ .Values.order.service.port }}"
+ {{- if .Values.order.circuitBreaker.enabled }}
+ - name: RESILIENCE4J_CIRCUITBREAKER_FAILURE_RATE_THRESHOLD
+ value: "{{ .Values.order.circuitBreaker.failureRateThreshold }}"
+ - name: RESILIENCE4J_CIRCUITBREAKER_WAIT_DURATION_IN_OPEN_STATE
+ value: "{{ .Values.order.circuitBreaker.waitDurationInOpenState }}"
+ - name: RESILIENCE4J_CIRCUITBREAKER_SLIDING_WINDOW_SIZE
+ value: "{{ .Values.order.circuitBreaker.slidingWindowSize }}"
+ {{- end }}
+ {{- if .Values.order.saga.enabled }}
+ - name: SAGA_RETRY_ATTEMPTS
+ value: "{{ .Values.order.saga.retryAttempts }}"
+ - name: SAGA_COMPENSATION_TIMEOUT
+ value: "{{ .Values.order.saga.compensationTimeout }}"
+ {{- end }}
+ livenessProbe:
+ httpGet:
+ path: /actuator/health/liveness
+ port: http
+ initialDelaySeconds: {{ .Values.healthChecks.livenessProbe.initialDelaySeconds }}
+ periodSeconds: {{ .Values.healthChecks.livenessProbe.periodSeconds }}
+ timeoutSeconds: {{ .Values.healthChecks.livenessProbe.timeoutSeconds }}
+ failureThreshold: {{ .Values.healthChecks.livenessProbe.failureThreshold }}
+ readinessProbe:
+ httpGet:
+ path: /actuator/health/readiness
+ port: http
+ initialDelaySeconds: {{ .Values.healthChecks.readinessProbe.initialDelaySeconds }}
+ periodSeconds: {{ .Values.healthChecks.readinessProbe.periodSeconds }}
+ timeoutSeconds: {{ .Values.healthChecks.readinessProbe.timeoutSeconds }}
+ failureThreshold: {{ .Values.healthChecks.readinessProbe.failureThreshold }}
+ resources:
+ {{- toYaml .Values.order.resources | nindent 10 }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "ecommerce.serviceName" (dict "serviceName" $serviceName "Values" .Values) }}
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+spec:
+ type: {{ .Values.order.service.type }}
+ ports:
+ - port: {{ .Values.order.service.port }}
+ targetPort: http
+ protocol: TCP
+ name: http
+ selector:
+ {{- include "ecommerce.selectorLabels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+ deployment.kubernetes.io/slot: {{ $slot }}
+{{- if .Values.order.autoscaling.enabled }}
+---
+apiVersion: autoscaling/v2
+kind: HorizontalPodAutoscaler
+metadata:
+ name: {{ $serviceName }}-{{ $slot }}
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+ app.kubernetes.io/component: {{ $serviceName }}
+spec:
+ scaleTargetRef:
+ apiVersion: apps/v1
+ kind: Deployment
+ name: {{ $serviceName }}-{{ $slot }}
+ minReplicas: {{ .Values.order.autoscaling.minReplicas }}
+ maxReplicas: {{ .Values.order.autoscaling.maxReplicas }}
+ metrics:
+ - type: Resource
+ resource:
+ name: cpu
+ target:
+ type: Utilization
+ averageUtilization: {{ .Values.order.autoscaling.targetCPUUtilizationPercentage }}
+{{- end }}
+{{- end }}
diff --git a/k8s/helm-charts/templates/secrets.yaml b/k8s/helm-charts/templates/secrets.yaml
new file mode 100644
index 0000000..2c4c133
--- /dev/null
+++ b/k8s/helm-charts/templates/secrets.yaml
@@ -0,0 +1,27 @@
+apiVersion: v1
+kind: Secret
+metadata:
+ name: {{ include "ecommerce.fullname" . }}-secrets
+ labels:
+ {{- include "ecommerce.labels" . | nindent 4 }}
+type: Opaque
+data:
+ # Database passwords (base64 encoded)
+ mongodb-root-password: {{ "admin123" | b64enc | quote }}
+ mongodb-password: {{ "ecommerce123" | b64enc | quote }}
+ postgresql-password: {{ "admin123" | b64enc | quote }}
+ postgresql-user-password: {{ "ecommerce123" | b64enc | quote }}
+
+ # JWT Secret for authentication
+ jwt-secret: {{ "mySecretKey123456789012345678901234567890" | b64enc | quote }}
+
+ # Kafka credentials
+ kafka-username: {{ "kafka" | b64enc | quote }}
+ kafka-password: {{ "kafka123" | b64enc | quote }}
+
+ # External API keys
+ payment-gateway-api-key: {{ "pg_test_key_123456789" | b64enc | quote }}
+ notification-email-password: {{ "email_password_123" | b64enc | quote }}
+
+ # Circuit breaker secrets
+ circuit-breaker-secret: {{ "cb_secret_key_123" | b64enc | quote }}
diff --git a/k8s/helm-charts/values.yaml b/k8s/helm-charts/values.yaml
new file mode 100644
index 0000000..71d24a7
--- /dev/null
+++ b/k8s/helm-charts/values.yaml
@@ -0,0 +1,311 @@
+# Default values for ecommerce-microservices
+# Blue-Green Deployment Configuration
+
+# Global settings
+global:
+ imageRegistry: ""
+ imagePullSecrets: []
+ storageClass: ""
+
+# Blue-Green Deployment Strategy
+bluegreen:
+ enabled: true
+ activeSlot: "blue"
+ strategy: "manual" # manual or automatic
+
+# Service Discovery (Eureka)
+discovery:
+ enabled: true
+ name: discovery-service
+ image:
+ repository: ecommerce/discovery-service
+ tag: "latest"
+ pullPolicy: IfNotPresent
+ replicaCount: 2
+ service:
+ type: ClusterIP
+ port: 8761
+ resources:
+ limits:
+ cpu: 500m
+ memory: 512Mi
+ requests:
+ cpu: 250m
+ memory: 256Mi
+ autoscaling:
+ enabled: true
+ minReplicas: 2
+ maxReplicas: 5
+ targetCPUUtilizationPercentage: 70
+
+# Config Server
+configServer:
+ enabled: true
+ name: config-server
+ image:
+ repository: ecommerce/config-server
+ tag: "latest"
+ pullPolicy: IfNotPresent
+ replicaCount: 2
+ service:
+ type: ClusterIP
+ port: 8888
+ resources:
+ limits:
+ cpu: 500m
+ memory: 512Mi
+ requests:
+ cpu: 250m
+ memory: 256Mi
+
+# API Gateway
+gateway:
+ enabled: true
+ name: api-gateway
+ image:
+ repository: ecommerce/api-gateway
+ tag: "latest"
+ pullPolicy: IfNotPresent
+ replicaCount: 3
+ service:
+ type: LoadBalancer
+ port: 8080
+ targetPort: 8080
+ resources:
+ limits:
+ cpu: 1000m
+ memory: 1Gi
+ requests:
+ cpu: 500m
+ memory: 512Mi
+ autoscaling:
+ enabled: true
+ minReplicas: 3
+ maxReplicas: 10
+ targetCPUUtilizationPercentage: 70
+
+# Customer Service
+customer:
+ enabled: true
+ name: customer-service
+ image:
+ repository: ecommerce/customer-service
+ tag: "latest"
+ pullPolicy: IfNotPresent
+ replicaCount: 3
+ service:
+ type: ClusterIP
+ port: 8090
+ resources:
+ limits:
+ cpu: 800m
+ memory: 1Gi
+ requests:
+ cpu: 400m
+ memory: 512Mi
+ autoscaling:
+ enabled: true
+ minReplicas: 3
+ maxReplicas: 8
+ targetCPUUtilizationPercentage: 70
+ circuitBreaker:
+ enabled: true
+ failureRateThreshold: 50
+ waitDurationInOpenState: 30000
+ slidingWindowSize: 10
+
+# Product Service
+product:
+ enabled: true
+ name: product-service
+ image:
+ repository: ecommerce/product-service
+ tag: "latest"
+ pullPolicy: IfNotPresent
+ replicaCount: 3
+ service:
+ type: ClusterIP
+ port: 8050
+ resources:
+ limits:
+ cpu: 800m
+ memory: 1Gi
+ requests:
+ cpu: 400m
+ memory: 512Mi
+ autoscaling:
+ enabled: true
+ minReplicas: 3
+ maxReplicas: 8
+ targetCPUUtilizationPercentage: 70
+ circuitBreaker:
+ enabled: true
+ failureRateThreshold: 50
+ waitDurationInOpenState: 30000
+ slidingWindowSize: 10
+
+# Order Service (with Saga Pattern)
+order:
+ enabled: true
+ name: order-service
+ image:
+ repository: ecommerce/order-service
+ tag: "latest"
+ pullPolicy: IfNotPresent
+ replicaCount: 3
+ service:
+ type: ClusterIP
+ port: 8070
+ resources:
+ limits:
+ cpu: 1000m
+ memory: 1Gi
+ requests:
+ cpu: 500m
+ memory: 512Mi
+ autoscaling:
+ enabled: true
+ minReplicas: 3
+ maxReplicas: 10
+ targetCPUUtilizationPercentage: 70
+ circuitBreaker:
+ enabled: true
+ failureRateThreshold: 30
+ waitDurationInOpenState: 60000
+ slidingWindowSize: 20
+ saga:
+ enabled: true
+ retryAttempts: 3
+ compensationTimeout: 30000
+
+# Payment Service
+payment:
+ enabled: true
+ name: payment-service
+ image:
+ repository: ecommerce/payment-service
+ tag: "latest"
+ pullPolicy: IfNotPresent
+ replicaCount: 3
+ service:
+ type: ClusterIP
+ port: 8060
+ resources:
+ limits:
+ cpu: 800m
+ memory: 1Gi
+ requests:
+ cpu: 400m
+ memory: 512Mi
+ autoscaling:
+ enabled: true
+ minReplicas: 3
+ maxReplicas: 8
+ targetCPUUtilizationPercentage: 70
+ circuitBreaker:
+ enabled: true
+ failureRateThreshold: 30
+ waitDurationInOpenState: 60000
+ slidingWindowSize: 20
+
+# Notification Service
+notification:
+ enabled: true
+ name: notification-service
+ image:
+ repository: ecommerce/notification-service
+ tag: "latest"
+ pullPolicy: IfNotPresent
+ replicaCount: 2
+ service:
+ type: ClusterIP
+ port: 8040
+ resources:
+ limits:
+ cpu: 500m
+ memory: 512Mi
+ requests:
+ cpu: 250m
+ memory: 256Mi
+ autoscaling:
+ enabled: true
+ minReplicas: 2
+ maxReplicas: 6
+ targetCPUUtilizationPercentage: 70
+
+# Database configurations
+mongodb:
+ enabled: true
+ auth:
+ enabled: true
+ rootUser: admin
+ rootPassword: admin123
+ persistence:
+ enabled: true
+ size: 10Gi
+
+postgresql:
+ enabled: true
+ auth:
+ postgresPassword: admin123
+ username: ecommerce
+ password: ecommerce123
+ database: ecommerce
+ persistence:
+ enabled: true
+ size: 10Gi
+
+# Kafka configuration
+kafka:
+ enabled: true
+ persistence:
+ enabled: true
+ size: 10Gi
+ zookeeper:
+ persistence:
+ enabled: true
+ size: 5Gi
+
+# Monitoring
+monitoring:
+ enabled: true
+ prometheus:
+ enabled: true
+ grafana:
+ enabled: true
+
+# Health checks
+healthChecks:
+ livenessProbe:
+ initialDelaySeconds: 90
+ periodSeconds: 30
+ timeoutSeconds: 10
+ failureThreshold: 5
+ readinessProbe:
+ initialDelaySeconds: 30
+ periodSeconds: 10
+ timeoutSeconds: 5
+ failureThreshold: 3
+
+# Security
+security:
+ enabled: true
+ networkPolicies:
+ enabled: true
+ podSecurityPolicy:
+ enabled: true
+
+# Ingress
+ingress:
+ enabled: true
+ className: "nginx"
+ annotations:
+ nginx.ingress.kubernetes.io/rewrite-target: /
+ nginx.ingress.kubernetes.io/ssl-redirect: "false"
+ nginx.ingress.kubernetes.io/proxy-body-size: "50m"
+ hosts:
+ - host: ecommerce-api.local
+ paths:
+ - path: /
+ pathType: Prefix
+ tls: []
diff --git a/services/config-server/pom.xml b/services/config-server/pom.xml
index 041052f..3a48768 100644
--- a/services/config-server/pom.xml
+++ b/services/config-server/pom.xml
@@ -8,7 +8,7 @@
3.2.5
- com.alibou
+ com.pramithamj
config-server
0.0.1-SNAPSHOT
config-server
diff --git a/services/config-server/src/main/java/com/alibou/configserver/ConfigServerApplication.java b/services/config-server/src/main/java/com/pramithamj/configserver/ConfigServerApplication.java
similarity index 91%
rename from services/config-server/src/main/java/com/alibou/configserver/ConfigServerApplication.java
rename to services/config-server/src/main/java/com/pramithamj/configserver/ConfigServerApplication.java
index 11fb339..a69e4f4 100644
--- a/services/config-server/src/main/java/com/alibou/configserver/ConfigServerApplication.java
+++ b/services/config-server/src/main/java/com/pramithamj/configserver/ConfigServerApplication.java
@@ -1,4 +1,4 @@
-package com.alibou.configserver;
+package com.pramithamj.configserver;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/services/config-server/src/main/resources/configurations/notification-service.yml b/services/config-server/src/main/resources/configurations/notification-service.yml
index 046fdd3..ac7ef97 100644
--- a/services/config-server/src/main/resources/configurations/notification-service.yml
+++ b/services/config-server/src/main/resources/configurations/notification-service.yml
@@ -18,7 +18,7 @@ spring:
value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
properties:
spring.json.trusted.packages: '*'
- spring.json.type.mapping: orderConfirmation:com.alibou.ecommerce.kafka.order.OrderConfirmation,paymentConfirmation:com.alibou.ecommerce.kafka.payment.PaymentConfirmation
+ spring.json.type.mapping: orderConfirmation:com.pramithamj.ecommerce.kafka.order.OrderConfirmation,paymentConfirmation:com.pramithamj.ecommerce.kafka.payment.PaymentConfirmation
mail:
host: localhost
port: 1025
diff --git a/services/config-server/src/main/resources/configurations/order-service.yml b/services/config-server/src/main/resources/configurations/order-service.yml
index 4f46cc7..151035a 100644
--- a/services/config-server/src/main/resources/configurations/order-service.yml
+++ b/services/config-server/src/main/resources/configurations/order-service.yml
@@ -17,7 +17,7 @@ spring:
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
properties:
- spring.json.type.mapping: orderConfirmation:com.alibou.ecommerce.kafka.OrderConfirmation
+ spring.json.type.mapping: orderConfirmation:com.pramithamj.ecommerce.kafka.OrderConfirmation
application:
config:
diff --git a/services/config-server/src/main/resources/configurations/payment-service.yml b/services/config-server/src/main/resources/configurations/payment-service.yml
index 72fa982..4e70ac8 100644
--- a/services/config-server/src/main/resources/configurations/payment-service.yml
+++ b/services/config-server/src/main/resources/configurations/payment-service.yml
@@ -18,7 +18,7 @@ spring:
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
properties:
- spring.json.type.mapping: paymentConfirmation:com.alibou.ecommerce.notification.PaymentNotificationRequest
+ spring.json.type.mapping: paymentConfirmation:com.pramithamj.ecommerce.notification.PaymentNotificationRequest
application:
config:
product-url: http://localhost:8222/api/v1/products
diff --git a/services/config-server/src/test/java/com/alibou/configserver/ConfigServerApplicationTests.java b/services/config-server/src/test/java/com/pramithamj/configserver/ConfigServerApplicationTests.java
similarity index 83%
rename from services/config-server/src/test/java/com/alibou/configserver/ConfigServerApplicationTests.java
rename to services/config-server/src/test/java/com/pramithamj/configserver/ConfigServerApplicationTests.java
index fa84786..85b3efb 100644
--- a/services/config-server/src/test/java/com/alibou/configserver/ConfigServerApplicationTests.java
+++ b/services/config-server/src/test/java/com/pramithamj/configserver/ConfigServerApplicationTests.java
@@ -1,4 +1,4 @@
-package com.alibou.configserver;
+package com.pramithamj.configserver;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
diff --git a/services/customer/pom.xml b/services/customer/pom.xml
index 9b8657a..e990cfd 100644
--- a/services/customer/pom.xml
+++ b/services/customer/pom.xml
@@ -8,7 +8,7 @@
3.2.5
- com.alibou
+ com.pramithamj
customer
0.0.1-SNAPSHOT
customer
diff --git a/services/customer/src/main/java/com/alibou/ecommerce/CustomerApplication.java b/services/customer/src/main/java/com/pramithamj/ecommerce/CustomerApplication.java
similarity index 89%
rename from services/customer/src/main/java/com/alibou/ecommerce/CustomerApplication.java
rename to services/customer/src/main/java/com/pramithamj/ecommerce/CustomerApplication.java
index 937ecc4..9248cfe 100644
--- a/services/customer/src/main/java/com/alibou/ecommerce/CustomerApplication.java
+++ b/services/customer/src/main/java/com/pramithamj/ecommerce/CustomerApplication.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce;
+package com.pramithamj.ecommerce;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/services/customer/src/main/java/com/alibou/ecommerce/customer/Address.java b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/Address.java
similarity index 90%
rename from services/customer/src/main/java/com/alibou/ecommerce/customer/Address.java
rename to services/customer/src/main/java/com/pramithamj/ecommerce/customer/Address.java
index 1da667b..cf27036 100644
--- a/services/customer/src/main/java/com/alibou/ecommerce/customer/Address.java
+++ b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/Address.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.customer;
+package com.pramithamj.ecommerce.customer;
import lombok.AllArgsConstructor;
diff --git a/services/customer/src/main/java/com/alibou/ecommerce/customer/Customer.java b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/Customer.java
similarity index 92%
rename from services/customer/src/main/java/com/alibou/ecommerce/customer/Customer.java
rename to services/customer/src/main/java/com/pramithamj/ecommerce/customer/Customer.java
index 3f9db56..b3df6d0 100644
--- a/services/customer/src/main/java/com/alibou/ecommerce/customer/Customer.java
+++ b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/Customer.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.customer;
+package com.pramithamj.ecommerce.customer;
import lombok.AllArgsConstructor;
import lombok.Builder;
diff --git a/services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerController.java b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerController.java
similarity index 97%
rename from services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerController.java
rename to services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerController.java
index 0f33712..05a6a6b 100644
--- a/services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerController.java
+++ b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerController.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.customer;
+package com.pramithamj.ecommerce.customer;
import java.util.List;
diff --git a/services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerMapper.java b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerMapper.java
similarity index 94%
rename from services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerMapper.java
rename to services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerMapper.java
index 1d16f6d..74c6bf7 100644
--- a/services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerMapper.java
+++ b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerMapper.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.customer;
+package com.pramithamj.ecommerce.customer;
import org.springframework.stereotype.Component;
diff --git a/services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerRepository.java b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerRepository.java
similarity index 78%
rename from services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerRepository.java
rename to services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerRepository.java
index 7ebc36e..e9e6c55 100644
--- a/services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerRepository.java
+++ b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerRepository.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.customer;
+package com.pramithamj.ecommerce.customer;
import org.springframework.data.mongodb.repository.MongoRepository;
diff --git a/services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerRequest.java b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerRequest.java
similarity index 91%
rename from services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerRequest.java
rename to services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerRequest.java
index 3965a36..9b8ba15 100644
--- a/services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerRequest.java
+++ b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerRequest.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.customer;
+package com.pramithamj.ecommerce.customer;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotNull;
diff --git a/services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerResponse.java b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerResponse.java
similarity index 75%
rename from services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerResponse.java
rename to services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerResponse.java
index daba51f..2b28e3b 100644
--- a/services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerResponse.java
+++ b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerResponse.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.customer;
+package com.pramithamj.ecommerce.customer;
public record CustomerResponse(
String id,
diff --git a/services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerService.java b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerService.java
similarity index 94%
rename from services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerService.java
rename to services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerService.java
index 04a0ce7..975ab4f 100644
--- a/services/customer/src/main/java/com/alibou/ecommerce/customer/CustomerService.java
+++ b/services/customer/src/main/java/com/pramithamj/ecommerce/customer/CustomerService.java
@@ -1,6 +1,6 @@
-package com.alibou.ecommerce.customer;
+package com.pramithamj.ecommerce.customer;
-import com.alibou.ecommerce.exception.CustomerNotFoundException;
+import com.pramithamj.ecommerce.exception.CustomerNotFoundException;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
diff --git a/services/customer/src/main/java/com/alibou/ecommerce/exception/CustomerNotFoundException.java b/services/customer/src/main/java/com/pramithamj/ecommerce/exception/CustomerNotFoundException.java
similarity index 81%
rename from services/customer/src/main/java/com/alibou/ecommerce/exception/CustomerNotFoundException.java
rename to services/customer/src/main/java/com/pramithamj/ecommerce/exception/CustomerNotFoundException.java
index f840e33..8ddb4e1 100644
--- a/services/customer/src/main/java/com/alibou/ecommerce/exception/CustomerNotFoundException.java
+++ b/services/customer/src/main/java/com/pramithamj/ecommerce/exception/CustomerNotFoundException.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.exception;
+package com.pramithamj.ecommerce.exception;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/services/customer/src/main/java/com/alibou/ecommerce/handler/ErrorResponse.java b/services/customer/src/main/java/com/pramithamj/ecommerce/handler/ErrorResponse.java
similarity index 72%
rename from services/customer/src/main/java/com/alibou/ecommerce/handler/ErrorResponse.java
rename to services/customer/src/main/java/com/pramithamj/ecommerce/handler/ErrorResponse.java
index d15146e..fe4c7be 100644
--- a/services/customer/src/main/java/com/alibou/ecommerce/handler/ErrorResponse.java
+++ b/services/customer/src/main/java/com/pramithamj/ecommerce/handler/ErrorResponse.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.handler;
+package com.pramithamj.ecommerce.handler;
import java.util.Map;
import java.util.Set;
diff --git a/services/customer/src/main/java/com/alibou/ecommerce/handler/GlobalExceptionHandler.java b/services/customer/src/main/java/com/pramithamj/ecommerce/handler/GlobalExceptionHandler.java
similarity index 92%
rename from services/customer/src/main/java/com/alibou/ecommerce/handler/GlobalExceptionHandler.java
rename to services/customer/src/main/java/com/pramithamj/ecommerce/handler/GlobalExceptionHandler.java
index 307c46e..bd2f061 100644
--- a/services/customer/src/main/java/com/alibou/ecommerce/handler/GlobalExceptionHandler.java
+++ b/services/customer/src/main/java/com/pramithamj/ecommerce/handler/GlobalExceptionHandler.java
@@ -1,6 +1,6 @@
-package com.alibou.ecommerce.handler;
+package com.pramithamj.ecommerce.handler;
-import com.alibou.ecommerce.exception.CustomerNotFoundException;
+import com.pramithamj.ecommerce.exception.CustomerNotFoundException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.FieldError;
diff --git a/services/customer/src/test/java/com/alibou/ecommerce/CustomerApplicationTests.java b/services/customer/src/test/java/com/pramithamj/ecommerce/CustomerApplicationTests.java
similarity index 84%
rename from services/customer/src/test/java/com/alibou/ecommerce/CustomerApplicationTests.java
rename to services/customer/src/test/java/com/pramithamj/ecommerce/CustomerApplicationTests.java
index 5a7fe9a..b4d7ff9 100644
--- a/services/customer/src/test/java/com/alibou/ecommerce/CustomerApplicationTests.java
+++ b/services/customer/src/test/java/com/pramithamj/ecommerce/CustomerApplicationTests.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce;
+package com.pramithamj.ecommerce;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
diff --git a/services/discovery/pom.xml b/services/discovery/pom.xml
index f0e1a82..47620a2 100644
--- a/services/discovery/pom.xml
+++ b/services/discovery/pom.xml
@@ -8,7 +8,7 @@
3.2.5
- com.alibou
+ com.pramithamj
discovery
0.0.1-SNAPSHOT
discovery
diff --git a/services/discovery/src/main/java/com/alibou/discovery/DiscoveryApplication.java b/services/discovery/src/main/java/com/pramithamj/discovery/DiscoveryApplication.java
similarity index 91%
rename from services/discovery/src/main/java/com/alibou/discovery/DiscoveryApplication.java
rename to services/discovery/src/main/java/com/pramithamj/discovery/DiscoveryApplication.java
index a003fce..dd178be 100644
--- a/services/discovery/src/main/java/com/alibou/discovery/DiscoveryApplication.java
+++ b/services/discovery/src/main/java/com/pramithamj/discovery/DiscoveryApplication.java
@@ -1,4 +1,4 @@
-package com.alibou.discovery;
+package com.pramithamj.discovery;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/services/discovery/src/test/java/com/alibou/discovery/DiscoveryApplicationTests.java b/services/discovery/src/test/java/com/pramithamj/discovery/DiscoveryApplicationTests.java
similarity index 84%
rename from services/discovery/src/test/java/com/alibou/discovery/DiscoveryApplicationTests.java
rename to services/discovery/src/test/java/com/pramithamj/discovery/DiscoveryApplicationTests.java
index 7db88e4..332fa80 100644
--- a/services/discovery/src/test/java/com/alibou/discovery/DiscoveryApplicationTests.java
+++ b/services/discovery/src/test/java/com/pramithamj/discovery/DiscoveryApplicationTests.java
@@ -1,4 +1,4 @@
-package com.alibou.discovery;
+package com.pramithamj.discovery;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
diff --git a/services/gateway/pom.xml b/services/gateway/pom.xml
index 4f92b62..c29b3d7 100644
--- a/services/gateway/pom.xml
+++ b/services/gateway/pom.xml
@@ -8,7 +8,7 @@
3.2.5
- com.alibou
+ com.pramithamj
gateway
0.0.1-SNAPSHOT
gateway
diff --git a/services/gateway/src/main/java/com/alibou/gateway/GatewayApplication.java b/services/gateway/src/main/java/com/pramithamj/gateway/GatewayApplication.java
similarity index 89%
rename from services/gateway/src/main/java/com/alibou/gateway/GatewayApplication.java
rename to services/gateway/src/main/java/com/pramithamj/gateway/GatewayApplication.java
index e0ad3bd..ff0c0b6 100644
--- a/services/gateway/src/main/java/com/alibou/gateway/GatewayApplication.java
+++ b/services/gateway/src/main/java/com/pramithamj/gateway/GatewayApplication.java
@@ -1,4 +1,4 @@
-package com.alibou.gateway;
+package com.pramithamj.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/services/gateway/src/test/java/com/alibou/gateway/GatewayApplicationTests.java b/services/gateway/src/test/java/com/pramithamj/gateway/GatewayApplicationTests.java
similarity index 85%
rename from services/gateway/src/test/java/com/alibou/gateway/GatewayApplicationTests.java
rename to services/gateway/src/test/java/com/pramithamj/gateway/GatewayApplicationTests.java
index 00d9745..eee21ef 100644
--- a/services/gateway/src/test/java/com/alibou/gateway/GatewayApplicationTests.java
+++ b/services/gateway/src/test/java/com/pramithamj/gateway/GatewayApplicationTests.java
@@ -1,4 +1,4 @@
-package com.alibou.gateway;
+package com.pramithamj.gateway;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
diff --git a/services/notification/pom.xml b/services/notification/pom.xml
index 4c10e92..93e0f0d 100644
--- a/services/notification/pom.xml
+++ b/services/notification/pom.xml
@@ -8,7 +8,7 @@
3.2.5
- com.alibou
+ com.pramithamj
notification
0.0.1-SNAPSHOT
notification
diff --git a/services/notification/src/main/java/com/alibou/ecommerce/NotificationApplication.java b/services/notification/src/main/java/com/pramithamj/ecommerce/NotificationApplication.java
similarity index 89%
rename from services/notification/src/main/java/com/alibou/ecommerce/NotificationApplication.java
rename to services/notification/src/main/java/com/pramithamj/ecommerce/NotificationApplication.java
index 4b4295b..8d3202b 100644
--- a/services/notification/src/main/java/com/alibou/ecommerce/NotificationApplication.java
+++ b/services/notification/src/main/java/com/pramithamj/ecommerce/NotificationApplication.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce;
+package com.pramithamj.ecommerce;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/services/notification/src/main/java/com/alibou/ecommerce/email/EmailService.java b/services/notification/src/main/java/com/pramithamj/ecommerce/email/EmailService.java
similarity index 90%
rename from services/notification/src/main/java/com/alibou/ecommerce/email/EmailService.java
rename to services/notification/src/main/java/com/pramithamj/ecommerce/email/EmailService.java
index d42efa2..9a1b246 100644
--- a/services/notification/src/main/java/com/alibou/ecommerce/email/EmailService.java
+++ b/services/notification/src/main/java/com/pramithamj/ecommerce/email/EmailService.java
@@ -1,6 +1,6 @@
-package com.alibou.ecommerce.email;
+package com.pramithamj.ecommerce.email;
-import com.alibou.ecommerce.kafka.order.Product;
+import com.pramithamj.ecommerce.kafka.order.Product;
import jakarta.mail.MessagingException;
import jakarta.mail.internet.MimeMessage;
import lombok.RequiredArgsConstructor;
@@ -17,8 +17,8 @@
import java.util.List;
import java.util.Map;
-import static com.alibou.ecommerce.email.EmailTemplates.ORDER_CONFIRMATION;
-import static com.alibou.ecommerce.email.EmailTemplates.PAYMENT_CONFIRMATION;
+import static com.pramithamj.ecommerce.email.EmailTemplates.ORDER_CONFIRMATION;
+import static com.pramithamj.ecommerce.email.EmailTemplates.PAYMENT_CONFIRMATION;
import static java.nio.charset.StandardCharsets.UTF_8;
@Service
@@ -39,7 +39,7 @@ public void sendPaymentSuccessEmail(
MimeMessage mimeMessage = mailSender.createMimeMessage();
MimeMessageHelper messageHelper = new MimeMessageHelper(mimeMessage, MimeMessageHelper.MULTIPART_MODE_MIXED_RELATED, UTF_8.name());
- messageHelper.setFrom("contact@aliboucoding.com");
+ messageHelper.setFrom("contact@pramithamj.com");
final String templateName = PAYMENT_CONFIRMATION.getTemplate();
@@ -76,7 +76,7 @@ public void sendOrderConfirmationEmail(
MimeMessage mimeMessage = mailSender.createMimeMessage();
MimeMessageHelper messageHelper = new MimeMessageHelper(mimeMessage, MimeMessageHelper.MULTIPART_MODE_MIXED_RELATED, UTF_8.name());
- messageHelper.setFrom("contact@aliboucoding.com");
+ messageHelper.setFrom("contact@pramithamj.com");
final String templateName = ORDER_CONFIRMATION.getTemplate();
diff --git a/services/notification/src/main/java/com/alibou/ecommerce/email/EmailTemplates.java b/services/notification/src/main/java/com/pramithamj/ecommerce/email/EmailTemplates.java
similarity index 91%
rename from services/notification/src/main/java/com/alibou/ecommerce/email/EmailTemplates.java
rename to services/notification/src/main/java/com/pramithamj/ecommerce/email/EmailTemplates.java
index 0d74079..374dc7f 100644
--- a/services/notification/src/main/java/com/alibou/ecommerce/email/EmailTemplates.java
+++ b/services/notification/src/main/java/com/pramithamj/ecommerce/email/EmailTemplates.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.email;
+package com.pramithamj.ecommerce.email;
import lombok.Getter;
diff --git a/services/notification/src/main/java/com/alibou/ecommerce/kafka/NotificationsConsumer.java b/services/notification/src/main/java/com/pramithamj/ecommerce/kafka/NotificationsConsumer.java
similarity index 81%
rename from services/notification/src/main/java/com/alibou/ecommerce/kafka/NotificationsConsumer.java
rename to services/notification/src/main/java/com/pramithamj/ecommerce/kafka/NotificationsConsumer.java
index 0413045..5a8f8df 100644
--- a/services/notification/src/main/java/com/alibou/ecommerce/kafka/NotificationsConsumer.java
+++ b/services/notification/src/main/java/com/pramithamj/ecommerce/kafka/NotificationsConsumer.java
@@ -1,10 +1,10 @@
-package com.alibou.ecommerce.kafka;
+package com.pramithamj.ecommerce.kafka;
-import com.alibou.ecommerce.email.EmailService;
-import com.alibou.ecommerce.kafka.order.OrderConfirmation;
-import com.alibou.ecommerce.kafka.payment.PaymentConfirmation;
-import com.alibou.ecommerce.notification.Notification;
-import com.alibou.ecommerce.notification.NotificationRepository;
+import com.pramithamj.ecommerce.email.EmailService;
+import com.pramithamj.ecommerce.kafka.order.OrderConfirmation;
+import com.pramithamj.ecommerce.kafka.payment.PaymentConfirmation;
+import com.pramithamj.ecommerce.notification.Notification;
+import com.pramithamj.ecommerce.notification.NotificationRepository;
import jakarta.mail.MessagingException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -13,8 +13,8 @@
import java.time.LocalDateTime;
-import static com.alibou.ecommerce.notification.NotificationType.ORDER_CONFIRMATION;
-import static com.alibou.ecommerce.notification.NotificationType.PAYMENT_CONFIRMATION;
+import static com.pramithamj.ecommerce.notification.NotificationType.ORDER_CONFIRMATION;
+import static com.pramithamj.ecommerce.notification.NotificationType.PAYMENT_CONFIRMATION;
import static java.lang.String.format;
@Service
diff --git a/services/notification/src/main/java/com/alibou/ecommerce/kafka/order/Customer.java b/services/notification/src/main/java/com/pramithamj/ecommerce/kafka/order/Customer.java
similarity index 69%
rename from services/notification/src/main/java/com/alibou/ecommerce/kafka/order/Customer.java
rename to services/notification/src/main/java/com/pramithamj/ecommerce/kafka/order/Customer.java
index 8bb1b8c..8963f9a 100644
--- a/services/notification/src/main/java/com/alibou/ecommerce/kafka/order/Customer.java
+++ b/services/notification/src/main/java/com/pramithamj/ecommerce/kafka/order/Customer.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.kafka.order;
+package com.pramithamj.ecommerce.kafka.order;
public record Customer(
String id,
diff --git a/services/notification/src/main/java/com/alibou/ecommerce/kafka/order/OrderConfirmation.java b/services/notification/src/main/java/com/pramithamj/ecommerce/kafka/order/OrderConfirmation.java
similarity index 70%
rename from services/notification/src/main/java/com/alibou/ecommerce/kafka/order/OrderConfirmation.java
rename to services/notification/src/main/java/com/pramithamj/ecommerce/kafka/order/OrderConfirmation.java
index 523bf75..e342db7 100644
--- a/services/notification/src/main/java/com/alibou/ecommerce/kafka/order/OrderConfirmation.java
+++ b/services/notification/src/main/java/com/pramithamj/ecommerce/kafka/order/OrderConfirmation.java
@@ -1,6 +1,6 @@
-package com.alibou.ecommerce.kafka.order;
+package com.pramithamj.ecommerce.kafka.order;
-import com.alibou.ecommerce.kafka.payment.PaymentMethod;
+import com.pramithamj.ecommerce.kafka.payment.PaymentMethod;
import java.math.BigDecimal;
import java.util.List;
diff --git a/services/notification/src/main/java/com/alibou/ecommerce/kafka/order/Product.java b/services/notification/src/main/java/com/pramithamj/ecommerce/kafka/order/Product.java
similarity index 80%
rename from services/notification/src/main/java/com/alibou/ecommerce/kafka/order/Product.java
rename to services/notification/src/main/java/com/pramithamj/ecommerce/kafka/order/Product.java
index 7d7525b..b3ad7dd 100644
--- a/services/notification/src/main/java/com/alibou/ecommerce/kafka/order/Product.java
+++ b/services/notification/src/main/java/com/pramithamj/ecommerce/kafka/order/Product.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.kafka.order;
+package com.pramithamj.ecommerce.kafka.order;
import java.math.BigDecimal;
diff --git a/services/notification/src/main/java/com/alibou/ecommerce/kafka/payment/PaymentConfirmation.java b/services/notification/src/main/java/com/pramithamj/ecommerce/kafka/payment/PaymentConfirmation.java
similarity index 84%
rename from services/notification/src/main/java/com/alibou/ecommerce/kafka/payment/PaymentConfirmation.java
rename to services/notification/src/main/java/com/pramithamj/ecommerce/kafka/payment/PaymentConfirmation.java
index 1855d7b..81b87c2 100644
--- a/services/notification/src/main/java/com/alibou/ecommerce/kafka/payment/PaymentConfirmation.java
+++ b/services/notification/src/main/java/com/pramithamj/ecommerce/kafka/payment/PaymentConfirmation.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.kafka.payment;
+package com.pramithamj.ecommerce.kafka.payment;
import java.math.BigDecimal;
diff --git a/services/notification/src/main/java/com/alibou/ecommerce/kafka/payment/PaymentMethod.java b/services/notification/src/main/java/com/pramithamj/ecommerce/kafka/payment/PaymentMethod.java
similarity index 65%
rename from services/notification/src/main/java/com/alibou/ecommerce/kafka/payment/PaymentMethod.java
rename to services/notification/src/main/java/com/pramithamj/ecommerce/kafka/payment/PaymentMethod.java
index 4abffea..9a94f40 100644
--- a/services/notification/src/main/java/com/alibou/ecommerce/kafka/payment/PaymentMethod.java
+++ b/services/notification/src/main/java/com/pramithamj/ecommerce/kafka/payment/PaymentMethod.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.kafka.payment;
+package com.pramithamj.ecommerce.kafka.payment;
public enum PaymentMethod {
diff --git a/services/notification/src/main/java/com/alibou/ecommerce/notification/Notification.java b/services/notification/src/main/java/com/pramithamj/ecommerce/notification/Notification.java
similarity index 77%
rename from services/notification/src/main/java/com/alibou/ecommerce/notification/Notification.java
rename to services/notification/src/main/java/com/pramithamj/ecommerce/notification/Notification.java
index c1cbc09..13e24e0 100644
--- a/services/notification/src/main/java/com/alibou/ecommerce/notification/Notification.java
+++ b/services/notification/src/main/java/com/pramithamj/ecommerce/notification/Notification.java
@@ -1,7 +1,7 @@
-package com.alibou.ecommerce.notification;
+package com.pramithamj.ecommerce.notification;
-import com.alibou.ecommerce.kafka.order.OrderConfirmation;
-import com.alibou.ecommerce.kafka.payment.PaymentConfirmation;
+import com.pramithamj.ecommerce.kafka.order.OrderConfirmation;
+import com.pramithamj.ecommerce.kafka.payment.PaymentConfirmation;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
diff --git a/services/notification/src/main/java/com/alibou/ecommerce/notification/NotificationRepository.java b/services/notification/src/main/java/com/pramithamj/ecommerce/notification/NotificationRepository.java
similarity index 77%
rename from services/notification/src/main/java/com/alibou/ecommerce/notification/NotificationRepository.java
rename to services/notification/src/main/java/com/pramithamj/ecommerce/notification/NotificationRepository.java
index c560f6a..45ad5c3 100644
--- a/services/notification/src/main/java/com/alibou/ecommerce/notification/NotificationRepository.java
+++ b/services/notification/src/main/java/com/pramithamj/ecommerce/notification/NotificationRepository.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.notification;
+package com.pramithamj.ecommerce.notification;
import org.springframework.data.mongodb.repository.MongoRepository;
diff --git a/services/notification/src/main/java/com/alibou/ecommerce/notification/NotificationType.java b/services/notification/src/main/java/com/pramithamj/ecommerce/notification/NotificationType.java
similarity index 63%
rename from services/notification/src/main/java/com/alibou/ecommerce/notification/NotificationType.java
rename to services/notification/src/main/java/com/pramithamj/ecommerce/notification/NotificationType.java
index 0b1d546..c009978 100644
--- a/services/notification/src/main/java/com/alibou/ecommerce/notification/NotificationType.java
+++ b/services/notification/src/main/java/com/pramithamj/ecommerce/notification/NotificationType.java
@@ -1,4 +1,4 @@
-package com.alibou.ecommerce.notification;
+package com.pramithamj.ecommerce.notification;
public enum NotificationType {
ORDER_CONFIRMATION,
diff --git a/services/notification/src/main/resources/templates/order-confirmation.html b/services/notification/src/main/resources/templates/order-confirmation.html
index 72f6e3b..f49ea0f 100644
--- a/services/notification/src/main/resources/templates/order-confirmation.html
+++ b/services/notification/src/main/resources/templates/order-confirmation.html
@@ -80,7 +80,7 @@ Order Details