# Service composition file for Docker Compose or Podman Compose
# https://cratedb.com/docs/guide/integrate/collectd/

services:

  cratedb:
    image: docker.io/crate:latest
    command: >
      crate -Cdiscovery.type=single-node
    ports:
      - "4200:4200/tcp"
      - "5432:5432/tcp"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:4200/"]
      interval: 5s
      timeout: 30s
      retries: 5

  collectd-cratedb:
    build: .
    volumes:
      - ./collectd-cratedb.conf:/etc/collectd/collectd.conf.d/collectd-cratedb.conf:ro
    depends_on:
      - cratedb

  collectd-telegraf:
    build: .
    volumes:
      - ./collectd-telegraf.conf:/etc/collectd/collectd.conf.d/collectd-telegraf.conf:ro
    depends_on:
      - cratedb

  telegraf:
    image: docker.io/telegraf:latest
    ports:
      - "8125:8125/udp"  # StatsD
    volumes:
      - ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
    depends_on:
      - cratedb

  postgresql:
    image: docker.io/postgres:18
    profiles: ["cli"]
