Skip to main content

Production Deployment Guide

This guide provides detailed instructions for deploying AgentArea using Docker and Kubernetes. For infrastructure overview and monitoring setup, see the Infrastructure and Monitoring sections.

🎯 Deployment Strategies

Docker Compose

Best for: Small to medium deployments, single-server setups
  • Quick setup and deployment
  • Integrated service orchestration
  • Built-in networking and volumes
  • Perfect for staging environments

Kubernetes

Best for: Enterprise deployments, high availability
  • Auto-scaling and load balancing
  • Rolling updates and rollbacks
  • Service discovery and networking
  • Production-grade orchestration

🐳 Docker Compose Deployment

Prerequisites

  • Docker Engine 20.0+
  • Docker Compose 2.0+
  • 4GB+ RAM, 20GB+ storage
  • Valid domain name with SSL certificate

Production Docker Compose

  • docker-compose.prod.yml
  • .env.production
version: '3.8'

services:
  agentarea-api:
    image: agentarea/api:latest
    restart: unless-stopped
    environment:
      - DATABASE_URL=${DATABASE_URL}
      - REDIS_URL=${REDIS_URL}
      - JWT_SECRET_KEY=${JWT_SECRET_KEY}
      - ENVIRONMENT=production
    networks:
      - agentarea-network
    depends_on:
      - postgres
      - redis
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
      interval: 30s
      timeout: 10s
      retries: 3

  agentarea-frontend:
    image: agentarea/frontend:latest
    restart: unless-stopped
    environment:
      - NEXT_PUBLIC_API_URL=${API_URL}
      - NEXT_PUBLIC_ENVIRONMENT=production
    networks:
      - agentarea-network
    depends_on:
      - agentarea-api

  mcp-manager:
    image: agentarea/mcp-manager:latest
    restart: unless-stopped
    environment:
      - SERVER_PORT=8001
      - DATABASE_URL=${DATABASE_URL}
      - LOG_LEVEL=info
    networks:
      - agentarea-network
    volumes:
      - mcp-data:/app/data
    privileged: true

  postgres:
    image: postgres:15-alpine
    restart: unless-stopped
    environment:
      - POSTGRES_DB=${POSTGRES_DB}
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    volumes:
      - postgres-data:/var/lib/postgresql/data
      - ./backups:/backups
    networks:
      - agentarea-network
    command: >
      postgres -c max_connections=200
               -c shared_buffers=256MB
               -c effective_cache_size=1GB

  redis:
    image: redis:7-alpine
    restart: unless-stopped
    command: redis-server --appendonly yes --maxmemory 512mb
    volumes:
      - redis-data:/data
    networks:
      - agentarea-network

  traefik:
    image: traefik:v3.0
    restart: unless-stopped
    command:
      - "--api.dashboard=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.letsencrypt.acme.tlschallenge=true"
      - "--certificatesresolvers.letsencrypt.acme.email=${ACME_EMAIL}"
      - "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - letsencrypt-data:/letsencrypt
    networks:
      - agentarea-network
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.api.rule=Host(`traefik.${DOMAIN}`)"
      - "traefik.http.routers.api.tls.certresolver=letsencrypt"
      - "traefik.http.routers.api.service=api@internal"

volumes:
  postgres-data:
  redis-data:
  mcp-data:
  letsencrypt-data:

networks:
  agentarea-network:
    driver: bridge

Deployment Steps

1

Server Preparation

# Update system
sudo apt update && sudo apt upgrade -y

# Install Docker and Docker Compose
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER

# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
2

Configure Environment

# Clone production configuration
git clone https://github.com/agentarea/agentarea-deploy.git
cd agentarea-deploy

# Configure environment variables
cp .env.example .env.production
nano .env.production  # Edit with your values
3

Deploy Services

# Pull latest images
docker-compose -f docker-compose.prod.yml pull

# Start services
docker-compose -f docker-compose.prod.yml --env-file .env.production up -d

