# NOTE: This files purpose is to spin-up the project for testing it in CI. 
#       Please do not understand it as recommendation for an production 
#       docker-compose setup. For that see the README. If you have additions 
#       to make, please add them there.
version: '3.1'
services:
  homeassistant:
    container_name: homeassistant
    depends_on:
      - influxdb
      - marytts
    restart: always
    image: homeassistant/home-assistant:latest
    devices:
#      - /dev/ttyUSB0:/dev/ttyUSB0
# this was for zha
      - /dev/ttyUSB1:/dev/ttyUSB1
#      - /dev/ttyUSB2:/dev/ttyUSB2
#      - /dev/ttyACM0:/dev/ttyACM0
    volumes:
      - ./data/config:/config
      - /etc/localtime:/etc/localtime:ro
      - ./data/shared:/shared
      - ./media/:/media
      - /volume3/mediathek:/mediathek
#mynas-srv
#      - mediathek:/mediathek
      - backup:/backup
      - /docker-data/mediathekview/data/.mediathek3/history.db:/config/mediathekview.db
      - /docker-data/vaultwarden/data/db.sqlite3:/config/vaultwarden.db
      - /docker-data/matrix/data/homeserver.db:/config/matrix.db
      - /dev/serial/by-id/:/dev/serial/by-id/
    network_mode: host
#    networks:
 #     lan:
  #      ipv4_address: 192.168.1.23
    privileged: true
    environment:
      - PUID=0
      - PGID=1000
      - TZ=Europe/London

  homeintent:
    image: "ghcr.io/jarvyj/homeintent:latest"
    restart: always
    container_name: homeintent
    depends_on:
      - homeassistant
    volumes:
      - "./homeintent/rhasspy:/profiles"
      - "./homeintent/config:/config"
      - "/etc/localtime:/etc/localtime:ro"
    ports:
      - "11102:11102"  # For the Home Intent UI
      - "12183:12183"  # For communicating over MQTT/satellites
      - "12101:12101"  # For the Rhasspy UI (optional)
    devices:
      - "/dev/snd:/dev/snd"
    environment:
      - LANGUAGE=de

  appdaemon:
    container_name: appdaemon
#    image: acockburn/appdaemon:4.2.1
    image: acockburn/appdaemon:latest
    #user: '99'
    healthcheck:
      test: "curl -sf http://localhost:8125"
      interval: 60s
      timeout: 10s
      retries: 5
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./appdaemon:/conf
      # Mount directory of appdaemon apps installed by HACS
      - ./data/config/appdaemon/apps:/conf/apps
      #- /home/aneisch/dockerStart.sh:/usr/src/app/dockerStart.sh:ro
    ports:
        - "5051:5050"
        - "8125:8125"
    restart: always

  larynx:
    container_name: larynx
    image: rhasspy/larynx
    restart: always
    volumes:
      - ./larynx/data:/data
      - ./larynx/usr/share/ca-certificates:/usr/share/ca-certificates
      - ./larynx/etc/ssl/certs:/etc/ssl/certs
    ports:
      - 5002:5002
#      - 59125:5002
    environment:
      - HOME=data

  marytts:
    container_name: marytts
    image: synesthesiam/marytts:5.2
    restart: always
    ports:
      - 59125:59125

  esphome:
    container_name: esphome
    image: esphome/esphome
    restart: always
    privileged: true
    ports:
      - 6052:6052
    volumes:
      - ./esphome:/config:rw
    #network_mode: host
    environment:
      - ESPHOME_DASHBOARD_USE_PING=true

  influxdb:
    container_name: influxdb
    environment:
      - INFLUXDB_DB=192.168.1.31
      - INFLUXDB_ADMIN_USER=admin
      - INFLUXDB_ADMIN_PASSWORD=Influx2022
    image: influxdb:latest
    ports:
      - '8086:8086'
    restart: always
    volumes:
      - ./influxdb2:/var/lib/influxdb2
      - /etc/localtime:/etc/localtime:ro

  grafana:
    container_name: grafana
    depends_on:
      - influxdb
      - prometheus
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=Grafana2020
    image: grafana/grafana:latest
    restart: always
    user: "0"
    ports:
      - '3000:3000'
    volumes:
      - ./grafana:/var/lib/grafana
      - /etc/localtime:/etc/localtime:ro

  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    ports:
      - 9090:9090
    volumes:
      - ./prometheus:/etc/prometheus
      - prometheus_data:/prometheus
    command: --web.enable-lifecycle  --config.file=/etc/prometheus/prometheus.yml

  homegear:
    image: homegear/homegear:nightly
    container_name: homegear
    restart: always
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
#      - "./homegear/homematicbidcos.conf:/etc/homegear/families/homematicbidcos.conf"
#      - "./homegear/db.sql:/var/lib/homegear/db.sql"
      - "./homegear/etc:/etc/homegear:Z"
      - "./homegear/lib:/var/lib/homegear:Z"
      - "./homegear/log:/var/log/homegear:Z"
    ports:
      - 2000:2000
      - 2001:2001
      - 2002:2002
      - 2003:2003
      - 2010:2010
      - 9292:9292
      - 8080:80
      - 80:80
      - 8443:443
      - 443:443
    environment:
      - TZ=Europe/Berlin
      # $(id -u) und $(id -g) müssen von Hand eingetragen werden da docker-compose nicht automatisch auswertet
#      - HOST_USER_GID='1001'
#      - HOST_USER_ID='1001'

  homegear_sqliteweb:
    image: coleifer/sqlite-web
    container_name: homegear_sqliteweb
    restart: always
#    build:
#      context: .
    ports:
      - 8128:8080
    volumes:
       - ./homegear/lib:/data
    environment:
       - SQLITE_DATABASE=db.sql
#    healthcheck:
#      test: bash -c ">/dev/tcp/127.0.0.1/8080"

  hassio_sqliteweb:
    image: coleifer/sqlite-web
    container_name: hassio_sqliteweb
    restart: always
#    build:
#      context: .
    ports:
      - 8124:8080
    volumes:
       - ./data/config:/data
    environment:
       - SQLITE_DATABASE=home-assistant_v2.db
#    healthcheck:
#      test: bash -c ">/dev/tcp/127.0.0.1/8080"


volumes:
  prometheus_data: {}

#  mediathek:
#    driver: local
#    driver_opts:
#      type: nfs
#      o: addr=192.168.1.17,rw
#      device: ":/volume3/mediathek"

  backup:
    driver: local
    driver_opts:
      type: nfs
      o: addr=192.168.1.14,rw
      device: ":/volume1/backup"

#networks:
#  lan:
#    name: lan
#    driver: macvlan
#    driver_opts:
#      parent: vmbr0 #your ethernet interface
#    ipam:
#      config:
#        - subnet: 192.168.1.0/24
