Hướng dẫn triển khai

Hướng dẫn triển khai

Hệ thống được triển khai trên Kubernetes với Docker containers.

Yêu cầu

  • Docker & Docker Compose
  • Kubernetes cluster (min 3 nodes)
  • PostgreSQL 16
  • Redis 7
  • Node.js 20 (cho development)

Môi trường development

# Clone repo
git clone https://github.com/trading-platform/Scaner_V2.git
cd Scaner_V2
# Cài đặt dependencies
npm install
# Setup database
npm run db:migrate
npm run db:seed
# Chạy development
npm run dev

Docker Compose

# Build và chạy
npm run docker:dev
# Kiểm tra
docker-compose -f docker/docker-compose.dev.yml ps

Triển khai Kubernetes

# Tạo namespace
kubectl apply -f k8s/namespaces/
# Deploy configmaps và secrets
kubectl apply -f k8s/configmaps/
kubectl apply -f k8s/secrets/
# Deploy services
kubectl apply -f k8s/services/
# Deploy applications
kubectl apply -f k8s/deployments/
# Cấu hình ingress
kubectl apply -f k8s/ingress/
# Auto-scaling
kubectl apply -f k8s/hpa/

CI/CD Pipeline

GitHub Actions tự động:

  1. Push → develop: Build, test, deploy staging
  2. Push → main: Build, test, deploy production
  3. Tag v..: Build production image, deploy với Helm

Monitoring

  • Prometheus: Thu thập metrics
  • Grafana: Dashboard monitoring
  • Sentry: Error tracking
  • Loki: Log aggregation
  • AlertManager: Cảnh báo khi có sự cố