From cab7764e90e9832a700e9acb85031c48251b53ba Mon Sep 17 00:00:00 2001 From: Magic_RB Date: Sun, 14 May 2023 16:27:29 +0200 Subject: [PATCH] Perform Matrix restructure Signed-off-by: Magic_RB --- .../homelab-1/job/matrix-heisenbridge.hcl | 64 +++++++ .../homelab-1/job/matrix-mautrix-facebook.hcl | 106 ++++++++++ .../homelab-1/job/matrix-mautrix-signal.hcl | 113 +++++++++++ .../job/{conduit.hcl => matrix-synapse.hcl} | 181 ++++-------------- .../homelab-1/{conduit.tf => matrix.tf} | 99 +++++++++- 5 files changed, 412 insertions(+), 151 deletions(-) create mode 100644 nomad/regions/homelab-1/job/matrix-heisenbridge.hcl create mode 100644 nomad/regions/homelab-1/job/matrix-mautrix-facebook.hcl create mode 100644 nomad/regions/homelab-1/job/matrix-mautrix-signal.hcl rename nomad/regions/homelab-1/job/{conduit.hcl => matrix-synapse.hcl} (84%) rename nomad/regions/homelab-1/{conduit.tf => matrix.tf} (60%) diff --git a/nomad/regions/homelab-1/job/matrix-heisenbridge.hcl b/nomad/regions/homelab-1/job/matrix-heisenbridge.hcl new file mode 100644 index 0000000..a092228 --- /dev/null +++ b/nomad/regions/homelab-1/job/matrix-heisenbridge.hcl @@ -0,0 +1,64 @@ +variable "flake_ref" { + type = string +} + +variable "flake_sha" { + type = string +} + +job "matrix-heisenbridge" { + datacenters = [ "homelab-1" ] + type = "service" + + group "heisenbridge" { + count = 1 + + volume "matrix-registrations" { + type = "csi" + source = "matrix-registrations" + read_only = false + + attachment_mode = "file-system" + access_mode = "multi-node-multi-writer" + } + + restart { + attempts = 5 + delay = "5s" + } + + network { + mode = "bridge" + } + + service { + name = "matrix-heisenbridge" + port = "9898" + + connect { + sidecar_service {} + } + } + + task "heisenbridge" { + driver = "docker" + + volume_mount { + volume = "matrix-registrations" + destination = "/var/lib/registrations" + read_only = false + } + + config { + nix_flake_ref = "${var.flake_ref}#nixngSystems.heisenbridge.config.system.build.toplevel" + nix_flake_sha = var.flake_sha + entrypoint = [ "init" ] + } + + resources { + cpu = 128 + memory = 128 + } + } + } +} diff --git a/nomad/regions/homelab-1/job/matrix-mautrix-facebook.hcl b/nomad/regions/homelab-1/job/matrix-mautrix-facebook.hcl new file mode 100644 index 0000000..1a8a500 --- /dev/null +++ b/nomad/regions/homelab-1/job/matrix-mautrix-facebook.hcl @@ -0,0 +1,106 @@ +variable "flake_ref" { + type = string +} + +variable "flake_sha" { + type = string +} + +job "matrix-mautrix-facebook" { + datacenters = [ "homelab-1" ] + type = "service" + + group "mautrix-facebook" { + count = 1 + + volume "matrix-mautrix-facebook" { + type = "csi" + source = "matrix-mautrix-facebook" + read_only = false + + attachment_mode = "file-system" + access_mode = "single-node-writer" + } + + volume "matrix-registrations" { + type = "csi" + source = "matrix-registrations" + read_only = false + + attachment_mode = "file-system" + access_mode = "multi-node-multi-writer" + } + + restart { + attempts = 5 + delay = "5s" + } + + network { + mode = "bridge" + } + + service { + name = "matrix-mautrix-facebook" + port = "29319" + + # check { + # type = "http" + # address_mode = "alloc" + # path = "/public" + # port = "29319" + # interval = "2s" + # timeout = "2s" + # } + + connect { + sidecar_service {} + } + } + + task "mautrix-facebook" { + driver = "docker" + + volume_mount { + volume = "matrix-mautrix-facebook" + destination = "/var/lib/mautrix-facebook" + read_only = false + } + + volume_mount { + volume = "matrix-registrations" + destination = "/var/lib/registrations" + read_only = false + } + + config { + nix_flake_ref = "${var.flake_ref}#nixngSystems.mautrix-facebook.config.system.build.toplevel" + nix_flake_sha = var.flake_sha + entrypoint = [ "init" ] + } + + vault { + policies = ["matrix-mautrix-facebook-policy"] + } + + template { + data = <