curated_compose/docker/headroom/compose.yaml

122 lines
4.8 KiB
YAML
Raw Permalink Normal View History

2026-06-15 21:43:10 -04:00
name: headroom
services:
# ===========================================================================
# CLI — interactive session for ad-hoc headroom commands
# Not needed for production proxy operation.
# Only start when you need to run headroom commands manually.
# ===========================================================================
cli:
image: ${HEADROOM_IMAGE:-ghcr.io/chopratejas/headroom:latest}
entrypoint: ["headroom"]
working_dir: /workspace
stdin_open: true
tty: true
profiles:
- cli
env_file:
- .env
environment:
HOME: /tmp/headroom-home
HEADROOM_WORKSPACE_DIR: /tmp/headroom-home/.headroom
HEADROOM_CONFIG_DIR: /tmp/headroom-home/.headroom/config
volumes:
- ${HEADROOM_WORKSPACE:-.}:/workspace
- ${HEADROOM_HOST_HOME:?set HEADROOM_HOST_HOME}/.headroom:/tmp/headroom-home/.headroom
- ${HEADROOM_HOST_HOME:?set HEADROOM_HOST_HOME}/.claude:/tmp/headroom-home/.claude
- ${HEADROOM_HOST_HOME:?set HEADROOM_HOST_HOME}/.codex:/tmp/headroom-home/.codex
- ${HEADROOM_HOST_HOME:?set HEADROOM_HOST_HOME}/.gemini:/tmp/headroom-home/.gemini
command: ["--help"]
networks:
- headroom
# ===========================================================================
# Proxy — drop-in LLM proxy with compression, caching, and persistent memory
#
# Agent (Zed) sends requests → Headroom compresses, caches, adds context → LLM
# Persistent memory (Tier 1): local SQLite + HNSW for session-level context
# Shared memory (Tier 2): Agent queries Chroma directly before sending to proxy
#
# Docs: https://headroom-docs.vercel.app/docs/proxy
# ===========================================================================
proxy:
image: ${HEADROOM_IMAGE:-ghcr.io/chopratejas/headroom:latest}
# Install rtk-ai at startup (auto-detected by Headroom for CLI output filtering)
# Pip sees it's already installed on subsequent restarts — no delay.
entrypoint:
[
"sh",
"-c",
'pip install rtk-ai -q 2>/dev/null && exec headroom proxy "$0" "$@"',
]
restart: unless-stopped
env_file:
- .env
environment:
HOME: /tmp/headroom-home
HEADROOM_HOST: 0.0.0.0
HEADROOM_WORKSPACE_DIR: /tmp/headroom-home/.headroom
HEADROOM_CONFIG_DIR: /tmp/headroom-home/.headroom/config
HEADROOM_TELEMETRY: ${HEADROOM_TELEMETRY:-off}
HEADROOM_LOG_LEVEL: ${HEADROOM_LOG_LEVEL:-INFO}
# Langfuse / OpenTelemetry tracing
# Keys (LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY) come from .env via env_file
LANGFUSE_HOST: http://langfuse-web:3000
LANGFUSE_PUBLIC_KEY: ${LANGFUSE_PUBLIC_KEY}
LANGFUSE_SECRET_KEY: ${LANGFUSE_SECRET_KEY}
OTEL_SERVICE_NAME: headroom-proxy
OTEL_EXPORTER_OTLP_ENDPOINT: http://langfuse-web:3000/api/public/otel/v1
ports:
- "${HEADROOM_PORT:-8787}:${HEADROOM_PORT:-8787}"
volumes:
# Headroom persistent data (memories, config, cache, learn artifacts)
- ${HEADROOM_HOST_HOME:?set HEADROOM_HOST_HOME}/.headroom:/tmp/headroom-home/.headroom
# Agent-specific directories are NOT mounted here — they're for the
# CLI / wrap mode. The proxy only needs the shared .headroom dir.
command:
- "--host"
- "0.0.0.0"
- "--port"
- "${HEADROOM_PORT:-8787}"
- "--openai-api-url"
- "${OPENAI_TARGET_API_URL:-https://api.venice.ai/v1}"
- "--memory"
- "--memory-db-path"
- "/tmp/headroom-home/.headroom/memory.db"
# Traffic learning — writes AGENTS.md / MEMORY.md with failure
# patterns mined from agent sessions
- "--learn"
# healthcheck:
# test: ["CMD", "headroom", "--help"]
# interval: 30s
# timeout: 10s
# retries: 3
# start_period: 15s
deploy:
resources:
limits:
memory: 8G
cpus: "8"
reservations:
memory: 4G
cpus: "2"
networks:
headroom: {}
langfuse:
aliases:
- headroom-proxy
pipeline:
aliases:
- headroom-proxy
networks:
headroom:
name: headroom
driver: bridge
langfuse:
name: langfuse_langfuse
external: true
pipeline:
name: pipeline
external: true