# Verify deployment
docker-compose -f docker-compose.prod.yml ps
4

Configure SSL & DNS

# Point DNS records to your server
# A record: yourdomain.com -> YOUR_SERVER_IP
# A record: api.yourdomain.com -> YOUR_SERVER_IP
# A record: traefik.yourdomain.com -> YOUR_SERVER_IP

# SSL certificates will be automatically issued by Let's Encrypt

☸️ Kubernetes Deployment

Prerequisites

  • Kubernetes cluster 1.24+
  • kubectl configured
  • Helm 3.0+
  • Persistent volume provisioner
  • Ingress controller

Helm Chart Deployment

  • values.yaml
  • Deployment Commands
# AgentArea Helm Chart Configuration
global:
  domain: yourdomain.com
  environment: production
  imageRegistry: docker.io/agentarea

api:
  image:
    repository: agentarea/api
    tag: "latest"
    pullPolicy: IfNotPresent
  
  replicas: 3
  resources:
    requests:
      cpu: 500m
      memory: 1Gi
    limits:
      cpu: 2
      memory: 4Gi
  
  autoscaling:
    enabled: true
    minReplicas: 3
    maxReplicas: 10
    targetCPUUtilizationPercentage: 70

frontend:
  image:
    repository: agentarea/frontend
    tag: "latest"
  
  replicas: 2
  resources:
    requests:
      cpu: 100m
      memory: 256Mi
    limits:
      cpu: 500m
      memory: 512Mi

mcpManager:
  image:
    repository: agentarea/mcp-manager
    tag: "latest"
  
  replicas: 2
  resources:
    requests:
      cpu: 250m
      memory: 512Mi
    limits:
      cpu: 1
      memory: 2Gi

postgresql:
  enabled: true
  auth:
    database: agentarea
    username: agentarea
    password: "your-secure-password"
  
  primary:
    resources:
      requests:
        cpu: 500m
        memory: 1Gi
      limits:
        cpu: 2
        memory: 4Gi
    
    persistence:
      enabled: true
      size: 100Gi
      storageClass: "fast-ssd"

redis:
  enabled: true
  auth:
    enabled: false
  
  master:
    resources:
      requests:
        cpu: 100m
        memory: 256Mi
      limits:
        cpu: 500m
        memory: 512Mi
    
    persistence:
      enabled: true
      size: 20Gi

ingress:
  enabled: true
  className: "nginx"
  annotations:
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
  
  hosts:
    - host: yourdomain.com
      paths:
        - path: /
          pathType: Prefix
          service: frontend
    - host: api.yourdomain.com
      paths:
        - path: /
          pathType: Prefix
          service: api
  
  tls:
    - secretName: agentarea-tls
      hosts:
        - yourdomain.com
        - api.yourdomain.com

monitoring:
  enabled: true
  prometheus:
    enabled: true
  grafana:
    enabled: true

Kubernetes Security Configuration

☁️ Cloud Platform Deployment

AWS ECS with Fargate

  • Task Definition
  • Terraform Configuration
{
  "family": "agentarea-api",
  "networkMode": "awsvpc",
  "requiresCompatibilities": ["FARGATE"],
  "cpu": "1024",
  "memory": "2048",
  "executionRoleArn": "arn:aws:iam::ACCOUNT:role/ecsTaskExecutionRole",
  "taskRoleArn": "arn:aws:iam::ACCOUNT:role/agentareaTaskRole",
  "containerDefinitions": [
    {
      "name": "agentarea-api",
      "image": "agentarea/api:latest",
      "portMappings": [
        {
          "containerPort": 8000,
          "protocol": "tcp"
        }
      ],
      "environment": [
        {
          "name": "ENVIRONMENT",
          "value": "production"
        }
      ],
      "secrets": [
        {
          "name": "DATABASE_URL",
          "valueFrom": "arn:aws:secretsmanager:REGION:ACCOUNT:secret:agentarea/database-url"
        }
      ],
      "logConfiguration": {
        "logDriver": "awslogs",
        "options": {
          "awslogs-group": "/ecs/agentarea-api",
          "awslogs-region": "us-west-2",
          "awslogs-stream-prefix": "ecs"
        }
      }
    }
  ]
}

