Skip to main content

Deployment Overview

This guide covers deploying Codex in various environments, from simple homelab setups to production Kubernetes clusters.

Deployment Options

Deployment TypeDatabaseBest ForScaling
Docker ComposePostgreSQLProduction, Multi-userSingle host
KubernetesPostgreSQLEnterprise, High AvailabilityHorizontal
Systemd ServiceEitherDedicated serverNone
Binary + SQLiteSQLiteHomelab, Single-userNone

Understanding Limitations

Before choosing a deployment strategy, understand these architectural considerations.

SQLite Limitations

SQLite is excellent for simple setups but has constraints:

LimitationImpactRecommendation
Single writerOnly one write operation at a timeUse PostgreSQL for multi-user
No horizontal scalingCannot run multiple Codex instancesUse PostgreSQL for scaling
Limited concurrencyPerformance degrades with many usersLimit to ~5-10 concurrent users
No distributed workersWorkers must run in same processUse combined serve mode
SQLite Worker Limitation

With SQLite, you cannot run separate worker processes. The background task workers must run within the same process as the web server. Use codex serve which includes both the API server and workers.

Running codex worker separately with SQLite will cause database locking issues and is not supported.

PostgreSQL Advantages

PostgreSQL enables:

  • Multiple concurrent users
  • Horizontal scaling (multiple Codex instances)
  • Separate worker processes
  • Better performance under load
  • LISTEN/NOTIFY for real-time cross-process events

Server-Sent Events (SSE) Considerations

SSE streams require special handling in certain deployments:

DeploymentSSE BehaviorNotes
Single instanceWorks perfectlyAll events delivered instantly
Multiple instancesWorks with PostgreSQLEvents replayed via LISTEN/NOTIFY
Behind proxyRequires configurationDisable buffering, set timeouts
SQLite + WorkersNot supportedCannot separate workers

Quick Start

git clone https://github.com/AshDevFr/codex.git
cd codex
docker compose --profile prod up -d
docker compose exec codex codex seed --config /app/config/config.docker.yaml

Binary

# Download and extract
curl -LO https://github.com/AshDevFr/codex/releases/latest/download/codex-linux-amd64.tar.gz
tar xzf codex-linux-amd64.tar.gz

# Configure and run
cp codex.example.yaml codex.yaml
./codex serve --config codex.yaml

In This Section