Add Grafana Docker Compose example.

This commit is contained in:
Pieter Hollander 2024-03-27 09:50:18 +01:00
parent 2ff5a0e04a
commit d88d3fdef6
Signed by: pieter
SSH key fingerprint: SHA256:HbX+9cBXsop9SuvL+mELd29sK+7DehFfdVweFVDtMSg
2 changed files with 64 additions and 0 deletions

View file

@ -0,0 +1,62 @@
version: '3.8'
services:
timescaledb:
image: timescale/timescaledb:latest-pg16
environment:
POSTGRES_USER: ${PG_USER}
POSTGRES_PASSWORD: ${PG_PASSWORD}
POSTGRES_DB: ${PG_DB}
ports:
- "5432:5432"
networks:
- internal
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /opt/opendtu-logger/database:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${PG_USER}"]
interval: 5s
timeout: 5s
retries: 20
opendtu-logger:
image: git.hollander.online/energy/opendtu-logger:main
environment:
DB_URL: ${DB_URL}
REMOTE_URL: ${REMOTE_URL}
TIMESCALEDB_ENABLED: ${TIMESCALEDB_ENABLED}
TZ: ${TZ}
depends_on:
timescaledb:
condition: service_healthy
networks:
- internal
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
grafana:
image: grafana/grafana:latest
container_name: grafana
restart: always
user: "1000:1000"
ports:
- "3000:3000"
networks:
- internal
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- opendtu_logger_grafana:/var/lib/grafana:rw
environment:
GF_DATAPROXY_ROW_LIMIT: 5000000
# GF_LOG_FILTERS: rendering:debug
healthcheck:
test: ["CMD-SHELL", "curl -f localhost:3000/api/health && echo 'ready'"]
interval: 10s
retries: 30
networks:
internal:
attachable: true
volumes:
opendtu_logger_grafana:

View file

@ -1,7 +1,9 @@
# OpenDTU Logger
REMOTE_URL="opendtu:80" REMOTE_URL="opendtu:80"
DB_URL="host=timescaledb port=5432 user=postgres password=secret dbname=dtu sslmode=disable" DB_URL="host=timescaledb port=5432 user=postgres password=secret dbname=dtu sslmode=disable"
TIMESCALEDB_ENABLED=true TIMESCALEDB_ENABLED=true
TZ="Europe/Amsterdam" TZ="Europe/Amsterdam"
# Database configuration
PG_USER= PG_USER=
PG_PASSWORD= PG_PASSWORD=
PG_DB= PG_DB=