Docker Compose Guide
Docker Compose Guide
Complete guide to using Docker Compose for HeliosDB deployments.
Overview
Docker Compose files are organized by environment:
- Development - For local development and testing
- Production - For production deployments
- Examples - Sample configurations and integrations
File Locations
All compose files are in deployment/docker/compose/
Development
| File | Purpose |
|---|---|
development/docker-compose.yml | Full development cluster |
development/docker-compose.simple.yml | Single-node simple setup |
Production
| File | Purpose |
|---|---|
production/docker-compose.yml | Production HA cluster |
Examples
| File | Purpose |
|---|---|
examples/docker-compose.example.yml | Client integration example |
examples/docker-compose.lite.yml | HeliosDB Lite standalone |
Development Deployment
Simple Single-Node (Quick Start)
File: development/docker-compose.simple.yml
Use this for:
- Quick testing
- Feature development
- Minimal resource usage
- Single developer workflow
Start:
cd deployment/docker/compose/developmentdocker-compose -f docker-compose.simple.yml upServices:
- HeliosDB single node (all-in-one)
- Basic monitoring
Ports:
- PostgreSQL: 5432
- MongoDB: 27017
- HTTP API: 8080
Full Development Cluster
File: development/docker-compose.yml
Use this for:
- Distributed features testing
- Multi-node behavior
- Performance testing
- Integration testing
Start:
cd deployment/docker/compose/developmentdocker-compose upServices:
- Storage nodes (3 replicas)
- Compute nodes (2 replicas)
- Metadata nodes (3 replicas)
- Gateway/Router
- Prometheus
- Grafana
- HAProxy
Ports:
- PostgreSQL: 5432
- MongoDB: 27017
- HTTP API: 8080
- Grafana: 3000
- Prometheus: 9090
Access:
# PostgreSQLpsql -h localhost -p 5432 -U heliosdb
# MongoDBmongosh mongodb://localhost:27017
# Grafana UIopen http://localhost:3000# Default: admin/admin
# Prometheusopen http://localhost:9090Production Deployment
High-Availability Cluster
File: production/docker-compose.yml
Features:
- Multi-node storage with replication
- Load balancing
- Health checks
- Resource limits
- Restart policies
- Logging configuration
- Volume management
Prerequisites:
# Create required directoriesmkdir -p /var/lib/heliosdb/{storage,metadata,logs}
# Set permissionschown -R 1000:1000 /var/lib/heliosdbEnvironment Configuration:
Create .env file:
HELIOSDB_VERSION=7.0STORAGE_REPLICAS=3COMPUTE_REPLICAS=2POSTGRES_PASSWORD=changemeMONGO_PASSWORD=changemeADMIN_PASSWORD=changemeStart:
cd deployment/docker/compose/productiondocker-compose up -dVerify:
# Check all services are runningdocker-compose ps
# Check logsdocker-compose logs -f
# Check healthdocker-compose exec gateway heliosdb-cli healthStop:
docker-compose down
# With volume cleanupdocker-compose down -vExamples
Client Integration Example
File: examples/docker-compose.example.yml
Shows how to integrate a client application with HeliosDB.
Services:
- HeliosDB cluster
- Example Node.js application
- Example Python application
Usage:
cd deployment/docker/compose/examplesdocker-compose -f docker-compose.example.yml upHeliosDB Lite
File: examples/docker-compose.lite.yml
Minimal embedded database deployment.
Use for:
- Edge computing
- IoT devices
- Development testing
- Single-application database
Usage:
cd deployment/docker/compose/examplesdocker-compose -f docker-compose.lite.yml upConfiguration
Environment Variables
Common environment variables across all compose files:
Database Configuration
HELIOSDB_PORT=5432 # PostgreSQL protocol portHELIOSDB_MONGO_PORT=27017 # MongoDB protocol portHELIOSDB_HTTP_PORT=8080 # HTTP API portHELIOSDB_LOG_LEVEL=info # Logging: debug, info, warn, errorStorage Configuration
HELIOSDB_STORAGE_PATH=/data # Data directoryHELIOSDB_WAL_PATH=/wal # Write-ahead log directoryHELIOSDB_CACHE_SIZE=512MB # Cache sizeHELIOSDB_MAX_CONNECTIONS=100 # Max client connectionsReplication Configuration
HELIOSDB_REPLICATION_FACTOR=3 # Data replication factorHELIOSDB_CONSISTENCY=quorum # Consistency levelVolume Management
Development Volumes
volumes: heliosdb-data: # Main data volume heliosdb-metadata: # Metadata volume heliosdb-logs: # Logs volumeProduction Volumes
# Use bind mounts for productionvolumes: - /var/lib/heliosdb/storage:/data - /var/lib/heliosdb/metadata:/metadata - /var/log/heliosdb:/logsNetwork Configuration
All compose files use bridge networks:
networks: heliosdb-network: driver: bridge ipam: config: - subnet: 172.20.0.0/16Resource Limits
Production compose file includes resource limits:
services: storage: deploy: resources: limits: cpus: '2' memory: 4G reservations: cpus: '1' memory: 2GScaling
Horizontal Scaling
# Scale storage nodesdocker-compose up -d --scale storage=5
# Scale compute nodesdocker-compose up -d --scale compute=4Vertical Scaling
Edit resource limits in compose file:
services: storage: deploy: resources: limits: cpus: '4' # Increase CPU memory: 8G # Increase RAMMonitoring
Grafana Dashboards
Access: http://localhost:3000
Default credentials: admin/admin
Available dashboards:
- Cluster Overview
- Storage Performance
- Query Performance
- Resource Utilization
Prometheus Metrics
Access: http://localhost:9090
Useful queries:
# Query raterate(heliosdb_queries_total[5m])
# Storage usageheliosdb_storage_bytes_used
# Connection countheliosdb_connections_activeLogs
# All servicesdocker-compose logs -f
# Specific servicedocker-compose logs -f storage
# Last 100 linesdocker-compose logs --tail=100Troubleshooting
Services Won’t Start
Check logs:
docker-compose logs <service-name>Common issues:
- Port already in use
- Insufficient resources
- Volume permissions
Connection Refused
Check service health:
docker-compose psdocker-compose exec <service> heliosdb-cli pingPerformance Issues
Check resource usage:
docker statsIncrease resources:
deploy: resources: limits: cpus: '4' memory: 8GData Persistence
Verify volumes:
docker volume lsdocker volume inspect <volume-name>Backup volumes:
docker run --rm \ -v <volume-name>:/data \ -v $(pwd):/backup \ alpine tar czf /backup/backup.tar.gz /dataBest Practices
Development
- Use named volumes for data persistence
- Enable debug logging for troubleshooting
- Use simple config for quick iteration
- Mount code for hot-reload when applicable
Production
- Use bind mounts for production data
- Set resource limits for all services
- Enable health checks
- Configure restart policies
- Use secrets for sensitive data
- Enable logging drivers
- Regular backups
- Monitor resource usage
Security
# Use secretssecrets: db_password: file: ./secrets/db_password.txt
services: storage: secrets: - db_passwordAdvanced Configurations
Custom Network
networks: heliosdb-backend: driver: bridge internal: true heliosdb-frontend: driver: bridgeHealth Checks
services: storage: healthcheck: test: ["CMD", "heliosdb-cli", "ping"] interval: 10s timeout: 5s retries: 3 start_period: 30sLogging
services: storage: logging: driver: "json-file" options: max-size: "10m" max-file: "3"Migration
From Simple to Full Development
- Stop simple deployment
- Backup data
- Start full development cluster
- Restore data
From Development to Production
See: Migration Guide
Next: Kubernetes Guide