version: "3"

services:
  
  app:

    image: sfudeus/homematic_exporter:2023-05-21
    restart: always
    command: "--ccu_host {{ homematic.ccu2_host }} --ccu_port 2001 --port {{ homematic_metrics_port }}"
    ports:
      - "{{ int_ip4 }}:{{ homematic_metrics_port }}:{{ homematic_metrics_port }}"
    networks:
      - default

  
  influxdb:

    image: influxdb:2.6.1
    restart: always
    ports:
      - "{{ int_ip4 }}:{{ influxdb_port }}:8086"
    volumes:
      - "{{ basedir }}/influxdb:/var/lib/influxdb2"
    environment:
      DOCKER_INFLUXDB_INIT_MODE: setup
      DOCKER_INFLUXDB_INIT_USERNAME: homematic
      DOCKER_INFLUXDB_INIT_PASSWORD: {{ influxdb_password }}
      DOCKER_INFLUXDB_INIT_ORG: homematic
      DOCKER_INFLUXDB_INIT_BUCKET: homematic
      DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: {{ influxdb_token }}
    networks:
      - default


  telegraf:

    image: telegraf:1.25.3
    restart: always
    depends_on: 
      - app
      - influxdb
    volumes:
      - "{{ basedir }}/telegraf.conf:/etc/telegraf/telegraf.conf:ro"