From a14ea29a960c53ec3b425d65fc3493bfbe069799 Mon Sep 17 00:00:00 2001 From: JJGadgets Date: Thu, 4 Jan 2024 08:00:31 +0800 Subject: [PATCH] fix(thelounge): PVC & VolSync --- kube/deploy/apps/thelounge/app/config.yaml | 10 +++--- kube/deploy/apps/thelounge/app/hr.yaml | 3 +- kube/deploy/apps/thelounge/app/pvc.yaml | 17 --------- kube/deploy/apps/thelounge/app/volsync.yaml | 36 ------------------- kube/deploy/apps/thelounge/ks.yaml | 24 +++++++++++-- .../core/storage/volsync/template/rsrc.yaml | 2 +- 6 files changed, 30 insertions(+), 62 deletions(-) delete mode 100644 kube/deploy/apps/thelounge/app/pvc.yaml delete mode 100644 kube/deploy/apps/thelounge/app/volsync.yaml diff --git a/kube/deploy/apps/thelounge/app/config.yaml b/kube/deploy/apps/thelounge/app/config.yaml index 479501c5..c150cb12 100644 --- a/kube/deploy/apps/thelounge/app/config.yaml +++ b/kube/deploy/apps/thelounge/app/config.yaml @@ -23,11 +23,11 @@ stringData: disableMediaPreview: false, prefetchStorage: false, fileUpload: { - enable: false, - maxFileSize: 10240, - baseUrl: null, + enable: true, + maxFileSize: -1, + baseUrl: "https://${APP_DNS_THELOUNGE_UPLOADS}/tinfoil/", }, - transports: ["polling", "websocket"], + transports: ["websocket", "polling"], leaveMessage: "kthxbye", defaults: { name: "${APP_DNS_KAHIRC}", @@ -43,7 +43,7 @@ stringData: leaveMessage: "kthxbye", }, lockNetwork: false, - messageStorage: ["sqlite", "text"], + messageStorage: ["sqlite"], useHexIp: false, webirc: null, identd: { diff --git a/kube/deploy/apps/thelounge/app/hr.yaml b/kube/deploy/apps/thelounge/app/hr.yaml index 09e2d194..46dfbc09 100644 --- a/kube/deploy/apps/thelounge/app/hr.yaml +++ b/kube/deploy/apps/thelounge/app/hr.yaml @@ -70,4 +70,5 @@ spec: cpu: 10m memory: 128Mi limits: - memory: 6000Mi \ No newline at end of file + cpu: 1000m + memory: 6000Mi diff --git a/kube/deploy/apps/thelounge/app/pvc.yaml b/kube/deploy/apps/thelounge/app/pvc.yaml deleted file mode 100644 index f837fda6..00000000 --- a/kube/deploy/apps/thelounge/app/pvc.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: thelounge-data - namespace: &app thelounge - labels: - app.kubernetes.io/name: *app - app.kubernetes.io/instance: *app - snapshot.home.arpa/enabled: "true" -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 10Gi - storageClassName: block diff --git a/kube/deploy/apps/thelounge/app/volsync.yaml b/kube/deploy/apps/thelounge/app/volsync.yaml deleted file mode 100644 index d9f5a3d2..00000000 --- a/kube/deploy/apps/thelounge/app/volsync.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -apiVersion: v1 -kind: Secret -metadata: - name: thelounge-restic - namespace: thelounge -type: Opaque -stringData: - RESTIC_REPOSITORY: ${SECRET_VOLSYNC_R2_REPO}/thelounge - RESTIC_PASSWORD: ${SECRET_VOLSYNC_PASSWORD} - AWS_ACCESS_KEY_ID: ${SECRET_VOLSYNC_R2_ID} - AWS_SECRET_ACCESS_KEY: ${SECRET_VOLSYNC_R2_KEY} ---- -apiVersion: volsync.backube/v1alpha1 -kind: ReplicationSource -metadata: - name: thelounge-restic - namespace: thelounge -spec: - sourcePVC: thelounge-data - trigger: - schedule: "0 22 * * *" # 6am GMT+8 - restic: - copyMethod: Snapshot - pruneIntervalDays: 14 - repository: thelounge-restic - cacheCapacity: 2Gi - volumeSnapshotClassName: block - storageClassName: block - moverSecurityContext: - runAsUser: ${APP_UID_THELOUNGE} - runAsGroup: ${APP_UID_THELOUNGE} - fsGroup: ${APP_UID_THELOUNGE} - retain: - daily: 14 - within: 7d diff --git a/kube/deploy/apps/thelounge/ks.yaml b/kube/deploy/apps/thelounge/ks.yaml index 6c0e1a66..6c9dfa45 100644 --- a/kube/deploy/apps/thelounge/ks.yaml +++ b/kube/deploy/apps/thelounge/ks.yaml @@ -7,5 +7,25 @@ metadata: spec: path: ./kube/deploy/apps/thelounge/app dependsOn: - # - name: 1-core-storage-rook-ceph-cluster # TODO: re-add after fixing Rook ks.yaml, which needs Rook PVE ks.yaml name to be patched by master ks.yaml - - name: 1-core-ingress-nginx-app \ No newline at end of file + - name: thelounge-pvc +--- +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: thelounge-pvc + namespace: flux-system +spec: + path: ./kube/deploy/core/storage/volsync/template + targetNamespace: "thelounge" + dependsOn: + - name: 1-core-storage-volsync-app + - name: 1-core-storage-rook-ceph-cluster + postBuild: + substitute: + PVC: "thelounge-data" + SIZE: "10Gi" + SC: "file" + ACCESSMODE: "ReadWriteMany" + RUID: &uid "${APP_UID_THELOUNGE}" + RGID: *uid + RFSG: *uid diff --git a/kube/deploy/core/storage/volsync/template/rsrc.yaml b/kube/deploy/core/storage/volsync/template/rsrc.yaml index 472ca9ab..80326ab9 100644 --- a/kube/deploy/core/storage/volsync/template/rsrc.yaml +++ b/kube/deploy/core/storage/volsync/template/rsrc.yaml @@ -6,7 +6,7 @@ metadata: spec: sourcePVC: "${PVC}" trigger: - schedule: "0 */12 * * *" # 8am & 8pm GMT+8 + schedule: "${CRON:=0 */12 * * *}" # 8am & 8pm GMT+8 restic: copyMethod: "Snapshot" pruneIntervalDays: ${PRUNE:=14}