# TaskFlow Deployment Guide ## Environments | Environment | URL | Database | Redis | |-------------|-----|----------|-------| | Development | localhost:3000 | localhost:5432 | localhost:6379 | | Staging | staging-api.taskflow.internal | staging-db.internal | staging-redis.internal | | Production | api.taskflow.example.com | prod-db.internal | prod-redis.internal | ## Local Development ```bash # Start dependencies cd docker && docker-compose up -d # Run migrations npm run migrate # Start dev server npm run dev ``` ## Docker Deployment ### Build Image ```bash docker build -t taskflow-api:latest -f docker/Dockerfile . ``` ### Run Container ```bash docker run -d \ --name taskflow-api \ -p 3000:3000 \ -e NODE_ENV=production \ -e DB_HOST=your-db-host \ -e DB_PASSWORD=your-db-password \ -e JWT_SECRET=your-jwt-secret \ -e REDIS_HOST=your-redis-host \ taskflow-api:latest ``` ## Kubernetes Deployment ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: taskflow-api labels: app: taskflow-api spec: replicas: 3 selector: matchLabels: app: taskflow-api template: metadata: labels: app: taskflow-api spec: containers: - name: taskflow-api image: registry.internal/taskflow-api:latest ports: - containerPort: 3000 resources: requests: memory: "256Mi" cpu: "200m" limits: memory: "512Mi" cpu: "500m" livenessProbe: httpGet: path: /api/v1/health port: 3000 initialDelaySeconds: 15 periodSeconds: 30 readinessProbe: httpGet: path: /api/v1/health port: 3000 initialDelaySeconds: 5 periodSeconds: 10 envFrom: - secretRef: name: taskflow-api-secrets - configMapRef: name: taskflow-api-config ``` ## CI/CD Pipeline ```mermaid graph LR Push[Git Push] --> Lint[Lint & Type Check] Lint --> Test[Run Tests] Test --> Build[Docker Build] Build --> Push[Push Image] Push --> Deploy[Deploy to K8s] ``` ## Monitoring - **Health Check**: `GET /api/v1/health` - **Logs**: Structured JSON via Winston, shipped to ELK stack - **Metrics**: Planned Prometheus metrics endpoint - **Alerts**: PagerDuty integration for 5xx rate > 1%