Files
manifests/charts/matomo/templates/post-install-job.yaml
T
mrtz 8f46e45cfb feat: Add Matomo Chart for analytics
Also adds the Digitalist Chart as Backup in case the
bitnami one stops working.
2025-09-11 10:25:17 +02:00

77 lines
2.8 KiB
YAML

{{- if .Values.matomo.postInstallCommand }}
apiVersion: batch/v1
kind: Job
metadata:
name: matomo-post-install
namespace: {{.Values.namespace}}
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
partOf: matomo
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
metadata:
name: "{{ .Release.Name }}"
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
restartPolicy: Never
{{ include "matomo.images.pullSecrets" ( dict "images" (list .Values.matomo) "global" .Values.global) | nindent 6 }}
containers:
- name: post-install-matomo
image: {{.Values.matomo.image}}
lifecycle:
postStart:
exec:
command: [ 'sh' , '-c' , '{{.Values.matomo.installCommand}}' ]
# To do anything with Matomo, we first need to bootstrap it (curl).
command: [ 'bash' , '-c' , 'sleep {{.Values.matomo.postInstallSleepTime}}; curl -Il https://{{.Values.matomo.dashboard.hostname}}; {{.Values.matomo.postInstallCommand}}' ]
env:
- name: MATOMO_FIRST_USER_NAME
value: {{.Values.matomo.dashboard.firstuser.username}}
- name: MATOMO_FIRST_USER_EMAIL
value: {{.Values.matomo.dashboard.firstuser.email}}
- name: MATOMO_FIRST_USER_PASSWORD
value: {{.Values.matomo.dashboard.firstuser.password}}
- name: MATOMO_DB_HOST
value: {{.Values.db.hostname}}
- name: MATOMO_DB_NAME
value: {{.Values.db.name}}
{{ if .Values.db.prefix }}
- name: MATOMO_DB_PREFIX
value: {{.Values.db.prefix}}
{{ end }}
- name: MATOMO_DB_USERNAME
value: {{.Values.db.username}}
- name: MATOMO_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.db.password.secretKeyRef.name }}
key: {{ .Values.db.password.secretKeyRef.key }}
{{ include "matomo.license" . | nindent 8 }}
volumeMounts:
- name: matomo-startup-config
mountPath: /var/www/html/config/config.ini.php
subPath: config.ini.php
{{- if .Values.extraVolumeMounts }}
{{ toYaml .Values.extraVolumeMounts | indent 8 }}
{{- end }}
volumes:
- name: matomo-startup-config
configMap:
name: matomo-startup-config
{{- if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumes | indent 8 }}
{{- end }}
{{- end -}}