Deployment
Learn how to deploy Pillow to production environments with Docker, Kubernetes, and cloud platforms.
Overview
Section titled “Overview”Pillow supports multiple deployment strategies:
- Docker Compose for simple deployments
- Kubernetes for scalable production deployments
- Cloud platforms (AWS, GCP, Azure)
- Traditional server deployments
Docker Deployment
Section titled “Docker Deployment”Production Docker Compose
Section titled “Production Docker Compose”version: "3.8"services: mill: image: pillow/mill:latest environment: - NODE_ENV=production - DATABASE_URL=${DATABASE_URL} ports: - "4000:4000" depends_on: - postgres - redis
redis: image: redis:7-alpine ports: - "6379:6379" volumes: - redis_data:/data
redpanda: image: docker.redpanda.com/redpandadata/redpanda:latest ports: - "19092:19092" volumes: - redpanda_data:/var/lib/redpanda/data
volumes: redis_data: redpanda_data:# Note: Database (Apache Doris) is hosted remotely at db.voltdata.io# Configure connection in mill/config/.envDeploy with Docker Compose
Section titled “Deploy with Docker Compose”# Set environment variablesexport DATABASE_HOST=db.voltdata.ioexport DATABASE_PORT=9030export DATABASE_USER=your_userexport DATABASE_PASSWORD=secure_passwordexport DATABASE_NAME=mill
# Deploydocker-compose -f docker-compose.prod.yml up -dNote: Database is hosted remotely. Configure connection in mill/config/.env or via environment variables.
Kubernetes Deployment
Section titled “Kubernetes Deployment”Basic Kubernetes Setup
Section titled “Basic Kubernetes Setup”apiVersion: apps/v1kind: Deploymentmetadata: name: pillow-millspec: replicas: 3 selector: matchLabels: app: pillow-mill template: metadata: labels: app: pillow-mill spec: containers: - name: mill image: pillow/mill:latest ports: - containerPort: 4000 env: - name: DATABASE_URL valueFrom: secretKeyRef: name: pillow-secrets key: database-url---apiVersion: v1kind: Servicemetadata: name: pillow-mill-servicespec: selector: app: pillow-mill ports: - protocol: TCP port: 80 targetPort: 4000 type: LoadBalancerCloud Deployments
Section titled “Cloud Deployments”AWS Deployment
Section titled “AWS Deployment”Deploy using AWS ECS or EKS:
# Using AWS CLI and ECSaws ecs create-cluster --cluster-name pillowaws ecs create-service --cluster pillow --service-name pillow-millGoogle Cloud Platform
Section titled “Google Cloud Platform”Deploy using Cloud Run or GKE:
# Using gcloud CLIgcloud run deploy pillow-mill --image gcr.io/PROJECT_ID/pillow-millDeploy using Container Instances or AKS:
# Using Azure CLIaz container create --resource-group pillow-rg --name pillow-mill --image pillow/mill:latestEnvironment Configuration
Section titled “Environment Configuration”Production Environment Variables
Section titled “Production Environment Variables”NODE_ENV=productionDATABASE_HOST=db.voltdata.ioDATABASE_PORT=9030DATABASE_USER=your_userDATABASE_PASSWORD=your_secure_passwordDATABASE_NAME=millREDIS_URL=redis://host:6379JWT_SECRET=your-super-secure-secretAPI_PORT=4000LOG_LEVEL=infoENABLE_METRICS=trueSecurity Considerations
Section titled “Security Considerations”- Use secrets management (AWS Secrets Manager, K8s Secrets)
- Enable HTTPS with SSL certificates
- Configure proper firewall rules
- Set up monitoring and alerting
- Regular security updates
Monitoring & Observability
Section titled “Monitoring & Observability”Health Checks
Section titled “Health Checks”# Container health checkHEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD curl -f http://localhost:4000/health || exit 1Monitoring Setup
Section titled “Monitoring Setup”- Prometheus: Metrics collection
- Grafana: Visualization and dashboards
- Jaeger: Distributed tracing
- ELK Stack: Log aggregation and analysis
Scaling Strategies
Section titled “Scaling Strategies”Horizontal Scaling
Section titled “Horizontal Scaling”- Load balancer configuration
- Auto-scaling policies
- Database read replicas
- CDN for static assets
Performance Optimization
Section titled “Performance Optimization”- Database connection pooling
- Redis caching strategies
- Image optimization
- CDN configuration
Backup & Recovery
Section titled “Backup & Recovery”Database Backups
Section titled “Database Backups”# Apache Doris backup (MySQL-compatible)mysqldump -h db.voltdata.io -P 9030 -u your_user -p mill > backup_$(date +%Y%m%d_%H%M%S).sql
# Or use Doris-specific backup tools if availableDisaster Recovery
Section titled “Disaster Recovery”- Multi-region deployments
- Data replication strategies
- Recovery time objectives (RTO)
- Recovery point objectives (RPO)
Next Steps
Section titled “Next Steps”- Configuration - Environment setup
- Monitoring - Observability and alerting
- Security - Production security practices