Microservices demo dengan Product, Order, dan Notification services menggunakan Docker Compose dan Kubernetes.
- Docker & Docker Compose
- Make (optional, untuk perintah yang lebih singkat)
- Node.js 18+ (untuk development lokal)
# Setup lengkap (install dependencies, build, start, init DB, check health)
make dev
# Atau step by step:
make install # Install dependencies
make build # Build Docker images
make up # Start semua services
make init-db # Initialize database
make health # Check service health# Install dependencies
npm install (di setiap service directory)
# Build dan start
docker compose up --build -d
# Initialize database
docker compose exec mysql mysql -uroot -proot productdb < scripts/init-db.sql
# Check health
curl http://localhost:4020/healthJalankan make help atau make untuk melihat semua perintah yang tersedia.
| Command | Description |
|---|---|
make dev |
π Full setup (install, build, start, init db, health check) |
make quick-start |
β‘ Quick start (build, start, init db) |
make up |
|
make down |
βΉοΈ Stop semua services |
make restart |
π Restart semua services |
make logs |
π View logs semua services |
make health |
β€οΈ Check health semua services |
make status |
π Show container status |
make test |
β Run tests semua services |
make clean |
π§Ή Remove containers, volumes, images |
# Development
make install # Install dependencies
make build # Build Docker images
make dev # Full development setup
# Service Management
make up # Start services
make down # Stop services
make restart # Restart services
make status # Container status
# Logs
make logs # All services
make logs-product # Product service only
make logs-order # Order service only
make logs-notification # Notification service only
# Testing & Quality
make test # Run all tests
make test-product # Test product-service
make lint # Run linter
# Database
make init-db # Initialize database schema
make shell-mysql # MySQL shell
make shell-mongo # MongoDB shell
# Utilities
make health # Health check all services
make shell-product # Shell into product-service
make clean # Remove everything
make clean-volumes # Remove volumes onlySetelah services running, akses:
- Product Service: http://localhost:4020
- Health: http://localhost:4020/health
- Products: http://localhost:4020/products
- Order Service: http://localhost:4030
- Health: http://localhost:4030/health
- Orders: http://localhost:4030/orders
- Notification Service: http://localhost:4010
- Health: http://localhost:4010/health
- RabbitMQ Management UI: http://localhost:15672
- Username:
admin - Password:
admin
- Username:
.
βββ product-service/ # Product microservice (MySQL)
βββ order-service/ # Order microservice (MongoDB + RabbitMQ)
βββ notification-service/ # Notification service (RabbitMQ consumer)
βββ docker-compose.yml # Local development setup
βββ k8s/ # Kubernetes manifests
βββ helm/ # Helm charts
βββ scripts/ # Deployment scripts
βββ .github/workflows/ # CI/CD pipelines
βββ Makefile # Make commands untuk development
make test # Run semua tests
make test-product # Test product-service saja
make lint # Run lintermake logs # Semua services
make logs-product # Product service saja
make shell-mysql # MySQL shell
make shell-mongo # MongoDB shellmake down # Stop services
make clean # Remove semua (containers, volumes, images)
make clean-volumes # Remove volumes sajaSet repository secrets di GitHub:
REGISTRY- Container registry URLREGISTRY_USERNAME- Registry usernameREGISTRY_PASSWORD- Registry passwordIMAGE_PREFIX- Image prefix/namespaceKUBECONFIG_STAGING- Base64 kubeconfig untuk stagingKUBECONFIG_PRODUCTION- Base64 kubeconfig untuk production
- Push to
developβ Deploy ke staging environment - Push to
mainβ Canary release ke production (10% β 100%)
Lihat docs/CI-CD.md untuk dokumentasi lengkap.
# Deploy menggunakan manifests
kubectl apply -f k8s/
# Atau menggunakan Helm
helm install micro-demo ./helm/micro-demo \
--set product.image=your-registry/product-service \
--set order.image=your-registry/order-service \
--set notification.image=your-registry/notification-service- Secrets Management - Setup GitHub Secrets dan registry configuration
- Environment Variables - Environment configuration
- Documentation Index - Index semua dokumentasi
- CI/CD Pipeline - Detail lengkap CI/CD workflow
- Deployment Guide - Deployment strategies dan rollback procedures
- Monitoring & Troubleshooting - Setup monitoring dan troubleshooting
- Security Hardening - Security best practices
- Backup & Disaster Recovery - Backup strategy dan DR procedures
- Troubleshooting Guide - Common issues dan solutions
- β Multi-stage Docker builds
- β Health checks & graceful shutdown
- β Structured logging (Winston)
- β Request validation & rate limiting
- β Connection retry logic
- β Canary deployment strategy
- β Security scanning (Trivy)
- β Test coverage reporting
- β Resource limits & monitoring
make status # Check container status
make logs # Check logs untuk error
make health # Check health endpointsmake shell-mysql # Test MySQL connection
make init-db # Re-initialize databaseEdit docker-compose.yml atau buat file .env untuk override ports.
MIT