Skip to content

Commit

Permalink
feat: matomo sync
Browse files Browse the repository at this point in the history
  • Loading branch information
matmut7 committed Dec 5, 2023
1 parent 7fbc765 commit 03a456a
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
3 changes: 3 additions & 0 deletions charts/matomo-sync/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apiVersion: v2
name: matomo-sync
version: 1.0.0
58 changes: 58 additions & 0 deletions charts/matomo-sync/templates/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: batch/v1
kind: CronJob
metadata:
annotations:
labels:
application: "{{ .Values.name }}"
component: "{{ .Values.name }}"
name: cronjob-{{ .Values.name }}
spec:
schedule: 30 * * * *
concurrencyPolicy: Forbid
jobTemplate:
spec:
backoffLimit: 3
activeDeadlineSeconds: 3600
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
application: "{{ .Values.name }}"
component: "{{ .Values.name }}"
name: cronjob-{{ .Values.name }}
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
runAsNonRoot: true
restartPolicy: OnFailure
containers:
- command:
- sh
- -c
- npx @socialgouv/matomo-postgres
securityContext:
allowPrivilegeEscalation: false
env:
- name: STARTDATE
value: "2019-01-01"
- name: DEBUG
value: "*"
- name: MATOMO_URL
value: "{{ .Values.matomoUrl }}"
- name: MATOMO_SITE
value: "{{ required "a Matomo ID is required" .Values.matomoId }}"
- name: DESTINATION_TABLE
value: "{{ or .Values.table `matomo` }}"
- name: PGDATABASE
valueFrom:
secretKeyRef:
name: "{{ .Values.db.secretName }}"
key: "{{ .Values.db.secretKey }}"
envFrom:
- secretRef:
name: "{{ .Values.cronjobSecretName}}"
image: node:14-alpine
imagePullPolicy: IfNotPresent
name: container
8 changes: 8 additions & 0 deletions charts/matomo-sync/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: "matomo-sync-cronjob"
cronjobSecretName: "matomo-sync-secret"
matomoId:
matomoUrl: "https://matomo.fabrique.social.gouv.fr"
table: "matomo"
db:
secretName: "pg-matomo-app"
secretKey: "DATABASE_URL"

0 comments on commit 03a456a

Please sign in to comment.