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     │         │
│  │ LoadBalancer│    │   Next.js   │    │   Next.js   │         │
│  │   :80/:443  │    │   :3000     │    │   :3001     │         │
│  └──────┬──────┘    └─────────────┘    └─────────────┘         │
│         │                                                       │
│         ▼                                                       │
│  ┌─────────────┐    ┌─────────────┐                            │
│  │ Laravel API │    │   Horizon   │                            │
│  │  PHP-FPM    │    │   Queue     │                            │
│  │   :9000     │    │   Worker    │                            │
│  └──────┬──────┘    └──────┬──────┘                            │
│         │                  │                                    │
│         ▼                  ▼                                    │
│  ┌─────────────┐    ┌─────────────┐                            │
│  │  PostgreSQL │    │    Redis    │                            │
│  │    :5432    │    │   :6379     │                            │
│  └─────────────┘    └─────────────┘                            │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘

Key Components

Component Description Technology
Nginx Reverse proxy and load balancer nginx:alpine
API Laravel REST API with PHP-FPM PHP 8.4 + Laravel 11
Frontend React-based web application Next.js 14
Queue Worker Background job processing Laravel Horizon
Database Primary data storage PostgreSQL 16
Cache/Queue Caching and queue broker Redis 7

Documentation Sections

Docker Production

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

PHP Optimization

Detailed PHP-FPM and OPcache configuration for maximum performance.

Kubernetes Deployment

Deploy to Kubernetes with Horizontal Pod Autoscaling and high availability.

Autoscaling

Configure automatic scaling based on CPU and memory metrics.

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)

# Navigate to k8s directory
cd k8s/dev

# Deploy everything
./deploy.sh deploy

# Check status
./deploy.sh status

Performance Targets

With the optimized configurations, AutoCom achieves:

Metric Target Configuration
Response Time < 200ms OPcache + JIT
Throughput 1000+ req/s PHP-FPM tuning
Memory Usage < 256MB/process Memory limits
Scale Up Time < 30 seconds HPA configuration

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. Configure Docker Production - Start with Docker Compose
  2. Optimize PHP Settings - Tune for performance
  3. Deploy to Kubernetes - Scale your deployment
  4. Configure Autoscaling - Handle traffic spikes