G

Docker Compose

Deploy GalaxDB with Docker Compose for a reproducible, production-ready setup with persistent volumes, health checks, and optional Prometheus monitoring.

docker-compose.yml

Basic deployment with embeddings:

docker-compose.yml
version: '3.8'

services:
  galaxdb:
    image: harbi256/galaxdb:latest
    container_name: galaxdb
    restart: unless-stopped
    ports:
      - "5433:5433"
      - "9090:9090"
    volumes:
      - galaxdb_data:/data
      - huggingface_cache:/root/.cache/huggingface
    command:
      - --data-dir
      - /data
      - --port
      - "5433"
      - --observe-port
      - "9090"
      - --sidecar
      - /usr/local/bin/galaxdb-sidecar
      - --model
      - sentence-transformers/all-MiniLM-L6-v2
    environment:
      - GALAXDB_LOG_LEVEL=info
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9090/health"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s

volumes:
  galaxdb_data:
    driver: local
  huggingface_cache:
    driver: local
bash
# Start
docker compose up -d

# Check status
docker compose ps

# View logs
docker compose logs -f galaxdb

# Stop
docker compose down

With Prometheus

Add Prometheus and Grafana for monitoring:

docker-compose.yml
version: '3.8'

services:
  galaxdb:
    image: harbi256/galaxdb:latest
    restart: unless-stopped
    ports:
      - "5433:5433"
      - "9090:9090"
    volumes:
      - galaxdb_data:/data
      - huggingface_cache:/root/.cache/huggingface
    command:
      - --data-dir
      - /data
      - --sidecar
      - /usr/local/bin/galaxdb-sidecar
      - --model
      - sentence-transformers/all-MiniLM-L6-v2
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9090/health"]
      interval: 10s
      timeout: 5s
      retries: 5

  prometheus:
    image: prom/prometheus:latest
    restart: unless-stopped
    ports:
      - "9091:9090"
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - prometheus_data:/prometheus
    command:
      - --config.file=/etc/prometheus/prometheus.yml
      - --storage.tsdb.retention.time=30d

  grafana:
    image: grafana/grafana:latest
    restart: unless-stopped
    ports:
      - "3000:3000"
    volumes:
      - grafana_data:/var/lib/grafana
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=admin

volumes:
  galaxdb_data:
  huggingface_cache:
  prometheus_data:
  grafana_data:
prometheus.yml
global:
  scrape_interval: 15s

scrape_configs:
  - job_name: 'galaxdb'
    static_configs:
      - targets: ['galaxdb:9090']
    metrics_path: /metrics

Persistent Volumes

For production, use named volumes or bind mounts to ensure data persists across container restarts and upgrades:

YAML
# Named volumes (managed by Docker)
volumes:
  galaxdb_data:
    driver: local

# Bind mount (explicit host path)
services:
  galaxdb:
    volumes:
      - /var/lib/galaxdb:/data
      - /var/cache/huggingface:/root/.cache/huggingface

Tip

Bind mounts give you direct access to the data directory from the host, which is useful for backups. Named volumes are easier to manage with Docker but requiredocker volume inspect to find the host path.

Health Checks

The health check configuration ensures Docker waits for GalaxDB to be ready before marking the container as healthy:

YAML
healthcheck:
  test: ["CMD", "curl", "-f", "http://localhost:9090/health"]
  interval: 10s      # Check every 10 seconds
  timeout: 5s        # Fail if no response in 5 seconds
  retries: 5         # Mark unhealthy after 5 consecutive failures
  start_period: 30s  # Grace period for model download on first start

Other services can depend on GalaxDB being healthy:

YAML
services:
  myapp:
    image: myapp:latest
    depends_on:
      galaxdb:
        condition: service_healthy