Google Cloud Run

# deploy.yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: agentarea-api
  annotations:
    run.googleapis.com/ingress: all
    run.googleapis.com/execution-environment: gen2
spec:
  template:
    metadata:
      annotations:
        run.googleapis.com/cpu-throttling: "false"
        run.googleapis.com/memory: "2Gi"
        run.googleapis.com/cpu: "2"
        run.googleapis.com/max-scale: "100"
        run.googleapis.com/min-scale: "1"
    spec:
      containers:
      - image: gcr.io/PROJECT_ID/agentarea-api:latest
        ports:
        - containerPort: 8000
        env:
        - name: DATABASE_URL
          valueFrom:
            secretKeyRef:
              name: agentarea-secrets
              key: database-url
        resources:
          limits:
            cpu: "2"
            memory: "2Gi"

πŸ“Š Monitoring & Observability

Prometheus & Grafana

  • Prometheus Configuration
  • Grafana Dashboard
# prometheus.yml
global:
  scrape_interval: 15s
  evaluation_interval: 15s

rule_files:
  - "agentarea_rules.yml"

scrape_configs:
  - job_name: 'agentarea-api'
    static_configs:
      - targets: ['agentarea-api:8000']
    metrics_path: '/metrics'
    scrape_interval: 5s

  - job_name: 'mcp-manager'
    static_configs:
      - targets: ['mcp-manager:8001']
    metrics_path: '/metrics'
    scrape_interval: 10s

  - job_name: 'postgres-exporter'
    static_configs:
      - targets: ['postgres-exporter:9187']

  - job_name: 'redis-exporter'
    static_configs:
      - targets: ['redis-exporter:9121']

Alerting Rules

# agentarea_rules.yml
groups:
- name: agentarea.rules
  rules:
  - alert: HighErrorRate
    expr: rate(http_requests_total{status=~"5.."}[5m]) > 0.1
    for: 2m
    labels:
      severity: critical
    annotations:
      summary: "High error rate detected"
      description: "Error rate is {{ $value }} for the last 5 minutes"

  - alert: DatabaseConnectionFailure
    expr: agentarea_database_connections_failed_total > 0
    for: 1m
    labels:
      severity: critical
    annotations:
      summary: "Database connection failures"
      description: "Database connections are failing"

  - alert: HighMemoryUsage
    expr: (container_memory_usage_bytes / container_spec_memory_limit_bytes) > 0.9
    for: 5m
    labels:
      severity: warning
    annotations:
      summary: "High memory usage"
      description: "Memory usage is above 90%"

πŸ”„ CI/CD Pipeline

GitHub Actions

# .github/workflows/deploy.yml
name: Deploy to Production

on:
  push:
    branches: [main]
    tags: ['v*']

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Run tests
      run: |
        make test
        make security-test

  build:
    needs: test
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Build and push Docker images
      run: |
        docker build -t agentarea/api:${{ github.sha }} .
        docker push agentarea/api:${{ github.sha }}

  deploy:
    needs: build
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main'
    steps:
    - name: Deploy to Kubernetes
      run: |
        helm upgrade agentarea agentarea/agentarea \
          --set api.image.tag=${{ github.sha }} \
          --namespace agentarea

πŸ”§ Maintenance & Operations

Database Maintenance

Scaling Considerations

Horizontal Scaling

  • Add more API server replicas
  • Use load balancer for distribution
  • Implement sticky sessions if needed
  • Scale database read replicas

Vertical Scaling

  • Increase CPU and memory limits
  • Optimize database configuration
  • Tune connection pools
  • Monitor resource utilization

For production deployments, always follow security best practices, implement proper monitoring, and have a disaster recovery plan in place. Consider consulting with our enterprise team for large-scale deployments.
⌘I