# Self-contained v0.1 demo stack — EMQX (MQTT broker) + Postgres (durable event log).
# This is ALL the infra the v0.1 demo needs; the full Core is NOT required.
# On a machine already running the Core, skip this and point the demo at the Core's EMQX + garuda_events DB.
#
#   cd platform/deploy && docker compose up -d
#   (then: migrate the DB and run platform/DEMO.md)

name: garuda-v01-demo

services:
  emqx:
    image: emqx/emqx:5.8
    container_name: garuda_demo_emqx
    environment:
      EMQX_NODE__COOKIE: garuda_demo_cookie
      EMQX_DASHBOARD__DEFAULT_USERNAME: admin
      EMQX_DASHBOARD__DEFAULT_PASSWORD: garuda_demo_admin
      # demo brokers accept anonymous MQTT (default in EMQX when no auth chain is configured).
    ports:
      - "1883:1883"     # MQTT (device sim + engine consumer)
      - "18083:18083"   # dashboard (optional, http://<server>:18083)
    healthcheck:
      test: ["CMD", "emqx", "ctl", "status"]
      interval: 5s
      timeout: 5s
      retries: 20
    restart: unless-stopped

  garuda-events-db:
    image: postgres:16-alpine
    container_name: garuda_events_db
    environment:
      POSTGRES_DB: garuda_events
      POSTGRES_USER: garuda
      POSTGRES_PASSWORD: garuda_dev_password
    ports:
      - "5440:5432"     # durable event log (matches the demo defaults)
    volumes:
      - garuda_events_pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U garuda -d garuda_events"]
      interval: 3s
      timeout: 3s
      retries: 20
    restart: unless-stopped

volumes:
  garuda_events_pgdata:
