Skip to content

Commit 6d698ad

Browse files
committed
chore(grafana): change database to postgres
1 parent e137c32 commit 6d698ad

3 files changed

Lines changed: 25 additions & 46 deletions

File tree

charts/grafana/templates/_helpers.tmpl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ env:
55
valueFrom:
66
fieldRef:
77
fieldPath: metadata.namespace
8+
- name: GF_DATABASE_TYPE
9+
value: postgres
10+
{{- if (.Values.databaseUrl) }}
11+
- name: GF_DATABASE_URL
12+
value: "{{ .Values.databaseUrl }}"
13+
{{- else if .Values.database.enabled }}
14+
- name: GF_DATABASE_USER
15+
valueFrom:
16+
secretKeyRef:
17+
name: database-creds
18+
key: user
19+
- name: GF_DATABASE_PASSWORD
20+
valueFrom:
21+
secretKeyRef:
22+
name: database-creds
23+
key: password
24+
- name: GF_DATABASE_URL
25+
value: "postgres://$(GF_DATABASE_USER):$(GF_DATABASE_PASSWORD)@drycc-database.{{.Release.Namespace}}.svc.{{.Values.global.clusterDomain}}:5432/grafana"
26+
{{- end }}
827
{{- if .Values.prometheusUrl }}
928
- name: "PROMETHEUS_URL"
1029
value: "{{ .Values.prometheusUrl }}"

charts/grafana/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ persistence:
5656
# this is usually a non required setting.
5757
environment:
5858
ALLOW_SIGN_UP: false
59+
## databaseUrl and databaseReplicaUrl are will no longer use the built-in database component
60+
databaseUrl: ""
5961
# The passportUrl, passportKey and passportSecret are will no longer use the built-in passport component
6062
passportUrl: ""
6163
passportKey: ""

rootfs/usr/share/grafana/grafana.ini.tpl

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -62,54 +62,12 @@ cert_key = {{ .CERT_KEY }}
6262
#################################### Database ####################################
6363
[database]
6464
# Either "mysql", "postgres" or "sqlite3", it's your choice
65-
{{ if .DATABASE_TYPE }}
66-
type = {{ .DATABASE_TYPE }}
65+
{{ if .GF_DATABASE_TYPE }}
66+
type = {{ .GF_DATABASE_TYPE }}
6767
{{ end }}
68-
{{ if .DATABASE_HOST }}
69-
host = {{ .DATABASE_HOST }}
68+
{{ if .GF_DATABASE_URL }}
69+
url = {{ .GF_DATABASE_URL }}
7070
{{ end }}
71-
{{ if .DATABASE_NAME }}
72-
name = {{ .DATABASE_NAME }}
73-
{{ end }}
74-
{{ if .DATABASE_USER }}
75-
user = {{ .DATABASE_USER }}
76-
{{ end }}
77-
{{ if .DATABASE_PASSWORD }}
78-
password = {{ .DATABASE_PASSWORD }}
79-
{{ end }}
80-
81-
# For "postgres" only, either "disable", "require" or "verify-full"
82-
{{ if .DATABASE_SSL_MODE }}
83-
ssl_mode = {{ .DATABASE_SSL_MODE }}
84-
{{ end }}
85-
86-
# For "sqlite3" only, path relative to data_path setting
87-
{{ if .DATABASE_PATH }}
88-
path = {{ .DATABASE_PATH }}
89-
{{ end }}
90-
91-
#################################### Session ####################################
92-
[session]
93-
# Either "memory", "file", "mysql", "postgres", default is "file"
94-
provider = {{ default "file" .SESSION_PROVIDER }}
95-
96-
# Provider config options
97-
# memory: not have any config yet
98-
# file: session dir path, is relative to grafana data_path
99-
# mysql: go-sql-driver/mysql dsn config string, e.g. `user:password@tcp(127.0.0.1:3306)/database_name`
100-
# postgres: user=a password=b host=localhost port=5432 dbname=c sslmode=disable
101-
{{ if .SESSION_PROVIDER_CONFIG }}
102-
provider_config = {{ .SESSION_PROVIDER_CONFIG }}
103-
{{ end }}
104-
105-
# Session cookie name
106-
cookie_name = {{ default "grafana_sess" .SESSION_COOKIE_NAME }}
107-
108-
# If you use session in https only, default is false
109-
cookie_secure = {{ default "false" .SESSION_COOKIE_SECURE }}
110-
111-
# Session life time, default is 86400
112-
session_life_time = {{ default "86400" .SESSION_LIFE_TIME }}
11371

11472
#################################### Analytics ####################################
11573
[analytics]

0 commit comments

Comments
 (0)