Prepare BentoPDF and Grafana InfluxDB stacks
Prepare BentoPDF and Grafana InfluxDB stacks
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
# Grafana + InfluxDB 3 Core
|
||||
|
||||
Vorbereiteter Monitoring-Stack. Noch nicht deployen, bis die Secrets und der erste InfluxDB-Token sauber angelegt sind.
|
||||
|
||||
## Quellen / Entscheidungen
|
||||
|
||||
- Grafana nutzt das offizielle OSS-Image `grafana/grafana:12.4.3`.
|
||||
- InfluxDB nutzt `influxdb:3.9.1-core`, nicht `latest`, weil `latest` bei InfluxDB aktiv in Richtung InfluxDB 3 umgestellt wird.
|
||||
- Grafana wird ueber Traefik + `authelia@file,secure-headers@file` unter `grafana.kaleschke.info` veroeffentlicht.
|
||||
- InfluxDB bleibt ohne direkten Host-Port und ohne Traefik-Route im internen Compose-Netz `grafana_influx_internal`.
|
||||
- Grafana provisioning legt eine SQL-Datenquelle fuer InfluxDB 3 Core mit der Datenbank `homelab` an.
|
||||
|
||||
## Vor dem ersten Deploy
|
||||
|
||||
1. Secret fuer Grafana anlegen:
|
||||
|
||||
```bash
|
||||
install -m 600 /dev/null /mnt/user/appdata/secrets/grafana_admin_password.txt
|
||||
```
|
||||
|
||||
2. Offline-Admin-Token fuer InfluxDB 3 als JSON anlegen:
|
||||
|
||||
```json
|
||||
{
|
||||
"token": "apiv3_REPLACE_WITH_STRONG_RANDOM_TOKEN",
|
||||
"name": "admin",
|
||||
"description": "Admin token for KalliLab InfluxDB 3 Core"
|
||||
}
|
||||
```
|
||||
|
||||
Pfad: `/mnt/user/appdata/secrets/influxdb3_admin_token.json`, Rechte `600`.
|
||||
|
||||
3. In Komodo fuer den Stack `GRAFANA_INFLUXDB_TOKEN` setzen. Fuer den Start kann das derselbe Token aus `influxdb3_admin_token.json` sein; sauberer ist spaeter ein eigener Read-Token fuer Grafana.
|
||||
|
||||
4. Nach dem ersten Start die Datenbank anlegen:
|
||||
|
||||
```bash
|
||||
docker exec influxdb3-core influxdb3 create database homelab --token "$INFLUXDB3_AUTH_TOKEN"
|
||||
```
|
||||
|
||||
## Smoke-Test nach Deploy
|
||||
|
||||
- `https://grafana.kaleschke.info` oeffnet nach Authelia die Grafana-Loginseite.
|
||||
- Grafana `Connections -> Data sources -> InfluxDB 3 Core -> Save & test` ist erfolgreich.
|
||||
- InfluxDB bleibt von aussen nicht direkt erreichbar.
|
||||
|
||||
## Rollback
|
||||
|
||||
- Stack in Komodo stoppen oder Git auf den letzten Stand ohne `ops/grafana-influxdb` zuruecknehmen.
|
||||
- Persistente Daten liegen unter `/mnt/user/appdata/grafana` und `/mnt/user/appdata/influxdb3`; nicht automatisch loeschen.
|
||||
@@ -0,0 +1,71 @@
|
||||
services:
|
||||
grafana:
|
||||
image: grafana/grafana:12.4.3
|
||||
container_name: grafana
|
||||
restart: unless-stopped
|
||||
user: "0"
|
||||
environment:
|
||||
GF_SERVER_ROOT_URL: https://grafana.kaleschke.info/
|
||||
GF_SECURITY_ADMIN_PASSWORD__FILE: /run/secrets/grafana_admin_password
|
||||
GF_USERS_ALLOW_SIGN_UP: "false"
|
||||
GF_AUTH_ANONYMOUS_ENABLED: "false"
|
||||
GRAFANA_INFLUXDB_TOKEN: ${GRAFANA_INFLUXDB_TOKEN}
|
||||
volumes:
|
||||
- /mnt/user/appdata/grafana:/var/lib/grafana
|
||||
- ./provisioning:/etc/grafana/provisioning:ro
|
||||
secrets:
|
||||
- grafana_admin_password
|
||||
networks:
|
||||
- frontend_net
|
||||
- grafana_influx_internal
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000/api/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.docker.network=frontend_net
|
||||
- traefik.http.routers.grafana.rule=Host(`grafana.kaleschke.info`)
|
||||
- traefik.http.routers.grafana.entrypoints=websecure
|
||||
- traefik.http.routers.grafana.tls=true
|
||||
- traefik.http.routers.grafana.tls.certresolver=le
|
||||
- traefik.http.routers.grafana.middlewares=authelia@file,secure-headers@file
|
||||
- traefik.http.services.grafana.loadbalancer.server.port=3000
|
||||
|
||||
influxdb3-core:
|
||||
image: influxdb:3.9.1-core
|
||||
container_name: influxdb3-core
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- influxdb3
|
||||
- serve
|
||||
- --node-id=kallilabcore
|
||||
- --object-store=file
|
||||
- --data-dir=/var/lib/influxdb3/data
|
||||
- --plugin-dir=/var/lib/influxdb3/plugins
|
||||
- --admin-token-file=/run/secrets/influxdb3_admin_token
|
||||
volumes:
|
||||
- /mnt/user/appdata/influxdb3/data:/var/lib/influxdb3/data
|
||||
- /mnt/user/appdata/influxdb3/plugins:/var/lib/influxdb3/plugins
|
||||
secrets:
|
||||
- influxdb3_admin_token
|
||||
networks:
|
||||
- grafana_influx_internal
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
|
||||
secrets:
|
||||
grafana_admin_password:
|
||||
file: /mnt/user/appdata/secrets/grafana_admin_password.txt
|
||||
influxdb3_admin_token:
|
||||
file: /mnt/user/appdata/secrets/influxdb3_admin_token.json
|
||||
|
||||
networks:
|
||||
frontend_net:
|
||||
external: true
|
||||
grafana_influx_internal:
|
||||
internal: true
|
||||
@@ -0,0 +1,18 @@
|
||||
apiVersion: 1
|
||||
|
||||
prune: true
|
||||
|
||||
datasources:
|
||||
- name: InfluxDB 3 Core
|
||||
uid: influxdb3-core
|
||||
type: influxdb
|
||||
access: proxy
|
||||
url: http://influxdb3-core:8181
|
||||
isDefault: true
|
||||
jsonData:
|
||||
version: SQL
|
||||
dbName: homelab
|
||||
httpMode: POST
|
||||
insecureGrpc: true
|
||||
secureJsonData:
|
||||
token: $GRAFANA_INFLUXDB_TOKEN
|
||||
Reference in New Issue
Block a user