Replaced direct host path volume mounts with named volumes for the Teslamate database, Grafana data, and Mosquitto configuration and data. This change centralizes the definition of host bind mounts for persistent data by using Docker named volumes with `driver_opts` set to `type: none` and `o: bind`. This improves consistency and manageability of volume definitions within the `docker-compose.yml` file. Additionally, the import volume path for the `teslamate` service was adjusted from `/mnt/docker/home/teslamate/data/import` to `/mnt/docker/home/teslamate/import`.
100 lines
2.1 KiB
YAML
100 lines
2.1 KiB
YAML
services:
|
|
teslamate:
|
|
image: teslamate/teslamate:latest
|
|
restart: always
|
|
environment:
|
|
- ENCRYPTION_KEY=/run/secrets/password
|
|
- DATABASE_USER=teslamate
|
|
- DATABASE_PASS=/run/secrets/password
|
|
- DATABASE_NAME=teslamate
|
|
- DATABASE_HOST=database
|
|
- MQTT_HOST=mosquitto
|
|
# ports:
|
|
# - 4000:4000
|
|
volumes:
|
|
- /mnt/docker/home/teslamate/import:/opt/app/import
|
|
cap_drop:
|
|
- all
|
|
secrets:
|
|
- password
|
|
networks:
|
|
- teslamate-internal
|
|
- pangolin-home
|
|
|
|
database:
|
|
image: postgres:18-trixie
|
|
restart: always
|
|
environment:
|
|
- POSTGRES_USER=teslamate
|
|
- POSTGRES_PASSWORD=/run/secrets/password
|
|
- POSTGRES_DB=teslamate
|
|
volumes:
|
|
- teslamate-db:/var/lib/postgresql
|
|
secrets:
|
|
- password
|
|
networks:
|
|
- teslamate-internal
|
|
|
|
grafana:
|
|
image: teslamate/grafana:latest
|
|
restart: always
|
|
environment:
|
|
- DATABASE_USER=teslamate
|
|
- DATABASE_PASS=/run/secrets/password
|
|
- DATABASE_NAME=teslamate
|
|
- DATABASE_HOST=database
|
|
# ports:
|
|
# - 3000:3000
|
|
volumes:
|
|
- teslamate-grafana-data:/var/lib/grafana
|
|
secrets:
|
|
- password
|
|
networks:
|
|
- teslamate-internal
|
|
- pangolin-home
|
|
|
|
mosquitto:
|
|
image: eclipse-mosquitto:2
|
|
restart: always
|
|
command: mosquitto -c /mosquitto-no-auth.conf
|
|
# ports:
|
|
# - 1883:1883
|
|
volumes:
|
|
- mosquitto-conf:/mosquitto/config
|
|
- mosquitto-data:/mosquitto/data
|
|
secrets:
|
|
- password
|
|
networks:
|
|
- teslamate-internal
|
|
|
|
secrets:
|
|
password:
|
|
external: true
|
|
|
|
networks:
|
|
teslamate-internal:
|
|
driver: overlay
|
|
pangolin-home:
|
|
external: true
|
|
|
|
volumes:
|
|
teslamate-db:
|
|
driver_opts:
|
|
type: none
|
|
device: /mnt/docker/home/teslamate/data
|
|
o: bind
|
|
teslamate-grafana-data:
|
|
driver_opts:
|
|
type: none
|
|
device: /mnt/docker/home/teslamate/data
|
|
o: bind
|
|
mosquitto-conf:
|
|
driver_opts:
|
|
type: none
|
|
device: /mnt/docker/home/teslamate/data
|
|
o: bind
|
|
mosquitto-data:
|
|
driver_opts:
|
|
type: none
|
|
device: /mnt/docker/home/teslamate/data
|
|
o: bind |