Docker Compose Deployment
Docker Compose provides the fastest path to a running the0 platform. The the0 CLI manages the full stack with a single command, making it ideal for local development, evaluation, and small self-hosted deployments.
Prerequisites
Before starting, ensure your system meets these requirements:
- Docker 20.10 or later with the Compose plugin (included with Docker Desktop)
- the0 CLI (install guide)
- At least 4GB RAM available for containers
- At least 20GB disk space for images and volumes
Verify your Docker installation:
docker --version
docker compose versionQuick Start
Initialize and start all services:
# Initialize (first time only — point to your repo clone)
the0 local init --repo-path /path/to/the0
# Start all services
the0 local startInitial startup takes several minutes as images are built. Subsequent starts are much faster.
Once running, access the platform at:
| Service | URL | Description |
|---|---|---|
| Frontend | http://localhost:3001 | Web dashboard |
| API | http://localhost:3000 | REST API |
| Documentation | http://localhost:3002 | Platform docs |
| MinIO Console | http://localhost:9001 | Object storage admin |
MinIO credentials: the0admin / the0password
Service Architecture
The Docker Compose configuration starts these services:
Infrastructure Services
PostgreSQL (port 5432) stores user accounts, bot definitions, and configuration. The database initializes automatically with required schemas.
MongoDB (port 27017) stores runtime state, job queues, and execution logs. The bot runner and scheduler services use MongoDB for coordination.
NATS (port 4222) provides event streaming between services. JetStream is enabled for durable message delivery.
MinIO (ports 9000, 9001) provides S3-compatible object storage for bot code packages, execution logs, and artifacts.
Application Services
the0-api (port 3000) handles REST API requests, user authentication, and bot management. It publishes events to NATS for the runtime services.
the0-frontend (port 3001) serves the web dashboard. It communicates with the API for all operations.
the0-docs (port 3002) serves the platform documentation.
bot-runner executes realtime bots. It uses a reconciliation loop to compare desired state (from MongoDB) with running containers and makes corrections. Bots run in isolated Docker containers with resource limits.
bot-scheduler manages scheduled bot execution. It monitors cron schedules from MongoDB and triggers bot executions when due. Requires NATS for receiving schedule events from the API.
Management Commands
The CLI provides commands for common operations:
# Start all services
the0 local start
# Stop all services
the0 local stop
# Restart with fresh builds
the0 local restart
# View logs (all services)
the0 local logs
# View logs for specific service
the0 local logs api
# Follow logs in real time
the0 local logs -f api
# Check service health
the0 local statusFor development with hot reload:
# Start with hot reload enabled for frontend and API
the0 local devConfiguration
The compose configuration is managed by the CLI at ~/.the0/compose/. Key environment variables:
Database Configuration
environment:
POSTGRES_DB: the0_oss
POSTGRES_USER: the0
POSTGRES_PASSWORD: the0_password # Change in productionAPI Configuration
environment:
JWT_SECRET: your-super-secret-jwt-key-change-this-in-production
JWT_EXPIRES_IN: 24hStorage Configuration
environment:
MINIO_ROOT_USER: the0admin
MINIO_ROOT_PASSWORD: the0password # Change in productionBot Execution Limits
Worker services accept resource limit configuration:
environment:
BOT_MEMORY_LIMIT_MB: "512"
BOT_CPU_SHARES: "512"Data Persistence
Data persists in Docker volumes:
postgres_data- PostgreSQL database filesmongo_data- MongoDB database filesnats_data- NATS JetStream stateminio_data- Object storage filesbot_runner_data/bot_scheduler_data- Runtime service state
To reset all data and start fresh:
the0 local uninstall
the0 local init --repo-path /path/to/the0
the0 local startBackup and Restore
Database Backup
# PostgreSQL backup
docker compose -f ~/.the0/compose/docker-compose.yml exec postgres pg_dump -U the0 the0_oss > backup.sql
# PostgreSQL restore
docker compose -f ~/.the0/compose/docker-compose.yml exec -T postgres psql -U the0 the0_oss < backup.sqlObject Storage Backup
MinIO data can be backed up using the mc CLI or by copying the volume directly:
# Using docker cp
docker cp $(docker compose -f ~/.the0/compose/docker-compose.yml ps -q minio):/data ./minio-backupService Configuration
Reconciliation Intervals
The bot-runner and bot-scheduler services support configurable intervals:
environment:
# How often bot-runner reconciles bot state (default: 30s)
RECONCILE_INTERVAL: "30s"
# How often bot-scheduler checks for due schedules (default: 10s)
CHECK_INTERVAL: "10s"NATS Configuration
NATS is optional for bot-runner (falls back to polling) but required for bot-scheduler:
environment:
NATS_URL: nats://nats:4222Troubleshooting
Services Won't Start
Check container logs for errors:
the0 local logs api
the0 local logs bot-runner
the0 local logs bot-schedulerMemory Issues
Monitor container memory usage:
docker statsIncrease Docker's memory allocation in Docker Desktop settings if containers are being killed.
Database Connection Failures
Verify database health:
the0 local statusClean Rebuild
If issues persist, perform a clean rebuild:
the0 local stop
docker system prune -a
docker volume prune
the0 local startProduction Considerations
Docker Compose works for small production deployments with these adjustments:
- Change all default passwords - Update PostgreSQL, MongoDB, MinIO, and JWT secrets
- Enable TLS - Add a reverse proxy (nginx, traefik) for HTTPS termination
- Configure backups - Schedule regular database and storage backups
- Set resource limits - Add memory and CPU limits to all services
- Enable health monitoring - Configure external monitoring for service health
- Restrict network access - Infrastructure services should not be publicly accessible
For multi-node deployments or high availability requirements, consider Kubernetes.