services:
  teslamate:
    image: teslamate/teslamate:2.1.0
    container_name: teslamate
    restart: always
    environment:
      - ENCRYPTION_KEY=${TESLAMATE_ENCRYPTION_KEY}
      - DATABASE_HOST=${TESLAMATE_DATABASE_HOST}
      - DATABASE_PORT=${TESLAMATE_DATABASE_PORT}
      - DATABASE_USER=${TESLAMATE_DATABASE_USER}
      - DATABASE_PASS=${TESLAMATE_DATABASE_PASS}
      - DATABASE_NAME=${TESLAMATE_DATABASE_NAME}
      - MQTT_HOST=${TESLAMATE_MQTT_HOST}
      - MQTT_PORT=${TESLAMATE_MQTT_PORT}
      - MQTT_USERNAME=${TESLAMATE_MQTT_USERNAME}
      - MQTT_PASSWORD=${TESLAMATE_MQTT_PASSWORD}
    ports:
      - 4000:4000
    extra_hosts:
      - host:192.168.2.200
    volumes:
      - /opt/teslamate/import:/opt/app/import
    cap_drop:
      - all

  teslamate-grafana:
    image: teslamate/grafana:2.1.0
    container_name: teslamate-grafana
    restart: always
    environment:
      - DATABASE_HOST=${TESLAMATE_DATABASE_HOST}
      - DATABASE_PORT=${TESLAMATE_DATABASE_PORT}
      - DATABASE_USER=${TESLAMATE_DATABASE_USER}
      - DATABASE_PASS=${TESLAMATE_DATABASE_PASS}
      - DATABASE_NAME=${TESLAMATE_DATABASE_NAME}
      - GF_AUTH_ANONYMOUS_ENABLED=true
      - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
    ports:
      - 3004:3000
    extra_hosts:
      - host:192.168.2.200
    volumes:
      - /opt/teslamate/grafana:/var/lib/grafana
