From 45394bf3b0468dcc2f7101ff5ea061ed02e0e5da Mon Sep 17 00:00:00 2001 From: Bartosz Stebel Date: Wed, 1 Mar 2023 21:17:25 +0100 Subject: [PATCH] app/matrix: enable wal=logical for postgres, add tmp mount This is quite hacky, but we intend to remove that postgres soon anyway. The changes to synapse's resource limits are to reflect current state of prod. Change-Id: Ic7beaa3e7ee378c0e10ba24f9a5a3aee67c2ccf2 Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1468 Reviewed-by: q3k --- app/matrix/lib/matrix-ng.libsonnet | 1 + app/matrix/matrix.hackerspace.pl.jsonnet | 43 ++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/app/matrix/lib/matrix-ng.libsonnet b/app/matrix/lib/matrix-ng.libsonnet index ac895bc1..91c92d2f 100644 --- a/app/matrix/lib/matrix-ng.libsonnet +++ b/app/matrix/lib/matrix-ng.libsonnet @@ -242,6 +242,7 @@ local coturn = import "./coturn.libsonnet"; opts: { max_connections: "300", shared_buffers: "80MB", + wal_level: "logical", }, }, }, diff --git a/app/matrix/matrix.hackerspace.pl.jsonnet b/app/matrix/matrix.hackerspace.pl.jsonnet index 4199e0e4..931901a6 100644 --- a/app/matrix/matrix.hackerspace.pl.jsonnet +++ b/app/matrix/matrix.hackerspace.pl.jsonnet @@ -1,6 +1,7 @@ local matrix = import "lib/matrix-ng.libsonnet"; local irc = import "lib/appservice-irc.libsonnet"; local telegram = import "lib/appservice-telegram.libsonnet"; +local kube = import "../../kube/kube.libsonnet"; matrix { local app = self, @@ -77,12 +78,24 @@ matrix { }, }, }, + // local changes + main+: { + deployment+: { + cfg+: { + resources+: { + limits+: { cpu: "2", memory: "8Gi" }, + requests+: { cpu: "2", memory: "8Gi" }, + }, + }, + }, + }, }, // Bump up storage to 200Gi from default 100Gi, use different name. The // new name corresponds to a manually migrated and sized-up PVC that // contains data from the original waw3-postgres PVC. postgres3+: { + local psql = self, volumeClaim+: { metadata+: { name: "waw3-postgres-2", @@ -95,6 +108,36 @@ matrix { }, }, }, + tempVC: kube.PersistentVolumeClaim(psql.makeName("tempvc")) { + metadata+: psql.metadata, + spec+: { + storageClassName: psql.cfg.storageClassName, + accessModes: [ "ReadWriteOnce" ], + resources: { + requests: { + storage: "200Gi", + }, + }, + }, + }, + deployment+: { + spec+: { + template+: { + spec+: { + volumes_+: { + temp: kube.PersistentVolumeClaimVolume(psql.tempVC), + }, + containers_+: { + postgres+: { + volumeMounts_+: { + temp: { mountPath: "/mnt/tmp/" }, + }, + }, + }, + }, + }, + }, + }, }, appservices: {