From 33dcfe13dd640aa9cb4aa6f434c3eafc490eeab0 Mon Sep 17 00:00:00 2001 From: David Bernard Date: Sun, 31 Mar 2024 16:07:54 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20(cdviz-grafana)=20update=20setup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dashboards/cdevents-activity.json | 13 +++++------ cdviz-grafana/datasources/cdviz-db.yaml | 22 +++++++++++++++++++ charts/cdviz/templates/secrets.yaml | 4 ++-- charts/cdviz/values.yaml | 2 ++ 4 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 cdviz-grafana/datasources/cdviz-db.yaml diff --git a/cdviz-grafana/dashboards/cdevents-activity.json b/cdviz-grafana/dashboards/cdevents-activity.json index 3dc2b40..ebee021 100644 --- a/cdviz-grafana/dashboards/cdevents-activity.json +++ b/cdviz-grafana/dashboards/cdevents-activity.json @@ -19,14 +19,13 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 1, "links": [], "liveNow": false, "panels": [ { "datasource": { - "type": "postgres", - "uid": "P3ABDE63318046581" + "type": "grafana-postgresql-datasource", + "uid": "cdviz-db" }, "gridPos": { "h": 8, @@ -49,13 +48,13 @@ "targets": [ { "datasource": { - "type": "postgres", - "uid": "P3ABDE63318046581" + "type": "grafana-postgresql-datasource", + "uid": "cdviz-db" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT \"timestamp\",\n \"payload\"\nFROM \"cdevents_lake\"\nWHERE $__timeFilter(timestamp) \nORDER BY \"timestamp\" DESC", + "rawSql": "SELECT \"timestamp\",\n \"subject\",\n \"predicate\",\n \"payload\"\nFROM \"cdevents_lake\"\nWHERE $__timeFilter(timestamp) \nORDER BY \"timestamp\" DESC", "refId": "A", "sql": { "columns": [ @@ -81,7 +80,7 @@ } ], "refresh": "", - "schemaVersion": 38, + "schemaVersion": 39, "tags": [], "templating": { "list": [] diff --git a/cdviz-grafana/datasources/cdviz-db.yaml b/cdviz-grafana/datasources/cdviz-db.yaml new file mode 100644 index 0000000..7e43761 --- /dev/null +++ b/cdviz-grafana/datasources/cdviz-db.yaml @@ -0,0 +1,22 @@ +apiVersion: 1 + +datasources: + - name: cdviz-db + uid: cdviz-db + type: grafana-postgresql-datasource + access: proxy + url: "$CDVIZ_RO_POSTGRES_HOST:$CDVIZ_RO_POSTGRES_PORT_NUMBER" + user: $CDVIZ_RO_POSTGRES_USER + secureJsonData: + password: $CDVIZ_RO_POSTGRES_PASSWORD + jsonData: + database: $CDVIZ_RO_POSTGRES_DB + sslmode: 'disable' # disable/require/verify-ca/verify-full + maxOpenConns: 100 # Grafana v5.4+ + maxIdleConns: 100 # Grafana v5.4+ + maxIdleConnsAuto: true # Grafana v9.5.1+ + connMaxLifetime: 14400 # Grafana v5.4+ + postgresVersion: 1500 # 903=9.3, 904=9.4, 905=9.5, 906=9.6, 1000=10 + timescaledb: false + # - name: TestData + # type: testdata \ No newline at end of file diff --git a/charts/cdviz/templates/secrets.yaml b/charts/cdviz/templates/secrets.yaml index 7ab6deb..a0cbc26 100644 --- a/charts/cdviz/templates/secrets.yaml +++ b/charts/cdviz/templates/secrets.yaml @@ -57,9 +57,9 @@ data: POSTGRES_PASSWORD: |- {{ .Values.secrets.values.CDVIZ_RO_POSTGRES_PASSWORD | b64enc }} POSTGRES_HOST: |- - {{ .Values.secrets.values.POSTGRES_HOST | b64enc }} + {{ .Values.secrets.values.CDVIZ_RO_POSTGRES_HOST | default .Values.secrets.values.POSTGRES_HOST | b64enc }} POSTGRES_PORT_NUMBER: |- - {{ .Values.secrets.values.POSTGRES_PORT_NUMBER | b64enc }} + {{ .Values.secrets.values.CDVIZ_RO_POSTGRES_PORT_NUMBER | default .Values.secrets.values.POSTGRES_PORT_NUMBER | b64enc }} POSTGRES_DB: |- {{ .Values.secrets.values.POSTGRES_DB | b64enc }} {{- end }} diff --git a/charts/cdviz/values.yaml b/charts/cdviz/values.yaml index 66d2d20..1f4e894 100644 --- a/charts/cdviz/values.yaml +++ b/charts/cdviz/values.yaml @@ -17,6 +17,8 @@ secrets: # RO (read-only) used by cdviz-grafana to query data from the db CDVIZ_RO_POSTGRES_USER: cdviz-ro CDVIZ_RO_POSTGRES_PASSWORD: postgres-password + # CDVIZ_RO_POSTGRES_HOST: cdviz-postgresql # to override if different from POSTGRES_HOST + # CDVIZ_RO_POSTGRES_PORT_NUMBER: "5432" # to override if different from POSTGRES_HOST cdviz-collector: enabled: true