Skip to content

Commit

Permalink
setup matomo in k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
anantharam committed Aug 1, 2024
1 parent 1ddcd2a commit 5c93bc1
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 52 deletions.
2 changes: 1 addition & 1 deletion argocd-helm-charts/matomo/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ name: matomo
version: 2.1.0
dependencies:
- name: matomo
version: 8.0.5
version: 11.0.31
repository: https://charts.bitnami.com/bitnami
4 changes: 2 additions & 2 deletions argocd-helm-charts/matomo/templates/mariadb-database.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: mariadb.mmontes.io/v1alpha1
apiVersion: k8s.mariadb.com/v1alpha1
kind: Database
metadata:
name: matomo
name: matomo-mariadb
spec:
mariaDbRef:
name: matomo-mariadb
Expand Down
5 changes: 4 additions & 1 deletion argocd-helm-charts/matomo/templates/mariadb-grant.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: mariadb.mmontes.io/v1alpha1
apiVersion: k8s.mariadb.com/v1alpha1
kind: Grant
metadata:
name: grant
Expand All @@ -17,4 +17,7 @@ spec:
database: "*"
table: "*"
username: matomo
host: "%"
grantOption: true
requeueInterval: 30s
retryInterval: 5s
12 changes: 0 additions & 12 deletions argocd-helm-charts/matomo/templates/mariadb-user.yaml

This file was deleted.

49 changes: 27 additions & 22 deletions argocd-helm-charts/matomo/templates/mariadb.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
apiVersion: mariadb.mmontes.io/v1alpha1
apiVersion: k8s.mariadb.com/v1alpha1
kind: MariaDB
metadata:
name: matomo-mariadb
spec:
rootPasswordSecretKeyRef:
name: mariadb-secret
key: root-password
name: {{ .Values.mariadb.rootPasswordSecretKeyRef.name }}
key: {{ .Values.mariadb.rootPasswordSecretKeyRef.key }}
generate: {{ .Values.mariadb.rootPasswordSecretKeyRef.generate }}

image:
repository: mariadb
tag: {{ .Values.mariadb.image.tag | default "11.0.3" }}
pullPolicy: IfNotPresent
storage:
size: {{ .Values.mariadb.storage.size }}
storageClassName: {{ .Values.mariadb.storage.storageClassName }}
resizeInUseVolumes: {{ .Values.mariadb.storage.resizeInUseVolumes }}
waitForVolumeResize: {{ .Values.mariadb.storage.waitForVolumeResize }}

port: 3306
securityContext:
allowPrivilegeEscalation: false

volumeClaimTemplate:
resources:
requests:
storage: {{ .Values.mariadb.volumeClaimTemplate.resources.requests.storage | default "1Gi" }}
accessModes:
- ReadWriteOnce
podDisruptionBudget:
maxUnavailable: 50%

myCnf: |
[mariadb]
bind-address=0.0.0.0
bind-address=*
default_storage_engine=InnoDB
binlog_format=row
innodb_autoinc_lock_mode=2
innodb_buffer_pool_size=1024M
max_allowed_packet=256M
resources:
requests:
cpu: {{ .Values.mariadb.resources.requests.cpu | default "100m" }}
memory: {{ .Values.mariadb.resources.requests.memory | default "128Mi" }}
limits:
cpu: {{ .Values.mariadb.resources.limits.cpu | default "300m" }}
memory: {{ .Values.mariadb.resources.limits.memory | default "512Mi" }}
username: {{ .Values.mariadb.username }}
passwordSecretKeyRef:
name: {{ .Values.mariadb.passwordSecretKeyRef.name }}
key: {{ .Values.mariadb.passwordSecretKeyRef.key }}
generate: {{ .Values.mariadb.passwordSecretKeyRef.generate }}
database: {{ .Values.mariadb.database }}

image: {{ .Values.mariadb.image }}
imagePullPolicy: {{ .Values.mariadb.imagePullPolicy }}
imagePullSecrets:
- name: registry
45 changes: 31 additions & 14 deletions argocd-helm-charts/matomo/values.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,42 @@
matomo:
image:
tag: latest
mariadb:
enabled: false
externalDatabase:
host: matomo-mariadb
port: 3306
user: matomo
database: matomo
existingSecret: mariadb-secret
existingSecret: matomo-user
persistence:
size: 1Gi
cronjobs:
archive:
persistence:
enabled: false
taskScheduler:
persistence:
enabled: false
service:
type: ClusterIP

# This are configs for external mariadb deployment
mariadb:
image:
tag: "11.0.3"
volumeClaimTemplate:
resources:
requests:
storage: 1Gi
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 300m
memory: 512Mi
rootPasswordSecretKeyRef: #cannot remove this when using zfs-localpv, the pod remains in pending state due to pvc issue
name: matomo-secrets
key: MARIADB_ROOT_PASSWORD
generate: true
storage:
size: 1Gi
storageClassName: zfs-localpv # using zfs instead of rook-ceph because with rook ceph liveness and readiness probes fail as root password doesnt get set properly
resizeInUseVolumes: true
waitForVolumeResize: true
image: "mariadb:latest"
imagePullPolicy: IfNotPresent
username: matomo
passwordSecretKeyRef:
name: matomo-user
key: db-password # this should be set to db-password as when we pass externalDatabase.existingSecret in values file, it checks for this key
generate: true
database: matomo-mariadb

0 comments on commit 5c93bc1

Please sign in to comment.