Docker Compose Deployment
Docker Compose provides the fastest path to a running the0 platform. A single command starts all services with development-ready defaults, 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
- Docker Compose 2.0 or later (included with Docker Desktop)
- 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
Navigate to the docker directory and start all services:
cd docker
make upThe command builds all container images and starts the services. Initial 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 Makefile provides commands for common operations:
# Start all services
make up
# Stop all services
make down
# Restart with fresh builds
make restart
# View logs (all services)
make logs
# View logs for specific service
make logs service=the0-apiFor development with hot reload:
# Start with hot reload enabled
make dev-up
# Stop development environment
make dev-downConfiguration
The docker-compose.yml file contains all configuration. Key environment variables you may want to modify:
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:
make down
docker volume rm $(docker volume ls -q | grep the0)
make upBackup and Restore
Database Backup
# PostgreSQL backup
docker compose exec postgres pg_dump -U the0 the0_oss > backup.sql
# PostgreSQL restore
docker compose 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 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:
docker compose logs the0-api
docker compose logs bot-runner
docker compose logs bot-schedulerPort Conflicts
If ports are already in use, modify the port mappings in docker-compose.yml:
ports:
- "3100:3000" # Map to different host portMemory 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:
docker compose exec postgres pg_isready -U the0
docker compose exec mongo mongosh --eval "db.runCommand('ping')"Clean Rebuild
If issues persist, perform a clean rebuild:
make down
docker system prune -a
docker volume prune
make upProduction 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.