Backend startup needs ~30-60s (spaCy NLP models load, mem0 v2 init, MCP session manager, 4 workers). The Dockerfile's 5s start-period was too short, causing willfarrell/autoheal (running on the host with AUTOHEAL_CONTAINER_LABEL=all) to kill the container before it finished booting. Overriding the healthcheck in compose with a longer start_period keeps failures from counting until the app is actually ready.
72 lines
2.1 KiB
YAML
72 lines
2.1 KiB
YAML
services:
|
|
# Qdrant vector database for vector + sparse (BM25) storage
|
|
qdrant:
|
|
image: qdrant/qdrant:v1.18.1
|
|
container_name: mem0-qdrant
|
|
expose:
|
|
- "6333"
|
|
networks:
|
|
- mem0_network
|
|
volumes:
|
|
- qdrant_data:/qdrant/storage
|
|
command: >
|
|
sh -c "apt-get update && apt-get install -y curl && ./entrypoint.sh"
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:6333/"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
# Backend API service
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: mem0-backend
|
|
environment:
|
|
OPENAI_API_KEY: ${OPENAI_COMPAT_API_KEY}
|
|
OPENAI_BASE_URL: ${OPENAI_COMPAT_BASE_URL}
|
|
COHERE_API_KEY: ${COHERE_API_KEY}
|
|
EMBEDDER_API_KEY: ${EMBEDDER_API_KEY:-AIzaSyA_}
|
|
QDRANT_HOST: qdrant
|
|
QDRANT_PORT: 6333
|
|
QDRANT_COLLECTION_NAME: ${QDRANT_COLLECTION_NAME:-mem0}
|
|
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
|
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:3000}
|
|
DEFAULT_MODEL: ${DEFAULT_MODEL:-claude-sonnet-4}
|
|
API_KEYS: ${API_KEYS:-{}}
|
|
OLLAMA_BASE_URL: ${OLLAMA_BASE_URL:-http://host.docker.internal:11434}
|
|
EMBEDDING_MODEL: ${EMBEDDING_MODEL:-nomic-embed-text}
|
|
EMBEDDING_DIMS: ${EMBEDDING_DIMS:-2560}
|
|
expose:
|
|
- "8000"
|
|
networks:
|
|
- npm_network
|
|
- mem0_network
|
|
depends_on:
|
|
qdrant:
|
|
condition: service_healthy
|
|
# Backend startup loads spaCy (NLP extra), initializes mem0 v2, mounts MCP,
|
|
# and warms 4 workers — needs ~30-60s. start_period below keeps healthcheck
|
|
# failures from counting (and from triggering willfarrell/autoheal) during
|
|
# boot.
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 90s
|
|
restart: unless-stopped
|
|
volumes:
|
|
- ./backend:/app
|
|
- ./frontend:/app/frontend
|
|
command: ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]
|
|
|
|
volumes:
|
|
qdrant_data:
|
|
|
|
networks:
|
|
mem0_network:
|
|
npm_network:
|
|
external: true
|