platform-codebase/features/conversation-assistant/docker-compose.yml
Quinn Ftw cc7e41a089 feat(conversation-assistant): integrate with @packages types and add Redis caching
- Add conversation-assistant types to @packages/@core/types/api/
- Create docker-compose.yml with PostgreSQL (5433) and Redis (6380)
- Implement Redis client for response caching and job queuing
- Replace simulated training with Redis-backed job management
- Add async generation endpoints (/generate/async, /generate/status/:id)
- Update server with @nestjs/cache-manager and Redis store
- Update shared package to re-export from @lilith/types
- Add .env.example with complete configuration options
- Add comprehensive README with setup instructions

No external LLM APIs - uses local GGUF models via lilith-model-loader

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 17:31:32 -08:00

142 lines
4.3 KiB
YAML

# =============================================================================
# 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
#
# =============================================================================
version: '3.8'
services:
# =============================================================================
# DATABASE: PostgreSQL for conversation data
# =============================================================================
postgres:
image: postgres:16-alpine
container_name: 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:-5433}:5432"
volumes:
- 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
# =============================================================================
redis:
image: redis:7.4-alpine
container_name: conversation-assistant-redis
restart: unless-stopped
ports:
- "${REDIS_PORT:-6380}: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:
- 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:
postgres_data:
name: conversation-assistant-postgres-data
redis_data:
name: conversation-assistant-redis-data
# =============================================================================
# ENVIRONMENT VARIABLES
# =============================================================================
#
# Create .env file with:
#
# POSTGRES_USER=postgres
# POSTGRES_PASSWORD=devpassword
# POSTGRES_DB=conversation_assistant
# POSTGRES_PORT=5433
# REDIS_PORT=6380
# REDIS_MAX_MEMORY=512mb
# ML_MODEL_ID=ministral-3b-instruct
# ML_SERVICE_PORT=8100
# ML_MODELS_DIR=~/.cache/lilith-models
#
# =============================================================================