glam/backend/valkey/docker-compose.yaml
2025-12-10 23:51:51 +01:00

70 lines
1.5 KiB
YAML

# Docker Compose for GLAM Valkey Semantic Cache
#
# This deploys:
# - Valkey (Redis-compatible) for shared cache storage
# - FastAPI backend for cache API
#
# Usage:
# docker-compose up -d
# docker-compose logs -f valkey-api
version: '3.8'
services:
# Valkey - Redis-compatible in-memory store
valkey:
image: valkey/valkey:8-alpine
container_name: glam-valkey
restart: unless-stopped
ports:
- "127.0.0.1:6379:6379" # Only bind to localhost
volumes:
- valkey-data:/data
command: >
valkey-server
--appendonly yes
--maxmemory 512mb
--maxmemory-policy allkeys-lru
--save 60 1
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- glam-cache
# FastAPI Cache API
valkey-api:
build:
context: .
dockerfile: Dockerfile
container_name: glam-valkey-api
restart: unless-stopped
ports:
- "127.0.0.1:8090:8090" # Only bind to localhost, Caddy will proxy
environment:
- VALKEY_HOST=valkey
- VALKEY_PORT=6379
- VALKEY_DB=0
- CACHE_TTL_SECONDS=86400
- MAX_CACHE_ENTRIES=10000
- SIMILARITY_THRESHOLD=0.92
depends_on:
valkey:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8090/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
- glam-cache
volumes:
valkey-data:
name: glam-valkey-data
networks:
glam-cache:
name: glam-cache-network