Skip to main content

Prerequisites

  • Docker Engine 20.10+
  • Docker Compose 2.0+
  • 4GB RAM minimum
  • 20GB disk space

Architecture

The docker-compose setup includes:
ServicePortPurpose
app8010Main API & WebSocket server
tele_mcp8100Telegram MCP integration
gmail_mcp8101Gmail MCP integration
whatsapp_mcp8102WhatsApp MCP integration
livekit7880, 7881LiveKit media server
scheduler-Background job scheduler

Setup Steps

1. Prepare Environment

cp .env.example .env
Configure your .env file with all required API keys and credentials.

2. Build Base Image

docker-compose build base
This creates the base image with all common dependencies.

3. Build All Services

docker-compose build

4. Start Services

docker-compose up -d
Monitor logs:
docker-compose logs -f
Check specific service:
docker-compose logs -f app

5. Verify Deployment

# Check all services are running
docker-compose ps

# Test API endpoint
curl http://localhost:8010/health

# View container logs
docker-compose logs app

Service Details

Main App Service

services:
  app:
    build:
      context: .
      dockerfile: docker/Dockerfile.app
    ports:
      - "8010:8010"
    environment:
      - PORT=8010
      - Environment=production
    depends_on:
      - base
      - tele_mcp
      - gmail_mcp
    networks:
      - call-agent-network
Key Environment Variables:
  • PORT: Application port (default: 8010)
  • Environment: Set to production for production use
  • GEMINI_API_KEY: Google Gemini API key
  • OPENAI_API_KEY: OpenAI API key
  • SUPABASE_URL: Supabase project URL
  • SUPABASE_KEY: Supabase API key

MCP Services

Telegram MCP (Port 8100)

Handles Telegram integration:
  • Message forwarding
  • User management
  • Async processing

Gmail MCP (Port 8101)

Manages Gmail operations:
  • Email sending/receiving
  • Attachment handling
  • OAuth authentication

WhatsApp MCP (Port 8102)

WhatsApp integration:
  • Message delivery
  • Media handling
  • Group management

Scaling

Horizontal Scaling

# Scale app service to 3 instances
docker-compose up -d --scale app=3

Resource Limits

Edit docker-compose.yml:
services:
  app:
    deploy:
      resources:
        limits:
          cpus: '2'
          memory: 4G
        reservations:
          cpus: '1'
          memory: 2G

Networking

All services communicate via the internal Docker network call-agent-network. To expose services externally:
networks:
  call-agent-network:
    driver: bridge

Data Persistence

Volumes

volumes:
  supabase_data:
  postgres_data:
Create persistent volumes:
docker volume create callintel-data

Health Checks

Each service includes health checks:
healthcheck:
  test: ["CMD", "curl", "-f", "http://localhost:8010/health"]
  interval: 30s
  timeout: 10s
  retries: 3
  start_period: 40s
Check service health:
docker-compose exec app curl http://localhost:8010/health

Troubleshooting

Port Conflicts

If ports are already in use, modify port mappings in docker-compose.yml:
ports:
  - "8020:8010"  # Map to different host port

Container Won’t Start

# Check logs
docker-compose logs app

# Rebuild without cache
docker-compose build --no-cache app

# Remove and restart
docker-compose down
docker-compose up -d

Memory Issues

# Check resource usage
docker stats

# Increase memory limit in docker-compose.yml
# Or increase Docker Desktop memory allocation

Network Issues

# Test network connectivity
docker-compose exec app ping tele_mcp

# Check DNS resolution
docker-compose exec app nslookup tele_mcp

Production Deployment

Environment Setup

# Use production config
export Environment=production

# Enable security headers
SECURE_HEADERS=true
CORS_ORIGINS=https://yourdomain.com

SSL/TLS

Add reverse proxy (nginx):
services:
  nginx:
    image: nginx:latest
    ports:
      - "443:443"
      - "80:80"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./certs:/etc/nginx/certs
    depends_on:
      - app

Database Backups

# Backup Supabase data
docker-compose exec supabase pg_dump > backup.sql

# Backup volumes
docker run --rm -v callintel-data:/data \
  -v $(pwd):/backup alpine \
  tar czf /backup/data-backup.tar.gz /data

Monitoring

Logs

# View all logs
docker-compose logs -f

# View specific service
docker-compose logs -f app

# Filter by time
docker-compose logs -f --since 1h app

# View only errors
docker-compose logs app | grep ERROR

Metrics

# CPU and memory usage
docker stats

# Container inspection
docker-compose ps -q | xargs docker inspect --format='{{.Name}} {{.State.Status}}'

Stopping and Cleanup

# Stop services
docker-compose stop

# Stop and remove containers
docker-compose down

# Remove all volumes (WARNING: deletes data)
docker-compose down -v

# Remove images
docker-compose down --rmi all

Next Steps

Configuration

Learn about all configuration options.