152 lines
2.4 KiB
Markdown
152 lines
2.4 KiB
Markdown
|
|
# Deployment Runbook
|
||
|
|
|
||
|
|
## Overview
|
||
|
|
This document provides step-by-step procedures for deploying the ISO-20022 Combo Flow system to production.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Prerequisites
|
||
|
|
|
||
|
|
- Docker and Docker Compose installed
|
||
|
|
- Kubernetes cluster (for production)
|
||
|
|
- PostgreSQL database
|
||
|
|
- Redis instance
|
||
|
|
- Domain name and SSL certificates
|
||
|
|
- Environment variables configured
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Local Development Deployment
|
||
|
|
|
||
|
|
### Using Docker Compose
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Start all services
|
||
|
|
docker-compose up -d
|
||
|
|
|
||
|
|
# View logs
|
||
|
|
docker-compose logs -f
|
||
|
|
|
||
|
|
# Stop services
|
||
|
|
docker-compose down
|
||
|
|
```
|
||
|
|
|
||
|
|
### Manual Setup
|
||
|
|
|
||
|
|
1. **Database Setup**
|
||
|
|
```bash
|
||
|
|
cd orchestrator
|
||
|
|
npm install
|
||
|
|
npm run migrate
|
||
|
|
```
|
||
|
|
|
||
|
|
2. **Start Orchestrator**
|
||
|
|
```bash
|
||
|
|
cd orchestrator
|
||
|
|
npm run dev
|
||
|
|
```
|
||
|
|
|
||
|
|
3. **Start Frontend**
|
||
|
|
```bash
|
||
|
|
cd webapp
|
||
|
|
npm install
|
||
|
|
npm run dev
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Production Deployment
|
||
|
|
|
||
|
|
### Step 1: Database Migration
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Connect to production database
|
||
|
|
export DATABASE_URL="postgresql://user:pass@db-host:5432/comboflow"
|
||
|
|
|
||
|
|
# Run migrations
|
||
|
|
cd orchestrator
|
||
|
|
npm run migrate
|
||
|
|
```
|
||
|
|
|
||
|
|
### Step 2: Build Docker Images
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Build orchestrator
|
||
|
|
docker build -t orchestrator:latest -f Dockerfile .
|
||
|
|
|
||
|
|
# Build webapp
|
||
|
|
docker build -t webapp:latest -f webapp/Dockerfile ./webapp
|
||
|
|
```
|
||
|
|
|
||
|
|
### Step 3: Deploy to Kubernetes
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Apply configurations
|
||
|
|
kubectl apply -f k8s/deployment.yaml
|
||
|
|
kubectl apply -f k8s/webapp-deployment.yaml
|
||
|
|
|
||
|
|
# Check status
|
||
|
|
kubectl get pods
|
||
|
|
kubectl get services
|
||
|
|
```
|
||
|
|
|
||
|
|
### Step 4: Verify Deployment
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Check health endpoints
|
||
|
|
curl https://api.example.com/health
|
||
|
|
curl https://api.example.com/ready
|
||
|
|
curl https://api.example.com/metrics
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Rollback Procedure
|
||
|
|
|
||
|
|
### Quick Rollback
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Rollback to previous deployment
|
||
|
|
kubectl rollout undo deployment/orchestrator
|
||
|
|
kubectl rollout undo deployment/webapp
|
||
|
|
```
|
||
|
|
|
||
|
|
### Database Rollback
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Restore from backup
|
||
|
|
pg_restore -d comboflow backup.dump
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Monitoring
|
||
|
|
|
||
|
|
- Health checks: `/health`, `/ready`, `/live`
|
||
|
|
- Metrics: `/metrics` (Prometheus format)
|
||
|
|
- Logs: Check Kubernetes logs or Docker logs
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Troubleshooting
|
||
|
|
|
||
|
|
### Service Won't Start
|
||
|
|
1. Check environment variables
|
||
|
|
2. Verify database connectivity
|
||
|
|
3. Check logs: `kubectl logs <pod-name>`
|
||
|
|
|
||
|
|
### Database Connection Issues
|
||
|
|
1. Verify DATABASE_URL
|
||
|
|
2. Check network connectivity
|
||
|
|
3. Verify database credentials
|
||
|
|
|
||
|
|
### Performance Issues
|
||
|
|
1. Check metrics endpoint
|
||
|
|
2. Review database query performance
|
||
|
|
3. Check Redis connectivity
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**Last Updated**: 2025-01-15
|
||
|
|
|