Skip to content

Commit 525ad1d

Browse files
authored
Merge pull request #188 from sheyabernstein/feat/mariadb
Add MariaDB support for Uptime-Kuma v2
2 parents d71fa8b + b102d37 commit 525ad1d

File tree

6 files changed

+81
-3
lines changed

6 files changed

+81
-3
lines changed

.github/configs/ct.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ chart-dirs:
44
- charts
55
chart-repos:
66
- uptime-kuma=https://dirsigler.github.io/uptime-kuma-helm
7+
- bitnami=https://charts.bitnami.com/bitnami
78
debug: true

charts/uptime-kuma/Chart.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@ maintainers:
1010
name: uptime-kuma
1111
sources:
1212
- https://github.com/louislam/uptime-kuma
13+
dependencies:
14+
- name: mariadb
15+
version: 20.2.2
16+
repository: https://charts.bitnami.com/bitnami
17+
condition: mariadb.enabled
1318
type: application
14-
version: 2.21.2
19+
version: 2.21.3

charts/uptime-kuma/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ A self-hosted Monitoring tool like "Uptime-Robot".
1616

1717
* <https://github.com/louislam/uptime-kuma>
1818

19+
## MariaDB Configuration
20+
21+
To use MariaDB as the database backend for the application, set `mariadb.enabled=true`
22+
23+
For more advanced configuration options (e.g., setting up replication, customizing storage), refer to the official [Bitnami MariaDB Helm chart documentation](https://artifacthub.io/packages/helm/bitnami/mariadb).
24+
1925
## Values
2026

2127
| Key | Type | Default | Description |
@@ -46,6 +52,12 @@ A self-hosted Monitoring tool like "Uptime-Robot".
4652
| livenessProbe.periodSeconds | int | `10` | |
4753
| livenessProbe.successThreshold | int | `1` | |
4854
| livenessProbe.timeoutSeconds | int | `2` | |
55+
| mariadb.enabled | bool | `false` | Whether to enable MariaDB as the database backend. |
56+
| mariadb.architecture | str | `standalone` | |
57+
| mariadb.auth.database | str | `uptime_kuma` | |
58+
| mariadb.auth.username | str | `uptime_kuma` | |
59+
| mariadb.auth.password | str | `""` | |
60+
| mariadb.auth.rootPassword | str | `""` | |
4961
| nameOverride | string | `""` | |
5062
| namespaceOverride | string | `""` | A custom namespace to override the default namespace for the deployed resources. |
5163
| networkPolicy | object | `{"allowExternal":true,"egress":true,"enabled":false,"ingress":true,"namespaceSelector":{}}` | Create a NetworkPolicy |

charts/uptime-kuma/templates/deployment.yaml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,27 @@ spec:
5454
{{- toYaml .Values.securityContext | nindent 12 }}
5555
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
5656
imagePullPolicy: {{ .Values.image.pullPolicy }}
57-
{{- with .Values.podEnv }}
5857
env:
58+
{{- with .Values.podEnv }}
5959
{{- toYaml . | nindent 12 }}
60-
{{- end }}
60+
{{- end }}
61+
{{- if .Values.mariadb.enabled }}
62+
- name: UPTIME_KUMA_DB_TYPE
63+
value: "mariadb"
64+
- name: UPTIME_KUMA_DB_HOSTNAME
65+
value: "{{ .Release.Name }}-mariadb"
66+
- name: UPTIME_KUMA_DB_PORT
67+
value: "3306"
68+
- name: UPTIME_KUMA_DB_NAME
69+
value: "{{ .Values.mariadb.auth.database }}"
70+
- name: UPTIME_KUMA_DB_USERNAME
71+
value: "{{ .Values.mariadb.auth.username }}"
72+
- name: UPTIME_KUMA_DB_PASSWORD
73+
valueFrom:
74+
secretKeyRef:
75+
name: "{{ .Release.Name }}-mariadb"
76+
key: "mariadb-password"
77+
{{- end }}
6178
ports:
6279
- name: http
6380
containerPort: {{ include "uptime-kuma.port" . }}
@@ -111,6 +128,22 @@ spec:
111128
{{- end }}
112129
resources:
113130
{{- toYaml .Values.resources | nindent 12 }}
131+
{{- if .Values.mariadb.enabled }}
132+
initContainers:
133+
- name: wait-for-db
134+
image: busybox:latest
135+
command:
136+
- "/bin/sh"
137+
- "-c"
138+
- "until nc -z {{ .Release.Name }}-mariadb 3306; do echo 'Waiting for MariaDB...'; sleep 2; done; echo 'MariaDB is ready!'"
139+
resources:
140+
limits:
141+
memory: "64Mi"
142+
cpu: "100m"
143+
requests:
144+
memory: "32Mi"
145+
cpu: "50m"
146+
{{- end }}
114147
{{- with .Values.nodeSelector }}
115148
nodeSelector:
116149
{{- toYaml . | nindent 8 }}

charts/uptime-kuma/templates/statefulset.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,23 @@ spec:
5858
{{- with .Values.podEnv }}
5959
{{- toYaml . | nindent 12 }}
6060
{{- end }}
61+
{{- if .Values.mariadb.enabled }}
62+
- name: UPTIME_KUMA_DB_TYPE
63+
value: "mariadb"
64+
- name: UPTIME_KUMA_DB_HOSTNAME
65+
value: "{{ .Release.Name }}-mariadb"
66+
- name: UPTIME_KUMA_DB_PORT
67+
value: "3306"
68+
- name: UPTIME_KUMA_DB_NAME
69+
value: "{{ .Values.mariadb.auth.database }}"
70+
- name: UPTIME_KUMA_DB_USERNAME
71+
value: "{{ .Values.mariadb.auth.username }}"
72+
- name: UPTIME_KUMA_DB_PASSWORD
73+
valueFrom:
74+
secretKeyRef:
75+
name: "{{ .Release.Name }}-mariadb"
76+
key: "mariadb-password"
77+
{{- end }}
6178
ports:
6279
- name: http
6380
containerPort: {{ include "uptime-kuma.port" . }}

charts/uptime-kuma/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,16 @@ additionalVolumeMounts:
168168
strategy:
169169
type: Recreate
170170

171+
# Mariadb configurations
172+
mariadb:
173+
enabled: false
174+
architecture: standalone
175+
auth:
176+
database: uptime_kuma
177+
username: uptime_kuma
178+
password: ""
179+
rootPassword: ""
180+
171181
# Prometheus ServiceMonitor configuration
172182
serviceMonitor:
173183
enabled: false

0 commit comments

Comments
 (0)