From e58c5b8cc10ede3db1f16013215bff7da28eb483 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Thu, 2 Apr 2026 21:05:12 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20address=20PR=20review=20=E2=80=94=20move?= =?UTF-8?q?=20memory=20limits=20to=20deploy=20block,=20handle=20swap-less?= =?UTF-8?q?=20hosts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move mem_limit/memswap_limit to deploy.resources.limits.memory so the constraint is actually enforced under Compose v3. Add END clause to swap_mb() so hosts without a Swap line report 0 instead of empty output. Fix test script header comment accuracy. Co-Authored-By: Claude Opus 4.6 (1M context) --- monitoring/scripts/homelab-audit.sh | 2 +- monitoring/scripts/test-audit-collectors.sh | 5 ++--- .../ubuntu-manticore/docker-compose/tdarr/docker-compose.yml | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/monitoring/scripts/homelab-audit.sh b/monitoring/scripts/homelab-audit.sh index 00c39fd..3e25aa3 100755 --- a/monitoring/scripts/homelab-audit.sh +++ b/monitoring/scripts/homelab-audit.sh @@ -90,7 +90,7 @@ zombie_parents() { } swap_mb() { - free | awk '\''/^Swap:/ {printf "%.0f", $3/1024}'\'' + free | awk '\''/^Swap:/ {printf "%.0f", $3/1024; found=1} END {if (!found) print "0"}'\'' } oom_events() { diff --git a/monitoring/scripts/test-audit-collectors.sh b/monitoring/scripts/test-audit-collectors.sh index 95d7e85..149aa98 100644 --- a/monitoring/scripts/test-audit-collectors.sh +++ b/monitoring/scripts/test-audit-collectors.sh @@ -1,9 +1,8 @@ #!/usr/bin/env bash # test-audit-collectors.sh — validates homelab-audit.sh collector output format # -# Extracts each collector function from the audit script's COLLECTOR_SCRIPT -# heredoc and runs it locally, checking that output matches the expected -# key=value format. Exits non-zero on first failure. +# Re-implements each collector function inline and runs it locally, checking +# that output matches the expected format. Exits non-zero on any failure. set -euo pipefail diff --git a/server-configs/ubuntu-manticore/docker-compose/tdarr/docker-compose.yml b/server-configs/ubuntu-manticore/docker-compose/tdarr/docker-compose.yml index 9f51d38..73e8c70 100644 --- a/server-configs/ubuntu-manticore/docker-compose/tdarr/docker-compose.yml +++ b/server-configs/ubuntu-manticore/docker-compose/tdarr/docker-compose.yml @@ -26,8 +26,6 @@ services: container_name: tdarr-node init: true restart: unless-stopped - mem_limit: 28g - memswap_limit: 30g environment: - PUID=1000 - PGID=1000 @@ -41,6 +39,8 @@ services: - /mnt/NV2/tdarr-cache:/temp deploy: resources: + limits: + memory: 28g reservations: devices: - driver: nvidia