# Token Broker Infrastructure
# PostgreSQL dedicated instance on port 5434
networks:
  turf-net:
    driver: bridge

services:
  token-broker-db:
    image: postgres:16-alpine
    container_name: token-broker-db
    restart: unless-stopped
    environment:
      POSTGRES_DB: token_broker
      POSTGRES_USER: token_broker
      POSTGRES_PASSWORD: ${TOKEN_BROKER_DB_PASSWORD:-CHANGE_ME_PASSWORD}
    volumes:
      - token-broker-pgdata:/var/lib/postgresql/data
      - ./infra/postgres/token_broker_init.sql:/docker-entrypoint-initdb.d/init.sql:ro
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U token_broker -d token_broker"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s
    networks:
      - turf-net
    ports:
      - "127.0.0.1:5434:5432"

volumes:
  token-broker-pgdata:
    driver: local
