# Busbar — reference Docker Compose file.
#   Docs: https://getbusbar.com/docs/deploy/docker/
#
#   1. Put a config.yaml next to this file (see https://getbusbar.com/docs/getting-started/).
#   2. Put your provider keys + client token in a .env file next to this file, e.g.:
#        ANTHROPIC_KEY=sk-ant-...
#        BUSBAR_CLIENT_TOKEN=a-long-random-string
#   3. docker compose up -d   →   curl -s localhost:8080/healthz
#
# The provider catalog ships inside the image at /etc/busbar/providers.yaml, so you only
# mount config.yaml. Pin an exact tag in production (done below) rather than riding `latest`.

services:
  busbar:
    image: getbusbar/busbar:1.4.1
    restart: unless-stopped
    ports:
      - "8080:8080"                 # public data plane (LLM traffic)
      # The admin plane (:8081) stays on loopback by default and is NOT published here.
      # Expose it only behind mTLS — see the docs.
    environment:
      # Read from .env / the host env — never inline secrets here.
      ANTHROPIC_KEY: ${ANTHROPIC_KEY:-}
      BUSBAR_CLIENT_TOKEN: ${BUSBAR_CLIENT_TOKEN:-}
    volumes:
      - ./config.yaml:/etc/busbar/config.yaml:ro
      # Governance only (per-key budgets/limits): a writable volume for the SQLite store.
      # Set `db_path: /var/lib/busbar/governance.db` in config.yaml to use it.
      - busbar-data:/var/lib/busbar
    healthcheck:
      test: ["CMD", "/usr/local/bin/busbar", "--validate"]
      interval: 30s
      timeout: 5s
      retries: 3

volumes:
  busbar-data:
