140 lines
4.5 KiB
YAML
Executable file
140 lines
4.5 KiB
YAML
Executable file
# =============================================================================
|
|
# CONVERSATION ASSISTANT: Development Environment
|
|
# =============================================================================
|
|
#
|
|
# Complete development stack for conversation-assistant feature.
|
|
# Uses Redis for response caching and job queuing.
|
|
#
|
|
# Usage:
|
|
# docker-compose up -d # Start all services
|
|
# docker-compose logs -f # Follow logs
|
|
# docker-compose down # Stop all services
|
|
#
|
|
# Services:
|
|
# - postgres: PostgreSQL database for persistence
|
|
# - redis: Response cache and job queue
|
|
# - ml-service: Python FastAPI for LLM inference (optional, can run locally)
|
|
#
|
|
# Network:
|
|
# - All services on bridge network for development
|
|
# - Production uses infrastructure/docker/docker-compose.databases.yml
|
|
#
|
|
# =============================================================================
|
|
|
|
services:
|
|
# =============================================================================
|
|
# DATABASE: PostgreSQL for conversation data
|
|
# =============================================================================
|
|
conversation-assistant-postgres:
|
|
image: postgres:16-alpine
|
|
container_name: lilith-conversation-assistant-postgres
|
|
restart: unless-stopped
|
|
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-devpassword}
|
|
POSTGRES_DB: ${POSTGRES_DB:-conversation_assistant}
|
|
|
|
ports:
|
|
- "${POSTGRES_PORT:-25433}:5432"
|
|
|
|
volumes:
|
|
- conversation-assistant-postgres-data:/var/lib/postgresql/data
|
|
|
|
healthcheck:
|
|
test: ['CMD-SHELL', 'pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-conversation_assistant}']
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# =============================================================================
|
|
# CACHE & QUEUE: Redis for response caching and job management
|
|
# =============================================================================
|
|
conversation-assistant-redis:
|
|
image: redis:7.4-alpine
|
|
container_name: lilith-conversation-assistant-redis
|
|
restart: unless-stopped
|
|
|
|
ports:
|
|
- "${REDIS_PORT:-26380}:6379"
|
|
|
|
command:
|
|
- redis-server
|
|
- --appendonly
|
|
- "yes"
|
|
- --appendfsync
|
|
- "everysec"
|
|
- --maxmemory
|
|
- "${REDIS_MAX_MEMORY:-512mb}"
|
|
- --maxmemory-policy
|
|
- "allkeys-lru"
|
|
# No password in dev for simplicity
|
|
# Production uses infrastructure Redis with auth
|
|
|
|
volumes:
|
|
- conversation-assistant-redis-data:/data
|
|
|
|
healthcheck:
|
|
test: ['CMD', 'redis-cli', 'ping']
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
# =============================================================================
|
|
# ML SERVICE: Python FastAPI (optional - can run locally for GPU access)
|
|
# =============================================================================
|
|
# Uncomment to run ML service in Docker (CPU-only, no GPU passthrough)
|
|
# For GPU inference, run locally: cd ml-service && python -m uvicorn src.main:app
|
|
#
|
|
# ml-service:
|
|
# build:
|
|
# context: ./ml-service
|
|
# dockerfile: Dockerfile
|
|
# container_name: conversation-assistant-ml
|
|
# restart: unless-stopped
|
|
#
|
|
# environment:
|
|
# ML_SERVICE_HOST: 0.0.0.0
|
|
# ML_SERVICE_PORT: 8100
|
|
# ML_SERVICE_MODEL_ID: ${ML_MODEL_ID:-ministral-3b-instruct}
|
|
# ML_SERVICE_REDIS_URL: redis://redis:6379
|
|
#
|
|
# ports:
|
|
# - "${ML_SERVICE_PORT:-8100}:8100"
|
|
#
|
|
# depends_on:
|
|
# redis:
|
|
# condition: service_healthy
|
|
#
|
|
# volumes:
|
|
# - ${ML_MODELS_DIR:-~/.cache/lilith-models}:/root/.cache/lilith-models
|
|
#
|
|
# healthcheck:
|
|
# test: ['CMD', 'curl', '-f', 'http://localhost:8100/health']
|
|
# interval: 30s
|
|
# timeout: 10s
|
|
# retries: 3
|
|
|
|
volumes:
|
|
conversation-assistant-postgres-data:
|
|
name: lilith-${LILITH_ENV:-dev}-conversation-assistant-postgres-data
|
|
conversation-assistant-redis-data:
|
|
name: lilith-${LILITH_ENV:-dev}-conversation-assistant-redis-data
|
|
|
|
# =============================================================================
|
|
# ENVIRONMENT VARIABLES
|
|
# =============================================================================
|
|
#
|
|
# Create .env file with:
|
|
#
|
|
# POSTGRES_USER=postgres
|
|
# POSTGRES_PASSWORD=devpassword
|
|
# POSTGRES_DB=conversation_assistant
|
|
# POSTGRES_PORT=25433
|
|
# REDIS_PORT=26380
|
|
# REDIS_MAX_MEMORY=512mb
|
|
# ML_MODEL_ID=ministral-3b-instruct
|
|
# ML_SERVICE_PORT=8100
|
|
# ML_MODELS_DIR=~/.cache/lilith-models
|
|
#
|
|
# =============================================================================
|