Docker Deployment
Deploy Dits using Docker for quick setup and easy management. Perfect for development, testing, and small production deployments.
Quick Start
Get Dits running in under 5 minutes with Docker Compose.
Prerequisites
- Docker 20.10 or later
- Docker Compose v2.0 or later
- 4GB RAM minimum (8GB recommended)
- 20GB disk space minimum
Quick Start with Docker Compose
1. Create docker-compose.yml
version: "3.8"
services:
dits:
image: dits/dits-server:latest
ports:
- "8080:8080"
environment:
- DATABASE_URL=postgres://dits:ditspass@postgres:5432/dits
- REDIS_URL=redis://redis:6379
- JWT_SECRET=your-secure-secret-here
- STORAGE_TYPE=local
- STORAGE_PATH=/data/chunks
volumes:
- dits-data:/data
depends_on:
- postgres
- redis
postgres:
image: postgres:15-alpine
environment:
- POSTGRES_USER=dits
- POSTGRES_PASSWORD=ditspass
- POSTGRES_DB=dits
volumes:
- postgres-data:/var/lib/postgresql/data
redis:
image: redis:7-alpine
volumes:
- redis-data:/data
volumes:
dits-data:
postgres-data:
redis-data:2. Start the Stack
# Start all services
docker compose up -d
# Check status
docker compose ps
# View logs
docker compose logs -f dits3. Verify Installation
# Check health endpoint
curl http://localhost:8080/health
# Configure CLI to use local server
dits remote add local http://localhost:8080Production Configuration
Production docker-compose.yml
Enhanced configuration with security and monitoring
version: "3.8"
services:
dits:
image: dits/dits-server:latest
restart: always
ports:
- "8080:8080"
environment:
- DATABASE_URL=${DATABASE_URL}
- REDIS_URL=${REDIS_URL}
- JWT_SECRET=${JWT_SECRET}
- LOG_LEVEL=info
- METRICS_ENABLED=true
volumes:
- dits-data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
cpus: '4'
memory: 8G
postgres:
image: postgres:15-alpine
restart: always
environment:
- POSTGRES_USER=dits
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
- POSTGRES_DB=dits
volumes:
- postgres-data:/var/lib/postgresql/data
secrets:
- db_password
redis:
image: redis:7-alpine
restart: always
command: redis-server --appendonly yes
volumes:
- redis-data:/data
secrets:
db_password:
file: ./secrets/db_password.txt
volumes:
dits-data:
postgres-data:
redis-data:Environment Variables
| Variable | Description | Required |
|---|---|---|
| DATABASE_URL | PostgreSQL connection string | |
| REDIS_URL | Redis connection URL | Optional |
| JWT_SECRET | Secret for token signing | |
| STORAGE_PATH | Path for chunk storage | Default: /data |
| LOG_LEVEL | Logging verbosity | Default: info |
Maintenance
Backup
# Backup database
docker exec dits-postgres \
pg_dump -U dits dits > backup.sql
# Backup volumes
docker run --rm \
-v dits-data:/data \
-v $(pwd):/backup \
alpine tar cvzf /backup/data.tar.gz /dataUpdates
# Pull latest images
docker compose pull
# Restart with new images
docker compose up -d
# Check status
docker compose psNext Steps
For high-availability production deployments, consider using Kubernetes for automatic scaling and failover.