Skip to main content

Docker Compose Guide

ClaraVerse ships a single docker-compose.yml that starts all six services. This page covers every service, its resource limits, volumes, health checks, and how to customize the deployment.

Quick Start​

git clone https://github.com/claraverse-space/ClaraVerse.git
cd ClaraVerse
cp .env.example .env

# Generate required secrets
echo "ENCRYPTION_MASTER_KEY=$(openssl rand -hex 32)" >> .env
echo "JWT_SECRET=$(openssl rand -hex 64)" >> .env

# Start all services
docker compose up -d --build

The frontend is available at http://localhost and the backend API at http://localhost:3001. The first user to register becomes admin.

Service Details​

Frontend​

SettingValue
ImageBuilt from ./frontend/Dockerfile
Containerclaraverse-frontend
Port80:80
Depends onBackend (healthy)
Health checkwget http://127.0.0.1/health every 30s

The frontend is a production Vite build served by Nginx. Build-time args VITE_API_BASE_URL and VITE_WS_URL are baked into the bundle at build.

Backend​

SettingValue
ImageBuilt from ./backend/Dockerfile
Containerclaraverse-backend
Port3001:3001
Memory limit1 GB
CPU limit2.0
Depends onMongoDB, MySQL, Redis, SearXNG (all healthy)
Health checkwget http://localhost:3001/health every 30s

Volumes:

VolumeMount PointPurpose
backend-data/app/dataPersistent application data
backend-uploads/app/uploadsUser file uploads
backend-logs/app/logsApplication logs

MongoDB​

SettingValue
Imagemongo:7
Containerclaraverse-mongodb
Port27017:27017
Memory limit1 GB
CPU limit1.0
Health checkmongosh --eval "db.adminCommand('ping')" every 30s

Volume: mongodb-data mounted at /data/db

MySQL​

SettingValue
Imagemysql:8.0
Containerclaraverse-mysql
Port3306:3306
Memory limit2 GB
CPU limit1.0
Health checkmysqladmin ping every 10s
Character setutf8mb4 / utf8mb4_unicode_ci

Volumes:

VolumeMount PointPurpose
mysql-data-new/var/lib/mysqlDatabase files
./backend/migrations/docker-entrypoint-initdb.d (read-only)Auto-run migrations on first start

Redis​

SettingValue
Imageredis:7-alpine
Containerclaraverse-redis
Port6379:6379
Max memory100 MB (LRU eviction)
Health checkredis-cli ping every 10s
PersistenceAOF (append-only file)

Volume: redis-data mounted at /data

SearXNG​

SettingValue
Imagesearxng/searxng:latest
Containerclaraverse-searxng
PortInternal only (8080)
Health checkwget http://localhost:8080/ every 30s
Config./searxng/settings.yml mounted read-only

SearXNG is not exposed to the host by default. The backend accesses it over the internal Docker network at http://searxng:8080.

Port Mapping Reference​

Host PortContainerService
80frontend:80Web UI (Nginx)
3001backend:3001API + WebSocket
27017mongodb:27017MongoDB
3306mysql:3306MySQL
6379redis:6379Redis

To change a host port, edit the left side of the mapping in docker-compose.yml:

ports:
- "8080:80" # Frontend on port 8080 instead of 80

Volumes​

All named volumes use the local driver by default:

VolumeServicePurpose
backend-dataBackendApplication data
backend-uploadsBackendFile uploads
backend-logsBackendLog files
mongodb-dataMongoDBDatabase files
mysql-data-newMySQLDatabase files
redis-dataRedisAOF persistence

To back up a volume:

docker run --rm -v claraverseai_mongodb-data:/data -v $(pwd):/backup \
alpine tar czf /backup/mongodb-backup.tar.gz -C /data .

Enabling the E2B Service (Optional)​

E2B provides sandboxed Python code execution. To enable it:

  1. Get an API key from e2b.dev/dashboard.
  2. Set E2B_API_KEY in your .env file.
  3. Uncomment the e2b-service block in docker-compose.yml:
e2b-service:
build:
context: ./backend/e2b-service
dockerfile: Dockerfile
container_name: claraverse-e2b
environment:
- E2B_API_KEY=${E2B_API_KEY}
restart: unless-stopped
healthcheck:
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:8001/health')"]
interval: 30s
timeout: 10s
start_period: 5s
retries: 3
networks:
- claraverse-network

The backend automatically connects to http://e2b-service:8001.

Common Operations​

Rebuild a single service​

docker compose up -d --build backend

View logs​

docker compose logs -f backend
docker compose logs -f --tail 100 mysql

Restart all services​

docker compose restart

Stop everything​

docker compose down

Reset all data (destructive)​

docker compose down -v
docker compose up -d --build

Check service health​

docker compose ps

The STATUS column shows healthy, starting, or unhealthy for each service.

Resource Requirements​

Minimum recommended for a single-server deployment:

ResourceMinimumRecommended
CPU2 cores4 cores
RAM4 GB8 GB
Disk10 GB20 GB+

The total memory limits configured in docker-compose.yml sum to ~4 GB (MongoDB 1 GB + MySQL 2 GB + Backend 1 GB + Redis 100 MB). The remaining RAM is used by the frontend Nginx process, SearXNG, and the OS.