Docker Production Deployment
Coming Soon
Detailed production deployment documentation is in development. This page provides preliminary guidance.
Overview
For production deployments, we recommend using Docker Compose with production-optimised settings. This differs from the development configuration in several ways:
- Production-ready image builds
- Proper secret management
- Database persistence and backups
- Reverse proxy configuration
- Health checks and monitoring
Quick Start
1. Clone the Repository
git clone https://github.com/alan-turing-institute/AssurancePlatform.git
cd AssurancePlatform2. Create Production Environment File
cp .env.example .env.productionEdit .env.production with production values:
# Application
NODE_ENV=production
NEXTAUTH_URL=https://your-domain.com
NEXTAUTH_SECRET=<generate-with-openssl-rand-base64-32>
# Database
DATABASE_URL=postgresql://tea:secure-password@db:5432/tea
POSTGRES_USER=tea
POSTGRES_PASSWORD=secure-password
POSTGRES_DB=tea
# GitHub OAuth (optional)
GITHUB_APP_CLIENT_ID=your-client-id
GITHUB_APP_CLIENT_SECRET=your-client-secret3. Deploy
docker-compose -f docker-compose.production.yml up -dProduction Configuration
Reverse Proxy
For production, place the application behind a reverse proxy:
Using Traefik:
# Add to docker-compose.production.yml
services:
traefik:
image: traefik:v2.10
ports:
- "80:80"
- "443:443"
# ... configurationUsing nginx:
server {
listen 443 ssl;
server_name tea.example.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}Database Persistence
Ensure database data is persisted on a reliable volume:
volumes:
postgres_data:
driver: local
driver_opts:
type: none
o: bind
device: /data/postgresHealth Checks
The application includes health check endpoints:
/api/health- Application health- Database connection is verified on startup
Updating
To update to a new version:
# Pull latest changes
git pull origin main
# Rebuild and restart
docker-compose -f docker-compose.production.yml up -d --buildTroubleshooting
View Logs
docker-compose -f docker-compose.production.yml logs -fDatabase Connection Issues
- Verify
DATABASE_URLis correct - Check database container is running
- Ensure network connectivity between containers
Application Not Starting
- Check logs for error messages
- Verify all required environment variables are set
- Ensure database migrations have run
Further Reading
- Deployment Overview - General deployment guidance
- Database Management - Backup and restore procedures