From dce4fa60222b9cfcd575d3316820ed7b544e6e2d Mon Sep 17 00:00:00 2001 From: jv Date: Wed, 16 Sep 2026 11:37:35 -0500 Subject: [PATCH] Edge matrix vhost, node-exporter scrape, arr/rpi refinements - bootstrap/edge: add matrix-vhost template + matrix.conf mount (isolated cert path), config_hash includes matrix.conf so tofu regenerates edge config when it changes; add node-exporter sidecar - bootstrap/platform: prometheus additionalScrapeConfigs for rpi-node and oci-edge-node targets, plus node-exporter edge port 9100 - apps/homelab-alerts: host filesystem >85% alert - infra/arr-stack + rpi-services: compose refinements - .gitignore: ignore tofu tfstate backups (*.tfstate.*.backup) --- .gitignore | 4 + apps/homelab-alerts/prometheus-rules.yaml | 8 ++ bootstrap/edge/main.tf | 16 ++++ .../edge/templates/docker-compose.yml.tftpl | 16 ++++ .../edge/templates/matrix-vhost.conf.tftpl | 76 +++++++++++++++++++ bootstrap/edge/variables.tf | 43 +++++++++++ bootstrap/platform/main.tf | 40 ++++++++++ infra/arr-stack/.env.example | 2 + infra/arr-stack/docker-compose.yml | 20 +++++ infra/rpi-services/docker-compose.yml | 18 +++++ 10 files changed, 243 insertions(+) create mode 100644 bootstrap/edge/templates/matrix-vhost.conf.tftpl diff --git a/.gitignore b/.gitignore index c359ca9..5fc0b03 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,7 @@ sops-age.key # Ignore local Python bytecode from validation helpers __pycache__/ *.py[cod] + +# Tofu state backups +*.tfstate.*.backup +*.tfstate.bak* diff --git a/apps/homelab-alerts/prometheus-rules.yaml b/apps/homelab-alerts/prometheus-rules.yaml index 807ab14..b114433 100644 --- a/apps/homelab-alerts/prometheus-rules.yaml +++ b/apps/homelab-alerts/prometheus-rules.yaml @@ -52,6 +52,14 @@ spec: annotations: summary: "PVC {{ $labels.namespace }}/{{ $labels.persistentvolumeclaim }} is over 85% full" description: "PVC capacity is near exhaustion. Review app storage before it becomes an outage." + - alert: HomelabHostFilesystemNearlyFull + expr: 100 * (1 - node_filesystem_avail_bytes{fstype!~"tmpfs|overlay|squashfs",mountpoint=~"/|/data|/var/lib/docker"} / node_filesystem_size_bytes{fstype!~"tmpfs|overlay|squashfs",mountpoint=~"/|/data|/var/lib/docker"}) > 85 + for: 15m + labels: + severity: warning + annotations: + summary: "Host filesystem {{ $labels.mountpoint }} on {{ $labels.instance }} is over 85% full" + description: "The {{ $labels.mountpoint }} mount on {{ $labels.instance }} is near exhaustion. Review disk usage before it becomes an outage." - name: homelab.edge rules: - alert: HomelabTraefik5xxSpike diff --git a/bootstrap/edge/main.tf b/bootstrap/edge/main.tf index ca49e3d..7e91dab 100644 --- a/bootstrap/edge/main.tf +++ b/bootstrap/edge/main.tf @@ -39,12 +39,22 @@ locals { backend_host = var.backend_host backend_port = tostring(var.backend_port) }) + default_conf_matrix = var.matrix_enabled ? templatefile("${path.module}/templates/matrix-vhost.conf.tftpl", { + matrix_server_name = var.matrix_server_name + matrix_backend_host = var.matrix_backend_host + matrix_backend_port = tostring(var.matrix_backend_port) + matrix_cert_dir = var.matrix_cert_dir + element_server_name = var.element_server_name + element_backend_host = var.element_backend_host + element_backend_port = tostring(var.element_backend_port) + }) : "" config_hash = sha256(join("\n---\n", [ local.compose_file, local.default_conf, local.default_vcl, local.haproxy_cfg, local.squid_conf, + local.default_conf_matrix, ])) } @@ -109,6 +119,11 @@ resource "null_resource" "edge_services" { destination = "/tmp/homelab-edge/config_files/squid.conf" } + provisioner "file" { + content = local.default_conf_matrix + destination = "/tmp/homelab-edge/config_files/matrix.conf" + } + provisioner "remote-exec" { inline = [ <