From 2be11cec39f5901b0dbea039a5ea5c3218dd1628 Mon Sep 17 00:00:00 2001 From: GigiaJ Date: Sun, 30 Nov 2025 05:19:05 -0600 Subject: [PATCH] Begin defining our homeserver --- .../services/matrix/home_server/service.cljs | 54 ++++++++++++++++--- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/src/main/k8s/services/matrix/home_server/service.cljs b/src/main/k8s/services/matrix/home_server/service.cljs index 7c7dde0..0986a31 100644 --- a/src/main/k8s/services/matrix/home_server/service.cljs +++ b/src/main/k8s/services/matrix/home_server/service.cljs @@ -1,10 +1,48 @@ -;; homeserver: -;; volumes: -;; - db:/var/lib/conduwuit - - (def config - {:stack [:vault-secrets :docker-image :deployment :service :ingress] - :image-port 80 +(ns k8s.services.matrix.home-server.service) + +(def config + {:stack [:vault:prepare [:k8s :pvc :deployment :service :httproute]] + :image-port 6167 :app-namespace "matrix" :app-name "tuwunel" - :deployment-opts {:spec {:template {:spec {:containers [{:name 'app-name :image '(str repo "/" 'app-name ":latest")}]}}}}}) \ No newline at end of file + + :k8s:pvc-opts + {"conduwuit-db" {:storageClass "hcloud-volumes" + :accessModes ["ReadWriteOnce"] + :storage "20Gi"}} + + :k8s:deployment-opts + {:spec + {:template + {:spec + {:containers + [{:name 'app-name + :image '(str repo "/tuwunel:latest") + :envFrom [{:secretRef {:name '(str app-name "-secrets")}}] + :volumeMounts [{:name "db" :mountPath "/var/lib/conduwuit"} + #_{:name "discord-reg" + :mountPath "/etc/conduwuit/discord-registration.yaml" + :subPath "registration.yaml"}]}] + + :volumes + [{:name "db" :persistentVolumeClaim {:claimName "conduwuit-db"}} + #_{:name "discord-reg" :configMap {:name "discord-bridge-config"}} + ]}}}} + + :k8s:service-opts + {:spec {:ports [{:name 'app-name :port 'port :targetPort 'port}]}} + + :k8s:httproute-opts + {:spec + {:hostnames ['homeserver] + :rules [{:matches [{:path {:type "PathPrefix" :value "/_matrix/media"}}] + :backendRefs [{:name "mmr" :port 8000}]} + + {:matches [{:path {:type "PathPrefix" :value "/_matrix/client/v1/media"}}] + :backendRefs [{:name "mmr" :port 8000}]} + + {:matches [{:path {:type "PathPrefix" :value "/.well-known/matrix"}}] + :backendRefs [{:name "matrix-well-known" :port 80}]} + + {:matches [{:path {:type "PathPrefix" :value "/"}}] + :backendRefs [{:name 'app-name :port 'port}]}]}}}) \ No newline at end of file