Complete Docker Compose environment for developing and testing the ThemisDB LoRA framework.
- Docker β₯ 20.10
- Docker Compose β₯ 2.0
- Hardware: 4GB RAM minimum, 8GB recommended
# Clone the repository (if not already done)
git clone https://github.com/makr-code/ThemisDB.git
cd ThemisDB/docker
# Start all services
./scripts/start.shThat's it! The environment is now running.
Once started, access these services:
| Service | URL | Credentials |
|---|---|---|
| ThemisDB API | http://localhost:8529 | None (dev mode) |
| Prometheus | http://localhost:9091 | None |
| Grafana | http://localhost:3000 | admin / admin |
The Docker Compose setup includes:
-
themisdb - Main ThemisDB instance with LoRA framework
- Ports: 8529 (HTTP), 8765 (AQL), 9090 (metrics)
- Built from
Dockerfile.themisdb - Persistent volumes for data and logs
-
prometheus - Metrics collection and monitoring
- Port: 9091 (offset to avoid conflict)
- Scrapes metrics from ThemisDB every 15s
- 30-day retention by default
-
grafana - Metrics visualization
- Port: 3000
- Pre-configured with Prometheus datasource
- Pre-loaded LoRA framework dashboard
-
test-db - Isolated test database instance
- Port: 8530
- Used for integration tests
- Separate data volume
-
vcpkg-builder - Dependency cache service
- Caches vcpkg packages across builds
- Speeds up rebuild times
All services run on a private bridge network (themis-network) with subnet 172.28.0.0/16.
Persistent data stored in Docker volumes:
themisdb-data- Database filesthemisdb-logs- Application logsprometheus-data- Metrics historygrafana-data- Dashboards and settingsvcpkg-cache- Build dependencies cache
Start with optimized builds and production settings:
./scripts/start.sh prodStart with debug builds, hot-reload, and development tools:
./scripts/start.sh devFeatures:
- Source code mounted for live editing
- Debug symbols enabled
- AddressSanitizer for memory debugging
- Additional debugging ports exposed
- Development tools container included
Access development container:
docker-compose exec dev-tools bashRun automated tests in isolated environment:
./scripts/start.sh testFeatures:
- Runs all LoRA framework tests
- Uses ephemeral storage (tmpfs)
- Exits automatically after tests
- Resource limits for CI environments
Edit config/themisdb.yaml to customize:
- Server ports and networking
- Storage and database settings
- LoRA framework parameters
- Logging levels
- Performance tuning
Example:
llm:
lora:
enabled: true
adapters:
max_loaded: 5
cache_size_mb: 1024Edit prometheus/prometheus.yml to:
- Add scrape targets
- Configure retention policies
- Set up alerting rules
Add custom dashboards to grafana/dashboards/. They will be auto-loaded on startup.
# All services
./scripts/logs.sh
# Specific service
./scripts/logs.sh themisdb
# Follow logs
./scripts/logs.sh -f# Stop services (preserve data)
./scripts/stop.sh
# Stop and remove all data
./scripts/stop.sh --clean# WARNING: Deletes all data!
./scripts/reset.sh./scripts/test.sh# Rebuild specific service
docker-compose build themisdb
# Rebuild all services
docker-compose build
# Rebuild and restart
docker-compose up -d --build# ThemisDB shell
docker-compose exec themisdb bash
# Run tests manually
docker-compose exec themisdb /usr/local/bin/test_lora_framework
# Run benchmarks
docker-compose exec themisdb /usr/local/bin/bench_lora_frameworkAccess Grafana at http://localhost:3000 (admin/admin).
Pre-loaded dashboards:
- LoRA Framework Overview - Key metrics and performance
- Adapter load times
- Memory usage
- Cache hit rates
- Inference latency
Access Prometheus at http://localhost:9091.
Key LoRA metrics:
lora_adapter_load_time_seconds- Time to load adapterslora_adapter_memory_usage_bytes- Memory per adapterlora_inference_latency_milliseconds- Inference timelora_cache_hit_rate- Cache efficiencylora_adapters_loaded_count- Number of loaded adapterslora_training_progress- Training job progress
Check ports are available:
# Check if ports are in use
lsof -i :8529
lsof -i :9091
lsof -i :3000
# Stop conflicting services or change ports in docker-compose.ymlCheck Docker resources:
# Ensure Docker has enough resources (Settings > Resources)
# Minimum: 4GB RAM, 2 CPUsClear Docker cache:
docker-compose build --no-cache
docker system prune -aCheck vcpkg cache:
# Remove vcpkg cache if corrupted
docker volume rm themisdb-lora_vcpkg-cache
docker volume rm themisdb-lora_vcpkg-downloadsCheck logs:
./scripts/logs.sh themisdbCheck resource usage:
docker statsIncrease memory limits:
Edit docker-compose.yml and increase memory limits.
Re-provision dashboards:
docker-compose restart grafana
# Or manually import from grafana/dashboards/Verify service is healthy:
docker-compose ps
curl http://localhost:8529/healthWait for startup: ThemisDB needs 30-40 seconds to fully initialize.
Run tests with verbose output:
docker-compose exec themisdb /usr/local/bin/test_lora_framework --gtest_verbose=trueCheck test database:
curl http://localhost:8530/health-
Use cached builds:
# vcpkg cache is preserved across builds docker-compose build # Fast after first build
-
Parallel builds:
# Already configured in Dockerfile with -j$(nproc) -
Layer caching:
# Dockerfile uses multi-stage builds for optimal caching
-
Allocate more resources: Edit
.envordocker-compose.yml:deploy: resources: limits: cpus: '4' memory: 8G
-
Use SSD for volumes: Docker volumes should be on SSD for best performance.
-
Tune ThemisDB settings: Edit
config/themisdb.yaml:performance: thread_pool_size: 8 query_cache_size_mb: 512
For production deployment:
- Use proper secrets management (not hardcoded passwords)
- Enable authentication and TLS
- Configure proper resource limits
- Set up monitoring and alerting
- Use orchestration (Kubernetes, Docker Swarm)
- Configure backups and disaster recovery
- Change default passwords
- Enable authentication (Grafana, ThemisDB)
- Configure TLS/SSL certificates
- Set up proper logging and log rotation
- Configure resource limits and health checks
- Set up monitoring and alerting
- Configure automated backups
- Test disaster recovery procedures
- Set up proper networking and firewalls
- Review security best practices
- LoRA Build Guide - Building without Docker
- LoRA Testing Guide - Detailed testing
- LoRA Usage Examples - API usage
- Docker Build Strategy - Build details
When making changes:
- Test with all three modes (prod, dev, test)
- Update this README if adding new features
- Validate configurations before committing
- Keep Docker images lean and efficient
This Docker setup is part of ThemisDB and follows the same license (MIT).
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: ThemisDB Docs
Happy Developing! π