Skip to content

hungpt99-dev/java-microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Front-Office Microservices System

🚀 Tổng quan hệ thống

Hệ thống Front-Office được xây dựng với kiến trúc microservices hiện đại, sử dụng các công nghệ tiên tiến nhất:

  • Backend: Java 21 + Quarkus + Project Loom + GraalVM
  • Orchestration: Axon Framework cho Saga pattern
  • Communication: gRPC cho inter-service communication
  • Event Streaming: Kafka + Debezium CDC
  • Caching: Redis
  • Database: PostgreSQL với Event Sourcing
  • Storage: MinIO
  • Container: Docker + Kubernetes
  • Monitoring: Prometheus + Grafana + Loki + Jaeger

📁 Cấu trúc dự án

Front-Office/
├── services/                    # Microservices
│   ├── orchestrator/           ✅ Saga Orchestrator với Axon Framework
│   ├── booking/               ✅ Booking Service (CQRS + Event Sourcing)
│   ├── ticket/                ✅ Ticket Service với gRPC
│   ├── auth/                  ⏳ Authentication Service
│   ├── payment/               ⏳ Payment Service
│   ├── notification/          ⏳ Notification Service
│   ├── file/                  ⏳ File Service
│   └── bff/                   ⏳ Backend-for-Frontend (NodeJS)
├── infrastructure/            ✅ Infrastructure services
│   ├── kafka/                 ✅ Kafka cluster
│   ├── redis/                 ✅ Redis cluster
│   ├── postgres/              ✅ PostgreSQL cluster
│   ├── minio/                 ✅ MinIO storage
│   └── monitoring/            ✅ Monitoring stack
├── k8s/                      ✅ Kubernetes configurations
│   ├── namespaces/           ✅ Namespace definitions
│   ├── services/             ✅ Service definitions
│   ├── deployments/          ✅ Deployment configurations
│   ├── configmaps/           ✅ ConfigMaps
│   ├── secrets/              ✅ Secrets
│   └── ingress/              ✅ Ingress configurations
├── helm/                     ✅ Helm charts
├── docker/                   ✅ Docker configurations
├── scripts/                  ✅ Utility scripts
└── docs/                     ⏳ Documentation

🏗️ Các microservices chính

1. Orchestrator Service ✅

  • Công nghệ: Java 21 + Quarkus + Axon Framework
  • Chức năng: Quản lý Saga workflow, giao tiếp gRPC
  • Port: 8080 (HTTP), 9090 (gRPC)
  • Tính năng: Saga pattern, compensation, event sourcing

2. Booking Service ✅

  • Công nghệ: Java 21 + Quarkus + PostgreSQL + Kafka
  • Chức năng: CQRS + Event Sourcing cho booking
  • Port: 8081 (HTTP), 9091 (gRPC)
  • Tính năng: Command/Query separation, event store, projections

3. Ticket Service ✅

  • Công nghệ: Java 21 + Quarkus + PostgreSQL + Kafka
  • Chức năng: Quản lý tickets, giao tiếp gRPC
  • Port: 8082 (HTTP), 9092 (gRPC)
  • Tính năng: Ticket reservation, validation, status management

4. Authentication Service ⏳

  • Công nghệ: Keycloak hoặc custom OAuth2
  • Chức năng: Authentication, Authorization, RBAC/ABAC
  • Port: 8083 (HTTP)

5. Payment Service ⏳

  • Công nghệ: Java 21 + Quarkus + PostgreSQL + Kafka
  • Chức năng: Xử lý thanh toán
  • Port: 8084 (HTTP), 9094 (gRPC)

6. BFF Service ⏳

  • Công nghệ: NodeJS + Fastify + GraphQL
  • Chức năng: Backend-for-Frontend, gRPC client
  • Port: 8085 (HTTP)

🚀 Chạy hệ thống

Prerequisites

  • Java 21+
  • Node.js 18+
  • Docker & Docker Compose
  • Kubernetes cluster (minikube, kind, hoặc cloud)
  • Helm 3+

Development Environment

# Start infrastructure services
.\scripts\start-dev.ps1 -Infrastructure

# Start all services
.\scripts\start-dev.ps1 -All

# Stop development environment
.\scripts\start-dev.ps1 -Stop

Build All Services

# Build all services
.\scripts\build-all.ps1

# Build with native images
.\scripts\build-all.ps1 -Native

# Build and push to registry
.\scripts\build-all.ps1 -Push -Registry "your-registry.com"

Production Deployment (Kubernetes)

# Deploy to development
.\scripts\deploy.ps1 -Environment dev -All

# Deploy to staging
.\scripts\deploy.ps1 -Environment staging -All

# Deploy to production
.\scripts\deploy.ps1 -Environment prod -All

# Dry run deployment
.\scripts\deploy.ps1 -Environment dev -All -DryRun

Manual Docker Compose

# Start infrastructure
docker-compose -f infrastructure/docker-compose.yml up -d

# Start individual services
cd services/orchestrator && docker-compose up -d
cd services/booking && docker-compose up -d
cd services/ticket && docker-compose up -d

📊 Monitoring & Observability

  • Metrics: Prometheus + Grafana
  • Logging: Loki + Grafana
  • Tracing: Jaeger
  • Health Checks: Quarkus Health + Kubernetes probes
  • APM: Elasticsearch + Kibana

Access URLs (Development)

🔒 Security

  • Authentication: OAuth2 + JWT
  • Authorization: RBAC/ABAC
  • Network: TLS, mTLS cho gRPC
  • Secrets: Kubernetes Secrets + Vault (optional)
  • Network Policies: Kubernetes Network Policies

⚡ Performance

  • Caching: Redis cluster
  • Async Processing: Project Loom + Reactive
  • Auto-scaling: Kubernetes HPA
  • Load Balancing: Ingress Controller
  • Native Images: GraalVM native compilation

🏛️ Architecture Patterns

  • Saga Pattern: Distributed transaction management
  • CQRS: Command Query Responsibility Segregation
  • Event Sourcing: Event-driven architecture
  • Domain-Driven Design: Bounded contexts
  • Microservices: Service decomposition
  • API Gateway: Centralized routing and security

📈 Scalability Features

  • Horizontal Pod Autoscaling: CPU/Memory based scaling
  • Kafka Partitioning: Event stream partitioning
  • Database Sharding: Horizontal database scaling
  • Redis Clustering: Distributed caching
  • Load Balancing: Multiple load balancing strategies

🛠️ Development Tools

  • Build Scripts: PowerShell automation scripts
  • Docker: Multi-stage builds, native images
  • Helm: Kubernetes package management
  • GitLab CI/CD: Automated deployment pipelines
  • Monitoring: Comprehensive observability stack

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published