app/matrix: migrate postgres and data to waw3

The way this was migrated is not to be spoken of.

(hint: it involved downtime, and mounting two volumes at once)

appservice-irc has some storage, we should migrate that to waw3, too. But
it's not as critical.

The new storage (waw3) is _much_ faster.

Change-Id: I4b4bd32e4fedc514753d25bac35d001e8a9c5f00
diff --git a/app/matrix/homeserver.yaml b/app/matrix/homeserver.yaml
index 1553053..0f23064 100644
--- a/app/matrix/homeserver.yaml
+++ b/app/matrix/homeserver.yaml
@@ -31,7 +31,7 @@
     user: "synapse"

     password: "{{ POSTGRES_PASSWORD }}"

     database: "synapse"

-    host: "postgres"

+    host: "waw3-postgres"

     port: "5432"

     cp_min: 5

     cp_max: 10

diff --git a/app/matrix/prod.jsonnet b/app/matrix/prod.jsonnet
index f2f29cb..732b76c 100644
--- a/app/matrix/prod.jsonnet
+++ b/app/matrix/prod.jsonnet
@@ -15,6 +15,7 @@
         domain: "matrix.hackerspace.pl",
         serverName: "hackerspace.pl",
         storageClassName: "waw-hdd-paranoid-2",
+        storageClassName3: "waw-hdd-redundant-3",
 
         synapseImage: "matrixdotorg/synapse:v1.17.0",
         riotImage: "vectorim/riot-web:v1.7.1",
@@ -33,21 +34,23 @@
 
     namespace: kube.Namespace(cfg.namespace),
 
-    postgres: postgres {
+    postgres3: postgres {
         cfg+: {
             namespace: cfg.namespace,
             appName: "synapse",
             database: "synapse",
             username: "synapse",
+            prefix: "waw3-",
             password: { secretKeyRef: { name: "synapse", key: "postgres_password" } },
-            storageClassName: cfg.storageClassName,
+            storageClassName: cfg.storageClassName3,
+            storageSize: "100Gi",
         },
     },
 
-    dataVolume: kube.PersistentVolumeClaim("synapse-data") {
+    dataVolume: kube.PersistentVolumeClaim("synapse-data-waw3") {
         metadata+: app.metadata("synapse-data"),
         spec+: {
-            storageClassName: cfg.storageClassName,
+            storageClassName: cfg.storageClassName3,
             accessModes: [ "ReadWriteOnce" ],
             resources: {
                 requests: {
diff --git a/kube/postgres.libsonnet b/kube/postgres.libsonnet
index 8208662..e89e9db 100644
--- a/kube/postgres.libsonnet
+++ b/kube/postgres.libsonnet
@@ -16,6 +16,8 @@
         username: error "username must be set",
         # not literal, instead ref for env (like { secretKeyRef: ... })
         password: error "password must be set",
+
+        storageSize: "30Gi",
     },
 
     makeName(suffix):: cfg.prefix + suffix,
@@ -36,7 +38,7 @@
             accessModes: [ "ReadWriteOnce" ],
             resources: {
                 requests: {
-                    storage: "30Gi",
+                    storage: cfg.storageSize,
                 },
             },
         },
@@ -74,6 +76,7 @@
             },
         },
     },
+
     svc: kube.Service(postgres.makeName("postgres")) {
         metadata+: postgres.metadata,
         target_pod:: postgres.deployment.spec.template,