# SenpAI Market-Data Consumer + NATS
# Usage: docker-compose -f docker-compose.senpai.yml up -d
version: "3.8"

services:
  nats:
    image: nats:2.10-alpine
    container_name: senpai-nats
    ports:
      - "4222:4222"
      - "8222:8222"  # monitoring
    command: ["--js", "-m", "8222"]
    restart: unless-stopped

  senpai-md-consumer:
    container_name: senpai-md-consumer
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      - NATS_URL=nats://nats:4222
      - NATS_SUBJECT=md.events.>
      - NATS_QUEUE_GROUP=senpai-md
      - FEATURES_ENABLED=true
      - FEATURES_PUB_RATE_HZ=10
      - LOG_LEVEL=INFO
      - HTTP_PORT=8892
    ports:
      - "8892:8892"
    depends_on:
      - nats
    restart: unless-stopped
    healthcheck:
      test:
        - CMD-SHELL
        - python -c "import urllib.request; urllib.request.urlopen('http://localhost:8892/health')"
      interval: 15s
      timeout: 5s
      retries: 3
      start_period: 10s
