Deployment Guide

Deploy SynThera in your environment

Deployment Options

Cloud Deployment

Deploy on AWS, Azure, or Google Cloud with managed services and auto-scaling.

  • • Fastest time to market
  • • Auto-scaling and load balancing
  • • Managed infrastructure

On-Premises

Deploy in your data center with full control over infrastructure and data.

  • • Maximum data control
  • • HIPAA compliance ready
  • • Custom security policies

Hybrid Deployment

Combine cloud and on-premises for optimal performance and compliance.

  • • Best of both worlds
  • • Flexible data placement
  • • Disaster recovery ready

System Requirements

Minimum Requirements

Production Environment

  • • CPU: 16 cores (Intel Xeon or AMD EPYC)
  • • RAM: 64GB minimum, 128GB recommended
  • • Storage: 1TB NVMe SSD (primary), 10TB for data
  • • GPU: NVIDIA V100/A100 for AI workloads
  • • Network: 10Gbps minimum bandwidth

Development Environment

  • • CPU: 8 cores
  • • RAM: 32GB
  • • Storage: 500GB SSD
  • • GPU: Optional (NVIDIA GTX/RTX)

Software Dependencies

Runtime Requirements

  • • Docker 24.0+ and Docker Compose v2
  • • Kubernetes 1.28+ (for orchestration)
  • • PostgreSQL 15+ or MongoDB 7+
  • • Redis 7+ (for caching and sessions)
  • • NGINX or Apache (reverse proxy)

Security Requirements

  • • TLS 1.3 certificates
  • • OAuth 2.0 / SAML 2.0 support
  • • Vault or similar secret management
  • • Network firewall with DPI

Cloud Deployment (AWS)

Prerequisites

  • • AWS CLI configured with appropriate permissions
  • • Terraform 1.5+ installed
  • • kubectl configured for EKS access
  • • Domain name and Route53 hosted zone

Step 1: Infrastructure Setup

# Clone the deployment repository
git clone https://github.com/synthera/deployment-aws.git
cd deployment-aws

# Configure Terraform variables
cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars with your settings

# Initialize and apply Terraform
terraform init
terraform plan
terraform apply

# This creates:
# - VPC with public/private subnets
# - EKS cluster with managed node groups
# - RDS PostgreSQL instance
# - ElastiCache Redis cluster
# - Application Load Balancer
# - S3 buckets for storage
# - IAM roles and policies

Step 2: Application Deployment

# Configure kubectl for EKS
aws eks update-kubeconfig --region us-west-2 --name synthera-cluster

# Install necessary operators
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/aws/deploy.yaml

# Deploy SynThera using Helm
helm repo add synthera https://charts.synthera.health
helm repo update

# Create namespace and secrets
kubectl create namespace synthera
kubectl create secret generic synthera-secrets \
  --from-literal=database-url="postgresql://user:pass@rds-endpoint:5432/synthera" \
  --from-literal=redis-url="redis://elasticache-endpoint:6379" \
  --from-literal=jwt-secret="your-secure-jwt-secret"

# Deploy with Helm
helm install synthera synthera/synthera \
  --namespace synthera \
  --values values-aws.yaml \
  --set image.tag=v2024.1.0

Step 3: Configuration

values-aws.yaml Configuration

# Deployment configuration
replicaCount: 3
image:
  repository: synthera/clinical-copilot
  pullPolicy: IfNotPresent

# Resource limits
resources:
  requests:
    memory: "4Gi"
    cpu: "2000m"
  limits:
    memory: "8Gi"
    cpu: "4000m"

# Horizontal Pod Autoscaler
autoscaling:
  enabled: true
  minReplicas: 3
  maxReplicas: 20
  targetCPUUtilizationPercentage: 70

# Service configuration
service:
  type: ClusterIP
  port: 8080

# Ingress configuration
ingress:
  enabled: true
  className: "nginx"
  annotations:
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
  hosts:
    - host: api.synthera.health
      paths:
        - path: /
          pathType: Prefix
  tls:
    - secretName: synthera-tls
      hosts:
        - api.synthera.health

# Database configuration
postgresql:
  enabled: false
  external:
    hostname: "synthera-db.cluster-xxx.us-west-2.rds.amazonaws.com"
    port: 5432
    database: "synthera"
    username: "synthera_user"

# Redis configuration
redis:
  enabled: false
  external:
    hostname: "synthera-cache.xxx.cache.amazonaws.com"
    port: 6379

# AI Model configuration
ai:
  models:
    - name: "clinical-reasoning"
      type: "transformer"
      gpu: true
      replicas: 2
    - name: "voice-processing"
      type: "whisper"
      gpu: true
      replicas: 1
  nodeSelector:
    node-type: "gpu-optimized"

On-Premises Deployment

Enterprise Features

  • • Air-gapped deployment support
  • • Custom CA certificate integration
  • • LDAP/Active Directory integration
  • • Hardware security module (HSM) support

Installation with Docker Compose

# Download the installation package
curl -O https://releases.synthera.health/v2024.1.0/synthera-enterprise.tar.gz
tar -xzf synthera-enterprise.tar.gz
cd synthera-enterprise

# Configure environment
cp .env.example .env
# Edit .env with your configuration

# Generate certificates (or use your own)
./scripts/generate-certs.sh

# Start services
docker-compose up -d

# Initialize database
docker-compose exec app python manage.py migrate
docker-compose exec app python manage.py createsuperuser

# Load initial data
docker-compose exec app python manage.py loaddata initial_specialties.json

Docker Compose Configuration

version: '3.8'

services:
  app:
    image: synthera/clinical-copilot:v2024.1.0
    restart: unless-stopped
    environment:
      - DATABASE_URL=postgresql://synthera:${DB_PASSWORD}@postgres:5432/synthera
      - REDIS_URL=redis://redis:6379/0
      - SECRET_KEY=${SECRET_KEY}
      - ALLOWED_HOSTS=${ALLOWED_HOSTS}
      - DEBUG=false
      - SECURE_SSL_REDIRECT=true
    depends_on:
      - postgres
      - redis
    volumes:
      - ./data/uploads:/app/uploads
      - ./data/models:/app/models
      - ./certs:/app/certs
    ports:
      - "8080:8080"

  postgres:
    image: postgres:15
    restart: unless-stopped
    environment:
      - POSTGRES_DB=synthera
      - POSTGRES_USER=synthera
      - POSTGRES_PASSWORD=${DB_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./backups:/backups
    ports:
      - "127.0.0.1:5432:5432"

  redis:
    image: redis:7-alpine
    restart: unless-stopped
    command: redis-server --requirepass ${REDIS_PASSWORD}
    volumes:
      - redis_data:/data
    ports:
      - "127.0.0.1:6379:6379"

  nginx:
    image: nginx:alpine
    restart: unless-stopped
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./certs:/etc/nginx/certs
      - ./data/uploads:/var/www/uploads
    ports:
      - "80:80"
      - "443:443"
    depends_on:
      - app

  ai-models:
    image: synthera/ai-models:v2024.1.0
    restart: unless-stopped
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]
    environment:
      - MODEL_CACHE_DIR=/models
      - INFERENCE_WORKERS=4
    volumes:
      - ./data/models:/models
    ports:
      - "127.0.0.1:8081:8081"

volumes:
  postgres_data:
  redis_data:

Configuration Management

Environment Variables

# Core Configuration
DATABASE_URL=postgresql://user:pass@host:5432/db
REDIS_URL=redis://user:pass@host:6379/0
SECRET_KEY=your-256-bit-secret-key
ALLOWED_HOSTS=synthera.health,api.synthera.health

# AI Configuration
AI_MODEL_PATH=/app/models
AI_INFERENCE_ENDPOINT=http://ai-models:8081
VOICE_PROCESSING_ENABLED=true
IMAGING_ANALYSIS_ENABLED=true

# Security Configuration
SECURE_SSL_REDIRECT=true
SESSION_COOKIE_SECURE=true
CSRF_COOKIE_SECURE=true
SECURE_HSTS_SECONDS=31536000

# Logging Configuration
LOG_LEVEL=INFO
LOG_FORMAT=json
SENTRY_DSN=https://your-sentry-dsn

# Performance Configuration
CACHE_TTL=3600
MAX_UPLOAD_SIZE=100MB
WORKER_PROCESSES=4
WORKER_CONNECTIONS=1000

# Compliance Configuration
HIPAA_COMPLIANCE=true
AUDIT_LOGGING=true
DATA_RETENTION_DAYS=2555  # 7 years
PHI_ENCRYPTION=AES256

Configuration Files

application.yaml

# SynThera Application Configuration
server:
  port: 8080
  max_connections: 1000
  request_timeout: 30s

database:
  pool_size: 20
  max_overflow: 30
  pool_recycle: 3600
  echo: false

ai_models:
  clinical_reasoning:
    model_path: "/models/clinical-v2024.1"
    gpu_memory: "8GB"
    batch_size: 32
  voice_processing:
    model_path: "/models/whisper-medical"
    language_models: ["en", "es", "fr"]
    
security:
  jwt_expiration: 24h
  refresh_token_expiration: 7d
  password_policy:
    min_length: 12
    require_special: true
    require_numbers: true

monitoring:
  metrics_enabled: true
  health_check_interval: 30s
  prometheus_endpoint: "/metrics"

Security Configuration

Security Checklist

TLS 1.3 certificates configured
Database encryption at rest
Network segmentation implemented
Firewall rules configured
IAM roles and policies
Audit logging enabled
Vulnerability scanning
Backup encryption

SSL/TLS Configuration

# Generate SSL certificate with Let's Encrypt
certbot certonly --standalone \
  -d synthera.health \
  -d api.synthera.health \
  -d app.synthera.health \
  --email admin@synthera.health \
  --agree-tos

# Nginx SSL configuration
server {
    listen 443 ssl http2;
    server_name synthera.health;
    
    ssl_certificate /etc/letsencrypt/live/synthera.health/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/synthera.health/privkey.pem;
    
    # Modern SSL configuration
    ssl_protocols TLSv1.3 TLSv1.2;
    ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
    ssl_prefer_server_ciphers off;
    
    # Security headers
    add_header Strict-Transport-Security "max-age=63072000" always;
    add_header X-Frame-Options DENY always;
    add_header X-Content-Type-Options nosniff always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
    add_header Content-Security-Policy "default-src 'self'" always;
    
    location / {
        proxy_pass http://app:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Monitoring & Troubleshooting

Health Checks

# Application health check
curl -f http://localhost:8080/health
# Expected response: {"status": "healthy", "version": "v2024.1.0"}

# Database connectivity
curl -f http://localhost:8080/health/db
# Expected response: {"database": "connected", "latency": "2ms"}

# AI models status
curl -f http://localhost:8080/health/ai
# Expected response: {"models": {"clinical": "loaded", "voice": "loaded"}}

# System resources
curl -f http://localhost:8080/health/system
# Expected response: {"cpu": "45%", "memory": "6.2GB/16GB", "disk": "120GB/1TB"}

Common Issues

Database Connection Issues

Symptoms: 500 errors, slow response times

# Check database logs
docker-compose logs postgres

# Test connection
psql -h localhost -U synthera -d synthera -c "SELECT 1;"

# Check connection pool
curl http://localhost:8080/debug/db-pool

AI Model Loading Failures

Symptoms: AI features not working, timeout errors

# Check model container logs
docker-compose logs ai-models

# Verify GPU availability
nvidia-smi

# Check model files
ls -la /data/models/
du -sh /data/models/*

# Restart AI service
docker-compose restart ai-models

Performance Issues

Symptoms: Slow API responses, high CPU usage

# Monitor system resources
htop
iostat -x 1
free -h

# Check application metrics
curl http://localhost:8080/metrics

# Analyze slow queries
docker-compose exec postgres pg_stat_statements

# Check Redis performance
redis-cli --latency -h localhost -p 6379

Log Analysis

# Application logs
docker-compose logs -f app

# Filter error logs
docker-compose logs app | grep ERROR

# Database query logs
docker-compose logs postgres | grep "slow query"

# Audit logs for compliance
tail -f /var/log/synthera/audit.log

# Performance metrics
curl -s http://localhost:8080/metrics | grep synthera_request_duration

Backup and Recovery

Backup Strategy

  • • Automated daily database backups with 30-day retention
  • • Weekly full system backups with 1-year retention
  • • Real-time replication for critical data
  • • Cross-region backup storage for disaster recovery

Backup Scripts

#!/bin/bash
# Database backup script

BACKUP_DIR="/backups"
DATE=$(date +%Y%m%d_%H%M%S)
DB_NAME="synthera"

# Create backup
pg_dump -h postgres -U synthera $DB_NAME | gzip > $BACKUP_DIR/db_backup_$DATE.sql.gz

# Upload to S3 (if using cloud backup)
aws s3 cp $BACKUP_DIR/db_backup_$DATE.sql.gz s3://synthera-backups/database/

# Cleanup old backups (keep 30 days)
find $BACKUP_DIR -name "db_backup_*.sql.gz" -mtime +30 -delete

# Verify backup integrity
gunzip -t $BACKUP_DIR/db_backup_$DATE.sql.gz
if [ $? -eq 0 ]; then
    echo "Backup completed successfully: db_backup_$DATE.sql.gz"
else
    echo "Backup verification failed!" >&2
    exit 1
fi

Recovery Procedures

# Database recovery from backup
# 1. Stop the application
docker-compose stop app

# 2. Create new database (if needed)
docker-compose exec postgres createdb -U synthera synthera_restored

# 3. Restore from backup
gunzip -c /backups/db_backup_20240125_120000.sql.gz | \
  docker-compose exec -T postgres psql -U synthera -d synthera_restored

# 4. Update database configuration
# Edit .env to point to restored database

# 5. Start application
docker-compose start app

# Point-in-time recovery (if using WAL archiving)
# Stop PostgreSQL
docker-compose stop postgres

# Restore base backup
tar -xzf /backups/base_backup_20240125.tar.gz -C /var/lib/postgresql/data

# Create recovery.conf
echo "restore_command = 'cp /backups/wal/%f %p'" > /var/lib/postgresql/data/recovery.conf
echo "recovery_target_time = '2024-01-25 14:30:00'" >> /var/lib/postgresql/data/recovery.conf

# Start PostgreSQL in recovery mode
docker-compose start postgres