Deployment Guide
Deploy Pestle to production with confidence using these guides for various environments.
Deployment Options
1. Docker Compose (Recommended for Small Teams)
Simplest production deployment for teams up to 50 users.
Prerequisites
- Linux server (Ubuntu 22.04 recommended)
- Docker 20.10+ and Docker Compose 2.0+
- Domain name with DNS configured
- SSL certificate (Let's Encrypt recommended)
Deployment Steps
# 1. Clone the repository
git clone https://github.com/your-org/pestle.git
cd pestle
# 2. Configure environment
cp .env.example .env
nano .env # Edit with your settings
# 3. Start services
docker-compose -f docker-compose.prod.yml up -d
# 4. Run migrations
docker-compose exec backend python manage.py migrate
# 5. Create superuser
docker-compose exec backend python manage.py createsuperuser
# 6. Collect static files
docker-compose exec backend python manage.py collectstatic --noinput Production docker-compose.yml
version: '3.8'
services:
backend:
image: pestle/backend:latest
environment:
- DATABASE_URL=postgres://user:pass@db/pestle
- SECRET_KEY=${SECRET_KEY}
- ALLOWED_HOSTS=${DOMAIN}
depends_on:
- db
- redis
restart: always
frontend:
image: pestle/frontend:latest
environment:
- PUBLIC_API_URL=https://${DOMAIN}/api
restart: always
db:
image: postgres:14
volumes:
- postgres_data:/var/lib/postgresql/data
restart: always
redis:
image: redis:7-alpine
restart: always
nginx:
image: nginx:alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./certs:/etc/nginx/certs
depends_on:
- backend
- frontend
restart: always
volumes:
postgres_data: 2. Kubernetes (Enterprise Scale)
For large deployments with high availability requirements.
Helm Installation
# Add Pestle Helm repository
helm repo add pestle https://charts.pestle.com
helm repo update
# Create namespace
kubectl create namespace pestle
# Install with custom values
helm install pestle pestle/pestle \
--namespace pestle \
-f values.yaml Sample values.yaml
replicaCount:
backend: 3
frontend: 2
ingress:
enabled: true
className: nginx
hosts:
- host: pestle.yourcompany.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: pestle-tls
hosts:
- pestle.yourcompany.com
postgresql:
enabled: true
auth:
database: pestle
username: pestle
redis:
enabled: true
resources:
backend:
requests:
cpu: 500m
memory: 512Mi
limits:
cpu: 2000m
memory: 2Gi 3. Cloud Platform Deployment
AWS
- Compute: ECS Fargate or EKS
- Database: RDS PostgreSQL
- Cache: ElastiCache Redis
- Storage: S3 for media files
- CDN: CloudFront
Azure
- Compute: AKS or Container Apps
- Database: Azure Database for PostgreSQL
- Cache: Azure Cache for Redis
- Storage: Blob Storage
GCP
- Compute: GKE or Cloud Run
- Database: Cloud SQL PostgreSQL
- Cache: Memorystore Redis
- Storage: Cloud Storage
SSL/TLS Configuration
Let's Encrypt with Certbot
# Install certbot
apt install certbot python3-certbot-nginx
# Obtain certificate
certbot --nginx -d pestle.yourcompany.com
# Auto-renewal (added automatically)
certbot renew --dry-run Environment Variables
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection string |
SECRET_KEY | Yes | Django secret key (generate unique) |
ALLOWED_HOSTS | Yes | Your domain name(s) |
REDIS_URL | No | Redis connection (recommended) |
EMAIL_HOST | No | SMTP server for notifications |
SENTRY_DSN | No | Error tracking |
Post-Deployment Checklist
- ☐ SSL certificate installed and auto-renewing
- ☐ Database backups configured
- ☐ Monitoring and alerting set up
- ☐ Log aggregation configured
- ☐ Admin account created with strong password
- ☐ SSO/SAML configured (if applicable)
- ☐ Email notifications tested
- ☐ Firewall rules reviewed
Upgrading
# Pull latest images
docker-compose pull
# Apply database migrations
docker-compose exec backend python manage.py migrate
# Restart services
docker-compose up -d