version: "3.9" # Turnstone with external Postgres DB. # Data lives in the named volume `turnstone_pgdata` — survives image rebuilds. # To adopt an EXISTING Postgres install, set DATABASE_URL to point at it and # remove the `db` service and `depends_on` blocks. # # Quick start: # docker compose up -d # # Then open http://localhost:8520 services: db: image: postgres:16-alpine restart: unless-stopped environment: POSTGRES_DB: turnstone POSTGRES_USER: turnstone POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-turnstone_dev} volumes: - turnstone_pgdata:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U turnstone -d turnstone"] interval: 5s timeout: 5s retries: 5 turnstone: build: . restart: unless-stopped ports: - "${TURNSTONE_PORT:-8520}:8520" depends_on: db: condition: service_healthy environment: # Backend selection — comment out DATABASE_URL to fall back to SQLite DATABASE_URL: postgresql://turnstone:${POSTGRES_PASSWORD:-turnstone_dev}@db:5432/turnstone TURNSTONE_TENANT_ID: ${TURNSTONE_TENANT_ID:-} TURNSTONE_API_KEY: ${TURNSTONE_API_KEY:-} TURNSTONE_GLEAN_INTERVAL: ${TURNSTONE_GLEAN_INTERVAL:-900} TURNSTONE_SOURCE_HOST: ${TURNSTONE_SOURCE_HOST:-} TURNSTONE_SUBMIT_ENDPOINT: ${TURNSTONE_SUBMIT_ENDPOINT:-} # --- Multi-agent diagnose pipeline --- TURNSTONE_MULTI_AGENT_DIAGNOSE: ${TURNSTONE_MULTI_AGENT_DIAGNOSE:-false} TURNSTONE_CLASSIFIER_MODEL: ${TURNSTONE_CLASSIFIER_MODEL:-} TURNSTONE_EMBED_BACKEND: ${TURNSTONE_EMBED_BACKEND:-} TURNSTONE_EMBED_MODEL: ${TURNSTONE_EMBED_MODEL:-} TURNSTONE_EMBED_DEVICE: ${TURNSTONE_EMBED_DEVICE:-cpu} # --- Anomaly scoring pipeline --- TURNSTONE_ANOMALY_MODEL: ${TURNSTONE_ANOMALY_MODEL:-} TURNSTONE_ANOMALY_DEVICE: ${TURNSTONE_ANOMALY_DEVICE:-cpu} TURNSTONE_ANOMALY_THRESHOLD: ${TURNSTONE_ANOMALY_THRESHOLD:-0.75} TURNSTONE_ANOMALY_INTERVAL: ${TURNSTONE_ANOMALY_INTERVAL:-0} # --- HuggingFace model cache --- HF_HOME: /hf_cache volumes: - ./patterns:/app/patterns:ro - ./data:/app/data # optional: persists SQLite files if DATABASE_URL unset - ${HF_CACHE_PATH:-/Library/Assets/LLM}:/hf_cache:ro # shared model cache volumes: turnstone_pgdata: name: turnstone_pgdata