Haveacry / twc3teslamate

Teslamate charging information output in the format of the Tesla Wall Connector Gen3
GNU General Public License v2.0
4 stars 0 forks source link

Documentation improvement suggestion: docker-compose.yaml #3

Closed dglaude closed 2 months ago

dglaude commented 3 months ago

Maybe one way to run this software is to integrate it into the docker-compose.yaml of teslamate like this:

  twc3teslamate:
    container_name: twc3teslamate
    image: haveacry/twc3teslamate
    environment:
      - MQTT_HOST=mosquitto
    restart: unless-stopped
    ports:
      - 80:80

Since teslamate is frequently deployed using docker compose, I had the idea to add twc3teslamate directly to the same docker-compose.yaml of teslamate.

Not sure if that is a good practice or not, but since it is there already, I decided to integrate it in... and it works for me.

If you like this suggestion, maybe you could add something to the readme?

Regards

speedst3r commented 3 months ago

Hi @dglaude - thanks for the suggestion! I can certainly add it to the README

Do you have a complete compose configuration I could use as an example? I run twc3teslamate in Kubernetes so do not have a handy reference.

dglaude commented 3 months ago

Here is my teslamate configuration file (I hope without secret):

services:
  teslamate:
    image: teslamate/teslamate:latest
    restart: always
    environment:
      - ENCRYPTION_KEY= 00112233445566778899aabbccddeeff #replace with a secure key to encrypt your Tesla API tokens
      - DATABASE_USER=teslamate
      - DATABASE_PASS=password #insert your secure database password!
      - DATABASE_NAME=teslamate
      - DATABASE_HOST=database
      - MQTT_HOST=mosquitto
      - MQTT_PORT=1883
    ports:
      - 4000:4000
    volumes:
      - ./import:/opt/app/import
    cap_drop:
      - all

  database:
    image: postgres:16
    restart: always
    environment:
      - POSTGRES_USER=teslamate
      - POSTGRES_PASSWORD=password #insert your secure database password!
      - POSTGRES_DB=teslamate
    volumes:
      - teslamate-db:/var/lib/postgresql/data

  grafana:
    image: teslamate/grafana:latest
    restart: always
    environment:
      - DATABASE_USER=teslamate
      - DATABASE_PASS=password #insert your secure database password!
      - DATABASE_NAME=teslamate
      - DATABASE_HOST=database
    ports:
      - 3000:3000
    volumes:
      - teslamate-grafana-data:/var/lib/grafana

  mosquitto:
    image: eclipse-mosquitto:2
    restart: always
    command: mosquitto -c /mosquitto-no-auth.conf
    volumes:
      - mosquitto-conf:/mosquitto/config
      - mosquitto-data:/mosquitto/data

  twc3teslamate:
    container_name: twc3teslamate
    image: haveacry/twc3teslamate
    environment:
      - MQTT_HOST=mosquitto
    restart: unless-stopped
    ports:
      - 80:80

volumes:
  teslamate-db:
  teslamate-grafana-data:
  mosquitto-conf:
  mosquitto-data:

I'll try to find the command line I used to build the docker image with name haveacry/twc3teslamate and also the docker compose command to start it.

I did configure and run it, then I tested with your test URL. I might even have tested a little bit with evcc but right now it is not clear if I will use your software or not. I have a real Tesla Wall Connector, so I can configure that one... but I still need to let evcc use a BLE proxy to communicate with the car.

Regards

dglaude commented 3 months ago

Here is how I did build the container image: docker build -t haveacry/twc3teslamate https://github.com/Haveacry/twc3teslamate.git -f Dockerfile.debian

Then docker images to check it's size.

Mostly the other instructions are Teslamate installation instructions.

dglaude commented 3 months ago

You can also compare to teslatmate documentation: https://docs.teslamate.org/docs/installation/docker

speedst3r commented 2 months ago

Resolved by 86f18ff