version: "3.9"
services:
  nats:
    image: nats:2.10
    command: ["-js", "-sd", "/data"]
    ports: ["4222:4222","8222:8222"]
    volumes: ["./_data/nats:/data"]

  redis:
    image: redis:7
    ports: ["6379:6379"]

  postgres:
    image: postgres:16
    environment:
      POSTGRES_PASSWORD: tater
      POSTGRES_USER: tater
      POSTGRES_DB: tater
    ports: ["5432:5432"]
    volumes: ["./_data/pg:/var/lib/postgresql/data","./sql:/docker-entrypoint-initdb.d"]

  adminer:
    image: adminer
    ports: ["8080:8080"]

  ingestor:
    build: ./services/ingestor
    environment:
      NATS_URL: nats://nats:4222
      REDIS_URL: redis://redis:6379
      PG_URL: postgres://tater:tater@postgres:5432/tater
      WEBHOOK_SECRET: change-me
    ports: ["3001:3001"]
    depends_on: [nats, redis, postgres]

  coordinator:
    build: ./services/coordinator
    environment:
      NATS_URL: nats://nats:4222
      REDIS_URL: redis://redis:6379
      PG_URL: postgres://tater:tater@postgres:5432/tater
    depends_on: [nats, redis, postgres]
