Files
manifests/charts/matomo/templates/deployment-matomo-dashboard.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

205 lines
6.3 KiB
YAML

---
{{- if .Values.matomo.dashboard.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: matomo-dashboard
namespace: {{.Values.namespace}}
labels:
app: matomo-dashboard
{{- if .Values.matomo.extralabels }}
{{ toYaml .Values.matomo.extralabels | indent 4 }}
{{- end }}
spec:
replicas: {{.Values.matomo.dashboard.replicas}}
selector:
matchLabels:
app: matomo-dashboard
template:
metadata:
labels:
app: matomo-dashboard
{{- if .Values.matomo.extralabels }}
{{ toYaml .Values.matomo.extralabels | indent 8 }}
{{- end }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap-matomo.yaml") . | sha256sum }}
spec:
{{ include "matomo.init" . | nindent 6 }}
containers:
{{- if .Values.matomo.dashboard.sidecars }}
{{ toYaml .Values.matomo.dashboard.sidecars | indent 6 }}
{{- end }}
- name: fpm-metrics
securityContext:
runAsUser: {{.Values.matomo.runAsUser}}
privileged: false
allowPrivilegeEscalation: false
image: hipages/php-fpm_exporter:2.2.0
imagePullPolicy: Always
env:
- name: PHP_FPM_FIX_PROCESS_COUNT
value: "true"
resources:
limits:
memory: 128Mi
requests:
cpu: 15m
memory: 32Mi
- name: nginx
image: {{.Values.nginx.image}}
{{- if .Values.nginx.resources }}
resources:
{{ toYaml .Values.nginx.resources | indent 10 }}
{{- end }}
# readinessProbe:
# httpGet:
# scheme: HTTP
# path: /index.php
# port: 8080
livenessProbe:
exec:
command:
- /bin/sh
- -c
- "[ -f /tmp/nginx.pid ] && ps -A | grep nginx"
initialDelaySeconds: 10
periodSeconds: 5
securityContext:
runAsUser: {{.Values.nginx.runAsUser}}
privileged: false
allowPrivilegeEscalation: false
volumeMounts:
- name: nginx-conf
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
readOnly: true
- name: fastcgi-params
mountPath: /etc/nginx/fastcgi_params
subPath: fastcgi_params
readOnly: true
- name: mime-types
mountPath: /etc/nginx/mime.types
subPath: mime.types
readOnly: true
- name: static-data
mountPath: /var/www/html
readOnly: true
ports:
- containerPort: 8080
- name: matomo
image: {{.Values.matomo.image}}
{{- if .Values.matomo.resources }}
resources:
{{ toYaml .Values.matomo.resources | indent 10 }}
{{- end }}
securityContext:
runAsUser: {{.Values.matomo.runAsUser}}
privileged: false
allowPrivilegeEscalation: false
imagePullPolicy: Always
env:
- name: MATOMO_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.db.password.secretKeyRef.name }}
key: {{ .Values.db.password.secretKeyRef.key }}
{{ include "matomo.license" . | nindent 8 }}
ports:
- containerPort: 9000
volumeMounts:
- name: static-data
mountPath: /var/www/html
- name: matomo-phpfpm
mountPath: /usr/local/etc/php-fpm.d/zz-global.conf
subPath: zz-global.conf
- name: matomo-dashboard-php
mountPath: /usr/local/etc/php/conf.d/zz-global.ini
subPath: zz-global.ini
{{- if .Values.xdebug.disabled }}
- name: matomo-disable-xdebug
mountPath: /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
subPath: docker-php-ext-xdebug.ini
{{- end }}
{{- if .Values.extraVolumeMounts }}
{{ toYaml .Values.extraVolumeMounts | indent 10 }}
{{- end }}
{{- if .Values.matomo.livenessProbe }}
livenessProbe:
{{- if .Values.matomo.livenessProbe.exec }}
exec:
command:
- sh
- -c
- {{ .Values.matomo.livenessProbe.exec.command }}
initialDelaySeconds: {{ .Values.matomo.livenessProbe.initialDelaySeconds | default 10 }}
periodSeconds: {{ .Values.matomo.livenessProbe.periodSeconds | default 20 }}
timeoutSeconds: {{ .Values.matomo.livenessProbe.timeoutSeconds | default 10 }}
{{- end }}
{{- end }}
{{- if .Values.matomo.readinessProbe }}
readinessProbe:
httpGet:
path: {{ .Values.matomo.readinessProbe.httpGet.path }}
port: {{ .Values.matomo.readinessProbe.httpGet.port | default 80 }}
initialDelaySeconds: {{ .Values.matomo.livenessProbe.initialDelaySeconds | default 30 }}
periodSeconds: {{ .Values.matomo.livenessProbe.periodSeconds | default 30 }}
{{- end }}
{{ include "matomo.images.pullSecrets" ( dict "images" (list .Values.matomo) "global" .Values.global) | nindent 6 }}
volumes:
- name: nginx-conf
configMap:
name: nginx-matomo-dashboard
items:
- key: nginx.conf
path: nginx.conf
- name: fastcgi-params
configMap:
name: nginx-matomo-dashboard
items:
- key: fastcgi_params
path: fastcgi_params
- name: mime-types
configMap:
name: nginx-matomo-dashboard
items:
- key: mime.types
path: mime.types
- name: matomo-configuration
configMap:
name: matomo-configuration
- name: matomo-phpfpm
configMap:
name: matomo-phpfpm
- name: matomo-dashboard-php
configMap:
name: matomo-dashboard-php
{{- if .Values.xdebug.disabled }}
- name: matomo-disable-xdebug
configMap:
name: matomo-disable-xdebug
{{- end }}
- name: static-data
emptyDir: {}
{{- if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumes | indent 6 }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: matomo-dashboard
namespace: {{.Values.namespace}}
labels:
app: matomo-dashboard
{{- if .Values.matomo.extralabels }}
{{ toYaml .Values.matomo.extralabels | indent 4 }}
{{- end }}
spec:
ports:
- port: 8080
protocol: TCP
selector:
app: matomo-dashboard
{{- end -}}