Production Deployment

This section covers everything you need to deploy AutoCom in a production environment with optimized configurations for performance, scalability, and reliability.

Overview

AutoCom is designed to run efficiently in containerized environments with support for:

  • Docker Compose - Single-server deployments
  • Kubernetes - Scalable, orchestrated deployments
  • Horizontal Pod Autoscaling - Automatic scaling based on load

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                     Production Environment                       │
│                                                                  │
│  ┌─────────────┐    ┌─────────────┐    ┌─────────────┐         │
│  │   Nginx     │    │  Frontend   │    │    Docs     │         │
│  │   Proxy     │    │   Next.js   │    │   Next.js   │         │
│  │   :80/:443  │    │   :3000     │    │   :3001     │         │
│  └──────┬──────┘    └─────────────┘    └─────────────┘         │
│         │                                                       │
│         ▼                                                       │
│  ┌─────────────┐    ┌─────────────┐    ┌─────────────┐         │
│  │ Laravel API │    │   Horizon   │    │  AI Agent   │         │
│  │  Octane +   │    │   Queue     │    │  PydanticAI │         │
│  │ FrankenPHP  │    │   Worker    │    │   :8100     │         │
│  │   :8000     │    │             │    │             │         │
│  └──────┬──────┘    └──────┬──────┘    └─────────────┘         │
│         │                  │                                    │
│         ▼                  ▼                                    │
│  ┌──────────────────┐    ┌─────────────┐    ┌─────────┐       │
│  │  CloudNativePG   │    │    Redis    │    │  MinIO  │       │
│  │  Primary + 2     │    │   :6379     │    │ Backups │       │
│  │  Read Replicas   │    │             │    │  :9000  │       │
│  └──────────────────┘    └─────────────┘    └─────────┘       │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘

Key Components

Component Description Technology
Nginx Reverse proxy, CORS, gzip nginx:alpine
API Laravel API with Octane FrankenPHP + Laravel 11
Frontend React web application Next.js 13.5
Queue Worker Background job processing Laravel Horizon
Database Primary + 2 read replicas CloudNativePG (PostgreSQL 16)
Cache/Queue Caching, sessions, queues Redis 7
AI Agent Multi-tenant AI orchestration PydanticAI (Python)
Backups Automated DB backups MinIO (S3-compatible)

Documentation Sections

Laravel Octane — recommended

Octane + FrankenPHP deployment — 17x throughput improvement, multi-tenant safety, trade-offs.

Performance & Load Testing

Benchmark results (27→456 req/s), k6 load testing, response caching, optimization checklist.

Backup & Recovery

Automated PostgreSQL backups with CloudNativePG + MinIO, point-in-time recovery.

GitLab CI/CD

Split monorepo mirroring, CI pipelines for all modules, status dashboard.

Docker Production

Configure and deploy AutoCom using Docker Compose with production-optimized settings.

Kubernetes Deployment

Deploy to Kubernetes with Horizontal Pod Autoscaling and high availability.

Autoscaling

Configure automatic scaling based on CPU and memory metrics.

PHP Optimization

PHP-FPM and OPcache configuration (superseded by Octane for production).

Quick Start

Docker Compose (Recommended for Single Server)

# Build production images
docker compose -f docker-compose.prod.yml build

# Start all services
docker compose -f docker-compose.prod.yml up -d

# Run migrations
docker compose exec app php artisan migrate --force

# Create first user via installer
# Visit http://localhost:3000/install

Kubernetes (Recommended for Scalable Deployments)

# Render and apply the unified overlay
kubectl apply -k k8s/overlays/default

# Check status
kubectl -n autocom-k8s get pods

For single-node k3s on a VPS, a phased runbook lives at bin/vps-deploy/.

Performance (Benchmarked)

With Octane + CloudNativePG, AutoCom achieves:

Metric PHP-FPM (baseline) Octane + CloudNativePG Test
Throughput 27 req/s 456 req/s 500 concurrent users
p50 response 343ms 122ms k6 stress test
p95 response 2.44s 1.43s k6 stress test
Max concurrent users ~50 500+ Zero errors
Scale up time N/A 30 seconds HPA 1→5 pods

See Performance & Load Testing for full details.

Security Considerations

Production deployments should include:

  • TLS/SSL certificates (via cert-manager or similar)
  • Network policies to restrict pod-to-pod communication
  • Secrets management (Kubernetes Secrets or external vault)
  • Regular security updates for base images

Next Steps

  1. Laravel Octane — Set up FrankenPHP for 5-10x throughput
  2. Docker Production — Start with Docker Compose for simple deploys
  3. Kubernetes — Scale with K8s + HPA autoscaling
  4. Backup & Recovery — Automated backups with PITR
  5. GitLab CI/CD — Set up pipelines and split repos
  6. Performance — Run load tests and optimize