Model Loader: - Update model_loader.py with complete dots.ocr loading code - Proper device detection (CUDA/CPU/MPS) with fallback - Memory optimization (low_cpu_mem_usage) - Better error handling and logging - Support for local model paths and HF Hub Docker: - Multi-stage Dockerfile (CPU/CUDA builds) - docker-compose.yml for parser-service - .dockerignore for clean builds - Model cache volume for persistence Configuration: - Support DOTS_OCR_MODEL_ID and DEVICE env vars (backward compatible) - Better defaults and environment variable handling Deployment: - Add DEPLOYMENT.md with detailed instructions - Local deployment (venv) - Docker Compose deployment - Ollama runtime setup - Troubleshooting guide Integration: - Add parser-service to main docker-compose.yml - Configure volumes and networks - Health checks and dependencies
238 lines
6.1 KiB
YAML
238 lines
6.1 KiB
YAML
services:
|
|
# DAGI Router - Core routing service
|
|
router:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: dagi-router
|
|
ports:
|
|
- "9102:9102"
|
|
environment:
|
|
- DAGI_ROUTER_CONFIG=/app/router-config.yml
|
|
- RBAC_BASE_URL=http://rbac:9200
|
|
- DEVTOOLS_BASE_URL=http://devtools:8008
|
|
- CREWAI_BASE_URL=http://crewai:9010
|
|
volumes:
|
|
- ./router-config.yml:/app/router-config.yml:ro
|
|
- ./logs:/app/logs
|
|
depends_on:
|
|
- devtools
|
|
- crewai
|
|
- rbac
|
|
networks:
|
|
- dagi-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9102/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
# DevTools Backend
|
|
devtools:
|
|
build:
|
|
context: ./devtools-backend
|
|
dockerfile: Dockerfile
|
|
container_name: dagi-devtools
|
|
ports:
|
|
- "8008:8008"
|
|
volumes:
|
|
- ./workspace:/workspace
|
|
- ./logs:/app/logs
|
|
networks:
|
|
- dagi-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8008/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# CrewAI Orchestrator
|
|
crewai:
|
|
build:
|
|
context: ./orchestrator
|
|
dockerfile: Dockerfile
|
|
container_name: dagi-crewai
|
|
ports:
|
|
- "9010:9010"
|
|
environment:
|
|
- ROUTER_URL=http://router:9102
|
|
volumes:
|
|
- ./logs:/app/logs
|
|
networks:
|
|
- dagi-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9010/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# Bot Gateway (with DAARWIZZ)
|
|
gateway:
|
|
build:
|
|
context: ./gateway-bot
|
|
dockerfile: Dockerfile
|
|
container_name: dagi-gateway
|
|
ports:
|
|
- "9300:9300"
|
|
environment:
|
|
- ROUTER_URL=http://router:9102
|
|
- MEMORY_SERVICE_URL=http://memory-service:8000
|
|
- STT_SERVICE_URL=http://stt-service:9000
|
|
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN:-}
|
|
- DISCORD_BOT_TOKEN=${DISCORD_BOT_TOKEN:-}
|
|
- DAARWIZZ_NAME=DAARWIZZ
|
|
- DAARWIZZ_PROMPT_PATH=/app/gateway-bot/daarwizz_prompt.txt
|
|
volumes:
|
|
- ./logs:/app/logs
|
|
depends_on:
|
|
- router
|
|
- memory-service
|
|
- stt-service
|
|
networks:
|
|
- dagi-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9300/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# microDAO RBAC Service
|
|
rbac:
|
|
build:
|
|
context: ./microdao
|
|
dockerfile: Dockerfile
|
|
container_name: dagi-rbac
|
|
ports:
|
|
- "9200:9200"
|
|
environment:
|
|
- DATABASE_URL=${RBAC_DATABASE_URL:-sqlite:///rbac.db}
|
|
volumes:
|
|
- ./data/rbac:/app/data
|
|
- ./logs:/app/logs
|
|
networks:
|
|
- dagi-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9200/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# DAARION.city Database (PostgreSQL with pgvector)
|
|
city-db:
|
|
image: pgvector/pgvector:pg16
|
|
container_name: dagi-city-db
|
|
ports:
|
|
- "5432:5432"
|
|
environment:
|
|
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
|
|
- POSTGRES_DB=${POSTGRES_DB:-daarion_city}
|
|
volumes:
|
|
- ./data/postgres:/var/lib/postgresql/data
|
|
- ./supabase/migrations:/docker-entrypoint-initdb.d
|
|
networks:
|
|
- dagi-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Memory Service (user_facts, dialog_summaries, agent_memory_events)
|
|
memory-service:
|
|
build:
|
|
context: ./services/memory-service
|
|
dockerfile: Dockerfile
|
|
container_name: dagi-memory-service
|
|
ports:
|
|
- "8000:8000"
|
|
environment:
|
|
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@city-db:5432/${POSTGRES_DB:-daarion_city}
|
|
- API_HOST=0.0.0.0
|
|
- API_PORT=8000
|
|
volumes:
|
|
- ./services/memory-service:/app
|
|
- ./logs:/app/logs
|
|
depends_on:
|
|
city-db:
|
|
condition: service_healthy
|
|
networks:
|
|
- dagi-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# STT Service (Speech-to-Text using Qwen3 ASR Toolkit)
|
|
stt-service:
|
|
build:
|
|
context: ./services/stt-service
|
|
dockerfile: Dockerfile
|
|
container_name: dagi-stt-service
|
|
ports:
|
|
- "9000:9000"
|
|
environment:
|
|
- DASHSCOPE_API_KEY=${DASHSCOPE_API_KEY:-}
|
|
volumes:
|
|
- ./logs:/app/logs
|
|
networks:
|
|
- dagi-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# PARSER Service (Document OCR using dots.ocr)
|
|
parser-service:
|
|
build:
|
|
context: ./services/parser-service
|
|
dockerfile: Dockerfile
|
|
target: cpu
|
|
container_name: dagi-parser-service
|
|
ports:
|
|
- "9400:9400"
|
|
environment:
|
|
- PARSER_MODEL_NAME=${PARSER_MODEL_NAME:-rednote-hilab/dots.ocr}
|
|
- DOTS_OCR_MODEL_ID=${DOTS_OCR_MODEL_ID:-rednote-hilab/dots.ocr}
|
|
- PARSER_DEVICE=${PARSER_DEVICE:-cpu}
|
|
- DEVICE=${DEVICE:-cpu}
|
|
- RUNTIME_TYPE=${RUNTIME_TYPE:-local}
|
|
- USE_DUMMY_PARSER=${USE_DUMMY_PARSER:-false}
|
|
- ALLOW_DUMMY_FALLBACK=${ALLOW_DUMMY_FALLBACK:-true}
|
|
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://ollama:11434}
|
|
- PARSER_MAX_PAGES=${PARSER_MAX_PAGES:-100}
|
|
- MAX_FILE_SIZE_MB=${MAX_FILE_SIZE_MB:-50}
|
|
- PDF_DPI=${PDF_DPI:-200}
|
|
- IMAGE_MAX_SIZE=${IMAGE_MAX_SIZE:-2048}
|
|
volumes:
|
|
- parser-model-cache:/root/.cache/huggingface
|
|
- ./logs:/app/logs
|
|
networks:
|
|
- dagi-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9400/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
volumes:
|
|
parser-model-cache:
|
|
driver: local
|
|
|
|
networks:
|
|
dagi-network:
|
|
driver: bridge
|
|
name: dagi-network
|