From 6471b4a264876caae447d35dca0b34061d6a3233 Mon Sep 17 00:00:00 2001 From: Alex Lebens Date: Sat, 13 Dec 2025 13:28:52 -0600 Subject: [PATCH] add discord --- .../cl01tl/helm/matrix-synapse/Chart.lock | 7 +- .../cl01tl/helm/matrix-synapse/Chart.yaml | 8 +- .../matrix-synapse/templates/database.yaml | 16 ++ .../templates/external-secret.yaml | 166 +++++++++--------- .../templates/replication-source.yaml | 116 ++++++------ .../cl01tl/helm/matrix-synapse/values.yaml | 47 +++-- 6 files changed, 202 insertions(+), 158 deletions(-) diff --git a/clusters/cl01tl/helm/matrix-synapse/Chart.lock b/clusters/cl01tl/helm/matrix-synapse/Chart.lock index 5f51e5715..251211aa3 100644 --- a/clusters/cl01tl/helm/matrix-synapse/Chart.lock +++ b/clusters/cl01tl/helm/matrix-synapse/Chart.lock @@ -8,6 +8,9 @@ dependencies: - name: app-template repository: https://bjw-s-labs.github.io/helm-charts/ version: 4.5.0 +- name: app-template + repository: https://bjw-s-labs.github.io/helm-charts/ + version: 4.5.0 - name: cloudflared repository: oci://harbor.alexlebens.net/helm-charts version: 1.23.2 @@ -17,5 +20,5 @@ dependencies: - name: postgres-cluster repository: oci://harbor.alexlebens.net/helm-charts version: 6.16.1 -digest: sha256:39947be082bd5217be527bb9a603f5026e877e988100165bb76970e5192b7e56 -generated: "2025-12-13T12:37:23.30846-06:00" +digest: sha256:70e8b9480a6eac2ffe4b2e049aac1da6b7ff282e8930d555e008fbd769e84a8f +generated: "2025-12-13T13:28:40.160104-06:00" diff --git a/clusters/cl01tl/helm/matrix-synapse/Chart.yaml b/clusters/cl01tl/helm/matrix-synapse/Chart.yaml index eb3f23c3b..b867c1ab2 100644 --- a/clusters/cl01tl/helm/matrix-synapse/Chart.yaml +++ b/clusters/cl01tl/helm/matrix-synapse/Chart.yaml @@ -35,10 +35,10 @@ dependencies: alias: matrix-hookshot version: 4.5.0 repository: https://bjw-s-labs.github.io/helm-charts/ - # - name: app-template - # alias: mautrix-discord - # repository: https://bjw-s-labs.github.io/helm-charts/ - # version: 4.5.0 + - name: app-template + alias: mautrix-discord + repository: https://bjw-s-labs.github.io/helm-charts/ + version: 4.5.0 - name: app-template alias: mautrix-whatsapp repository: https://bjw-s-labs.github.io/helm-charts/ diff --git a/clusters/cl01tl/helm/matrix-synapse/templates/database.yaml b/clusters/cl01tl/helm/matrix-synapse/templates/database.yaml index 1284e0d39..b0fdb77e5 100644 --- a/clusters/cl01tl/helm/matrix-synapse/templates/database.yaml +++ b/clusters/cl01tl/helm/matrix-synapse/templates/database.yaml @@ -1,5 +1,21 @@ apiVersion: postgresql.cnpg.io/v1 kind: Database +metadata: + name: matrix-synapse-postgresql-18-cluster-mautrix-discord-database + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: matrix-synapse-postgresql-18-cluster-mautrix-discord-database + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + cluster: + name: matrix-synapse-postgresql-18-cluster + name: mautrix-discord + owner: app + +--- +apiVersion: postgresql.cnpg.io/v1 +kind: Database metadata: name: matrix-synapse-postgresql-18-cluster-mautrix-whatsapp-database namespace: {{ .Release.Namespace }} diff --git a/clusters/cl01tl/helm/matrix-synapse/templates/external-secret.yaml b/clusters/cl01tl/helm/matrix-synapse/templates/external-secret.yaml index b5f050890..b6e5d3cf3 100644 --- a/clusters/cl01tl/helm/matrix-synapse/templates/external-secret.yaml +++ b/clusters/cl01tl/helm/matrix-synapse/templates/external-secret.yaml @@ -94,34 +94,34 @@ spec: metadataPolicy: None property: passkey -# --- -# apiVersion: external-secrets.io/v1 -# kind: ExternalSecret -# metadata: -# name: mautrix-discord-config-secret -# namespace: {{ .Release.Namespace }} - # labels: - # app.kubernetes.io/name: {{ .Release.Name }} - # app.kubernetes.io/instance: {{ .Release.Name }} -# spec: -# secretStoreRef: -# kind: ClusterSecretStore -# name: vault -# data: -# - secretKey: config.yaml -# remoteRef: -# conversionStrategy: Default -# decodingStrategy: None -# key: /cl01tl/matrix-synapse/mautrix-discord -# metadataPolicy: None -# property: config -# - secretKey: mautrix-discord-registration.yaml -# remoteRef: -# conversionStrategy: Default -# decodingStrategy: None -# key: /cl01tl/matrix-synapse/mautrix-discord -# metadataPolicy: None -# property: registration +--- +apiVersion: external-secrets.io/v1 +kind: ExternalSecret +metadata: + name: mautrix-discord-config-secret + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} +spec: + secretStoreRef: + kind: ClusterSecretStore + name: vault + data: + - secretKey: config.yaml + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /cl01tl/matrix-synapse/mautrix-discord + metadataPolicy: None + property: config + - secretKey: mautrix-discord-registration.yaml + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /cl01tl/matrix-synapse/mautrix-discord + metadataPolicy: None + property: registration --- apiVersion: external-secrets.io/v1 @@ -302,61 +302,61 @@ spec: metadataPolicy: None property: secret_key -# --- -# apiVersion: external-secrets.io/v1 -# kind: ExternalSecret -# metadata: -# name: mautrix-discord-data-backup-secret -# namespace: {{ .Release.Namespace }} - # labels: - # app.kubernetes.io/name: {{ .Release.Name }} - # app.kubernetes.io/instance: {{ .Release.Name }} -# spec: -# secretStoreRef: -# kind: ClusterSecretStore -# name: vault -# target: -# template: -# mergePolicy: Merge -# engineVersion: v2 -# data: -# RESTIC_REPOSITORY: "{{ `{{ .BUCKET_ENDPOINT }}` }}/matrix-synapse/mautrix-discord-data" -# data: -# - secretKey: BUCKET_ENDPOINT -# remoteRef: -# conversionStrategy: Default -# decodingStrategy: None -# key: /cl01tl/volsync/restic/config -# metadataPolicy: None -# property: S3_BUCKET_ENDPOINT -# - secretKey: RESTIC_PASSWORD -# remoteRef: -# conversionStrategy: Default -# decodingStrategy: None -# key: /cl01tl/volsync/restic/config -# metadataPolicy: None -# property: RESTIC_PASSWORD -# - secretKey: AWS_DEFAULT_REGION -# remoteRef: -# conversionStrategy: Default -# decodingStrategy: None -# key: /cl01tl/volsync/restic/config -# metadataPolicy: None -# property: AWS_DEFAULT_REGION -# - secretKey: AWS_ACCESS_KEY_ID -# remoteRef: -# conversionStrategy: Default -# decodingStrategy: None -# key: /digital-ocean/home-infra/volsync-backups -# metadataPolicy: None -# property: access_key -# - secretKey: AWS_SECRET_ACCESS_KEY -# remoteRef: -# conversionStrategy: Default -# decodingStrategy: None -# key: /digital-ocean/home-infra/volsync-backups -# metadataPolicy: None -# property: secret_key +--- +apiVersion: external-secrets.io/v1 +kind: ExternalSecret +metadata: + name: mautrix-discord-data-backup-secret + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} +spec: + secretStoreRef: + kind: ClusterSecretStore + name: vault + target: + template: + mergePolicy: Merge + engineVersion: v2 + data: + RESTIC_REPOSITORY: "{{ `{{ .BUCKET_ENDPOINT }}` }}/matrix-synapse/mautrix-discord-data" + data: + - secretKey: BUCKET_ENDPOINT + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /cl01tl/volsync/restic/config + metadataPolicy: None + property: S3_BUCKET_ENDPOINT + - secretKey: RESTIC_PASSWORD + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /cl01tl/volsync/restic/config + metadataPolicy: None + property: RESTIC_PASSWORD + - secretKey: AWS_DEFAULT_REGION + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /cl01tl/volsync/restic/config + metadataPolicy: None + property: AWS_DEFAULT_REGION + - secretKey: AWS_ACCESS_KEY_ID + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /digital-ocean/home-infra/volsync-backups + metadataPolicy: None + property: access_key + - secretKey: AWS_SECRET_ACCESS_KEY + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /digital-ocean/home-infra/volsync-backups + metadataPolicy: None + property: secret_key --- apiVersion: external-secrets.io/v1 diff --git a/clusters/cl01tl/helm/matrix-synapse/templates/replication-source.yaml b/clusters/cl01tl/helm/matrix-synapse/templates/replication-source.yaml index b507d4c91..726f60faa 100644 --- a/clusters/cl01tl/helm/matrix-synapse/templates/replication-source.yaml +++ b/clusters/cl01tl/helm/matrix-synapse/templates/replication-source.yaml @@ -24,62 +24,62 @@ spec: storageClassName: ceph-block volumeSnapshotClassName: ceph-blockpool-snapshot -# --- -# apiVersion: volsync.backube/v1alpha1 -# kind: ReplicationSource -# metadata: -# name: mautrix-discord-data-backup-source -# namespace: {{ .Release.Namespace }} -# labels: -# app.kubernetes.io/name: mautrix-discord-data-backup-source -# app.kubernetes.io/instance: {{ .Release.Name }} -# app.kubernetes.io/part-of: {{ .Release.Name }} -# spec: -# sourcePVC: mautrix-discord-data -# trigger: -# schedule: 0 4 * * * -# restic: -# pruneIntervalDays: 7 -# repository: mautrix-discord-data-backup-secret -# retain: -# hourly: 1 -# daily: 3 -# weekly: 2 -# monthly: 2 -# yearly: 4 -# moverSecurityContext: -# runAsUser: 1337 -# runAsGroup: 1337 -# copyMethod: Snapshot -# storageClassName: ceph-block -# volumeSnapshotClassName: ceph-blockpool-snapshot +--- +apiVersion: volsync.backube/v1alpha1 +kind: ReplicationSource +metadata: + name: mautrix-discord-data-backup-source + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: mautrix-discord-data-backup-source + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + sourcePVC: mautrix-discord + trigger: + schedule: 0 4 * * * + restic: + pruneIntervalDays: 7 + repository: mautrix-discord-data-backup-secret + retain: + hourly: 1 + daily: 3 + weekly: 2 + monthly: 2 + yearly: 4 + moverSecurityContext: + runAsUser: 1337 + runAsGroup: 1337 + copyMethod: Snapshot + storageClassName: ceph-block + volumeSnapshotClassName: ceph-blockpool-snapshot -# --- -# apiVersion: volsync.backube/v1alpha1 -# kind: ReplicationSource -# metadata: -# name: mautrix-whatsapp-data-backup-source -# namespace: {{ .Release.Namespace }} -# labels: -# app.kubernetes.io/name: mautrix-whatsapp-data-backup-source -# app.kubernetes.io/instance: {{ .Release.Name }} -# app.kubernetes.io/part-of: {{ .Release.Name }} -# spec: -# sourcePVC: mautrix-whatsapp-data -# trigger: -# schedule: 0 4 * * * -# restic: -# pruneIntervalDays: 7 -# repository: mautrix-whatsapp-data-backup-secret -# retain: -# hourly: 1 -# daily: 3 -# weekly: 2 -# monthly: 2 -# yearly: 4 -# moverSecurityContext: -# runAsUser: 1337 -# runAsGroup: 1337 -# copyMethod: Snapshot -# storageClassName: ceph-block -# volumeSnapshotClassName: ceph-blockpool-snapshot +--- +apiVersion: volsync.backube/v1alpha1 +kind: ReplicationSource +metadata: + name: mautrix-whatsapp-data-backup-source + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: mautrix-whatsapp-data-backup-source + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/part-of: {{ .Release.Name }} +spec: + sourcePVC: mautrix-whatsapp + trigger: + schedule: 0 4 * * * + restic: + pruneIntervalDays: 7 + repository: mautrix-whatsapp-data-backup-secret + retain: + hourly: 1 + daily: 3 + weekly: 2 + monthly: 2 + yearly: 4 + moverSecurityContext: + runAsUser: 1337 + runAsGroup: 1337 + copyMethod: Snapshot + storageClassName: ceph-block + volumeSnapshotClassName: ceph-blockpool-snapshot diff --git a/clusters/cl01tl/helm/matrix-synapse/values.yaml b/clusters/cl01tl/helm/matrix-synapse/values.yaml index a761fca38..9e5f3d8ce 100644 --- a/clusters/cl01tl/helm/matrix-synapse/values.yaml +++ b/clusters/cl01tl/helm/matrix-synapse/values.yaml @@ -29,6 +29,7 @@ matrix-synapse: - /synapse/config/conf.d/hookshot-registration.yaml - /synapse/config/conf.d/double-puppet-registration.yaml - /synapse/config/conf.d/mautrix-whatsapp-registration.yaml + - /synapse/config/conf.d/mautrix-discord-registration.yaml synapse: strategy: type: Recreate @@ -39,9 +40,9 @@ matrix-synapse: - name: matrix-hookshot-config-secret secret: secretName: matrix-hookshot-config-secret - # - name: mautrix-discord-config-secret - # secret: - # secretName: mautrix-discord-config-secret + - name: mautrix-discord-config-secret + secret: + secretName: mautrix-discord-config-secret - name: mautrix-whatsapp-config-secret secret: secretName: mautrix-whatsapp-config-secret @@ -61,10 +62,10 @@ matrix-synapse: mountPath: /synapse/config/conf.d/hookshot-registration.yaml subPath: hookshot-registration.yaml readOnly: true - # - name: mautrix-discord-config-secret - # mountPath: /synapse/config/conf.d/mautrix-discord-registration.yaml - # subPath: mautrix-discord-registration.yaml - # readOnly: true + - name: mautrix-discord-config-secret + mountPath: /synapse/config/conf.d/mautrix-discord-registration.yaml + subPath: mautrix-discord-registration.yaml + readOnly: true - name: mautrix-whatsapp-config-secret mountPath: /synapse/config/conf.d/mautrix-whatsapp-registration.yaml subPath: mautrix-whatsapp-registration.yaml @@ -214,6 +215,7 @@ matrix-hookshot: readOnly: false mautrix-discord: global: + nameOverride: mautrix-discord fullnameOverride: mautrix-discord controllers: main: @@ -221,6 +223,26 @@ mautrix-discord: replicas: 1 strategy: RollingUpdate revisionHistoryLimit: 3 + initContainers: + init-copy-config: + image: + repository: busybox + tag: 1.37.0 + pullPolicy: IfNotPresent + resources: + requests: + cpu: 10m + memory: 128Mi + command: + - /bin/sh + - -ec + - | + echo ">> Coping files ..." + ls /tmp + cp -fv /tmp/config.yaml /data/config.yaml + cp -fv /tmp/mautrix-discord-registration.yaml /data/registration.yaml + echo ">> Files in data:" + ls /data containers: main: image: @@ -246,8 +268,8 @@ mautrix-discord: name: mautrix-discord-config-secret advancedMounts: main: - main: - - path: /data/config.yaml + init-copy-config: + - path: /tmp/config.yaml readOnly: true mountPropagation: None subPath: config.yaml @@ -257,8 +279,8 @@ mautrix-discord: name: mautrix-discord-config-secret advancedMounts: main: - main: - - path: /data/mautrix-discord-registration.yaml + init-copy-config: + - path: /tmp/mautrix-discord-registration.yaml readOnly: true mountPropagation: None subPath: mautrix-discord-registration.yaml @@ -269,6 +291,9 @@ mautrix-discord: retain: true advancedMounts: main: + init-copy-config: + - path: /data + readOnly: false main: - path: /data readOnly: false