version: "3.9"

# Dev: only PostgreSQL runs here. Run the Go server locally with `make dev`.
# Production: docker compose -f docker-compose.prod.yml up

services:
  nats:
    image: nats:2-alpine
    restart: unless-stopped
    command: ["-js", "-m", "8222"]
    ports:
      - "4222:4222"  # client connections
      - "8222:8222"  # monitoring HTTP
    healthcheck:
      test: ["CMD", "wget", "--spider", "-q", "http://localhost:8222/healthz"]
      interval: 5s
      timeout: 5s
      retries: 10

  postgres:
    image: postgres:18
    restart: unless-stopped
    environment:
      POSTGRES_DB: forgebucket
      POSTGRES_USER: forgebucket
      POSTGRES_PASSWORD: password
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U forgebucket"]
      interval: 5s
      timeout: 5s
      retries: 10

volumes:
  postgres_data:
