| Command | Starts PostgreSQL? | Starts Redis? | Starts app? | Best for |
|---|---|---|---|---|
aegra dev | Yes (Docker) | No | Yes (host, hot reload) | Local development |
aegra up | Yes (Docker) | Yes (Docker) | Yes (Docker) | Self-hosted production |
aegra serve | No | No | Yes (host) | PaaS, containers, bare metal |
Local development
- Finds or generates
docker-compose.ymlwith PostgreSQL - Starts the PostgreSQL container
- Loads your
.envfile (withREDIS_BROKER_ENABLED=falseby default) - Runs uvicorn with
--reloadfor hot reloading - Applies database migrations automatically on startup
aegra dev options
aegra dev options
| Option | Default | Description |
|---|---|---|
--host | 127.0.0.1 | Host to bind to |
--port | 2026 | Port to bind to |
--config / -c | Auto-detected | Path to aegra.json |
--env-file / -e | .env | Path to .env file |
--file / -f | Auto-detected | Path to docker-compose.yml |
--no-db-check | — | Skip database readiness check |
Self-hosted with Docker
- Finds or generates
docker-compose.ymlwith PostgreSQL, Redis, and app service - Builds the Docker image from your
Dockerfile - Starts all containers
- The app container runs
aegra serveinternally withREDIS_BROKER_ENABLED=true - Migrations apply automatically on startup
- Workers start automatically and begin processing runs from the Redis job queue — see the worker architecture guide for details on job dispatch, concurrency, and crash recovery
docker-compose.yml includes:
- PostgreSQL with pgvector
- Redis for job dispatch, SSE pub/sub, and crash recovery
- Your app container built from
Dockerfile - Health checks on both PostgreSQL and the API
restart: unless-stoppedon all services — containers automatically restart on crashes or failed health checks, but respect manualdocker compose stop- Volume mounts for your source code and config
aegra up options
aegra up options
| Option | Default | Description |
|---|---|---|
--build / --no-build | Build on | Build images before starting |
--file / -f | Auto-detected | Path to compose file |
SERVICE... | All | Specific services to start |
PaaS deployment
For platforms like Railway, Render, or Fly.io — useaegra serve:
REDIS_BROKER_ENABLED=true (recommended for multi-instance production deployments). Without Redis, runs execute as in-process asyncio tasks — suitable for single-instance deployments.
Create a PostgreSQL addon on your platform
Most PaaS platforms offer managed PostgreSQL. Create one and get the connection URL.
Create a Redis addon
For production workloads, add a managed Redis instance. This enables the worker job queue, cross-instance SSE streaming, and crash recovery. Without Redis (
REDIS_BROKER_ENABLED=false), runs execute as in-process asyncio tasks (suitable for single-instance deployments).aegra serve options
aegra serve options
| Option | Default | Description |
|---|---|---|
--host | 0.0.0.0 | Host to bind to |
--port | 2026 | Port to bind to |
--config / -c | Auto-detected | Path to aegra.json |
Kubernetes
Useaegra serve as the container command in your pod spec:
Database configuration
Two ways to configure the database connection:- Connection string (recommended for production)
- Individual fields
?sslmode=require) are preserved.DATABASE_URL takes precedence. When set, individual POSTGRES_* variables are ignored.Migrations
Migrations run automatically on startup for all deployment methods. You do not need to run them manually.Health checks
Aegra provides health check endpoints for load balancers, Docker, and Kubernetes probes:| Endpoint | Purpose |
|---|---|
GET /health | Overall health status |
GET /ready | Readiness check |
GET /live | Liveness check |
GET /info | Server info |
docker-compose.yml uses /health to monitor the API container. If the server hangs or becomes unresponsive, Docker marks it unhealthy after 3 consecutive failures (every 30 seconds). Combined with restart: unless-stopped, unhealthy containers are automatically restarted.
Troubleshooting
Connection refused on startup
Connection refused on startup
PostgreSQL is not reachable. If using
aegra dev or aegra up, make sure Docker is running. If using aegra serve, verify your DATABASE_URL or POSTGRES_* variables in .env.Password authentication failed
Password authentication failed
Wrong database credentials. Check that
POSTGRES_USER and POSTGRES_PASSWORD in your .env match what PostgreSQL was initialized with.Relation does not exist
Relation does not exist
Migrations haven’t been applied. This usually means the server couldn’t connect to PostgreSQL during startup. Check the logs for connection errors, fix the connection, and restart.
Migrations hang on startup
Migrations hang on startup
Check if another process holds a lock on the database, if the database is reachable but slow, or check server logs for specific migration errors.