This guide explains how to self-host the Ordo platform using Docker and Docker Compose.
- Docker 20.10+ installed
- Docker Compose 2.0+ installed
- 4GB+ RAM available
- 20GB+ disk space
git clone https://github.com/ordo-platform/ordo.git
cd ordo# Copy environment template
cp .env.example .env
# Edit with your API keys
nano .envRequired variables:
SOLANA_RPC_URL- Helius or custom RPC endpointHELIUS_API_KEY- Helius API keyOPENROUTER_API_KEY- OpenRouter API keySUPABASE_URL- Supabase project URLSUPABASE_ANON_KEY- Supabase anon keySUPABASE_SERVICE_ROLE_KEY- Supabase service role key
# Start all services
docker-compose up -d
# Check status
docker-compose ps
# View logs
docker-compose logs -f ordo# Health check
curl http://localhost:3000/health
# Expected response:
# {"status":"healthy","timestamp":1234567890}The Docker setup includes:
┌─────────────────────────────────────────┐
│ Nginx (Reverse Proxy) │
│ Port 80/443 │
└──────────────┬──────────────────────────┘
│
┌──────────────▼──────────────────────────┐
│ Ordo Platform │
│ Port 3000 │
└──────┬──────────────────┬───────────────┘
│ │
┌──────▼──────┐ ┌──────▼──────┐
│ PostgreSQL │ │ Redis │
│ Port 5432 │ │ Port 6379 │
└─────────────┘ └─────────────┘
Main application service:
ordo:
build: .
ports:
- "3000:3000"
environment:
- NODE_ENV=production
env_file:
- .envLocal database (alternative to Supabase):
postgres:
image: postgres:15-alpine
ports:
- "5432:5432"
environment:
- POSTGRES_USER=ordo
- POSTGRES_PASSWORD=ordo_password
- POSTGRES_DB=ordoCaching and session management:
redis:
image: redis:7-alpine
ports:
- "6379:6379"
command: redis-server --appendonly yesSee .env.example for all available variables.
For local development with hot reload:
# Start with local Solana validator
docker-compose --profile local-validator up -d
# View logs
docker-compose logs -fFor production deployment with Nginx:
# Start with Nginx reverse proxy
docker-compose --profile production up -d
# Configure SSL certificates
# Place certificates in ./ssl/ directoryScale the Ordo service to multiple replicas:
# Scale to 3 replicas
docker-compose up -d --scale ordo=3
# Verify
docker-compose psConfigure resource limits in docker-compose.yml:
ordo:
deploy:
resources:
limits:
cpus: '2'
memory: 4G
reservations:
cpus: '1'
memory: 2G# View all logs
docker-compose logs
# Follow specific service
docker-compose logs -f ordo
# Last 100 lines
docker-compose logs --tail=100 ordo# Real-time stats
docker stats
# Specific container
docker stats ordo-platform# Check health status
docker inspect --format='{{.State.Health.Status}}' ordo-platform
# View health check logs
docker inspect --format='{{json .State.Health}}' ordo-platform | jq# Backup PostgreSQL
docker-compose exec postgres pg_dump -U ordo ordo > backup.sql
# Restore PostgreSQL
docker-compose exec -T postgres psql -U ordo ordo < backup.sql# Backup volumes
docker run --rm \
-v ordo_postgres-data:/data \
-v $(pwd):/backup \
alpine tar czf /backup/postgres-backup.tar.gz /data
# Restore volumes
docker run --rm \
-v ordo_postgres-data:/data \
-v $(pwd):/backup \
alpine tar xzf /backup/postgres-backup.tar.gz -C /# Pull latest code
git pull origin main
# Rebuild and restart
docker-compose build ordo
docker-compose up -d ordo
# Verify
docker-compose logs -f ordo# Rebuild all services
docker-compose build --no-cache
# Restart services
docker-compose up -d# Stop all services
docker-compose down
# Remove volumes (WARNING: deletes data)
docker-compose down -v
# Remove images
docker-compose down --rmi all
# Clean up system
docker system prune -a# Check logs
docker-compose logs ordo
# Check container status
docker-compose ps
# Restart service
docker-compose restart ordo# Check PostgreSQL logs
docker-compose logs postgres
# Test connection
docker-compose exec postgres psql -U ordo -d ordo -c "SELECT 1"
# Restart database
docker-compose restart postgres# Check memory usage
docker stats
# Increase memory limit in docker-compose.yml
# Then restart:
docker-compose up -d# Check port usage
netstat -tulpn | grep :3000
# Change port in docker-compose.yml
ports:
- "3001:3000" # Use different host portServices communicate via internal network:
networks:
ordo-network:
driver: bridgeApplication runs as non-root user:
USER ordoNever commit .env file. Use Docker secrets for production:
secrets:
openrouter_key:
external: true
services:
ordo:
secrets:
- openrouter_keyConfigure SSL certificates for production:
# Generate self-signed certificate (development)
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout ssl/key.pem -out ssl/cert.pem
# Use Let's Encrypt (production)
certbot certonly --standalone -d your-domain.comUse BuildKit for faster builds:
DOCKER_BUILDKIT=1 docker-compose buildDockerfile uses multi-stage builds for smaller images:
FROM node:20-alpine AS builder
# Build stage
FROM node:20-alpine AS production
# Production stageUse volumes for persistent data:
volumes:
- ./data:/app/data
- ./logs:/app/logsMonitor and adjust resource limits:
# Monitor usage
docker stats
# Adjust limits in docker-compose.ymlUse Docker Swarm or Kubernetes for auto-scaling:
# Initialize swarm
docker swarm init
# Deploy stack
docker stack deploy -c docker-compose.yml ordo- Docker Docs: https://docs.docker.com
- Docker Compose Docs: https://docs.docker.com/compose
- Ordo Issues: https://github.com/ordo-platform/ordo/issues
- Configure monitoring and alerting
- Set up automated backups
- Configure SSL certificates
- Implement log aggregation
- Set up CI/CD pipeline