name: forage

services:
  postgres:
    image: postgres:18-alpine
    environment:
      POSTGRES_DB: forage
      POSTGRES_USER: forageuser
      POSTGRES_PASSWORD: foragepassword
    ports:
      - "5433:5432"
    volumes:
      - forage-pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U forageuser -d forage"]
      interval: 5s
      timeout: 5s
      retries: 5

  nats:
    image: nats:2-alpine
    command: ["--jetstream", "--store_dir", "/data", "--http_port", "8222"]
    ports:
      - "4223:4222"
      - "8223:8222"
    volumes:
      - forage-nats:/data
    healthcheck:
      test: ["CMD", "wget", "--spider", "-q", "http://localhost:8222/healthz"]
      interval: 5s
      timeout: 5s
      retries: 5

volumes:
  forage-pgdata:
  forage-nats:
