# Redpanda → InfluxDB Consumer
# Lit les topics Redpanda et écrit dans InfluxDB pour Grafana
version: "3.8"

services:
  redpanda-consumer:
    image: python:3.11-slim
    container_name: smart-city-redpanda-consumer
    restart: unless-stopped
    command: >
      sh -c "pip install requests && python3 /app/consumer.py"
    volumes:
      - ./redpanda/consumer.py:/app/consumer.py:ro
    environment:
      - INFLUX_URL=http://smart-city-influxdb:8086
      - INFLUX_TOKEN=my-super-admin-token
      - INFLUX_ORG=digitribe
      - INFLUX_BUCKET=iot_data
    networks:
      - smartcity-shared
    healthcheck:
      test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://smart-city-redpanda:9644/public_metrics')"]
      interval: 30s
      timeout: 10s
      retries: 3

networks:
  smartcity-shared:
    external: true
