Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -501,14 +501,25 @@ port-state: ## Collect whether each container holds the ports and networks it wa
$(PYTHON) scripts/collect-port-state.py

.PHONY: prune-images
prune-images: ## Remove Docker images no container uses (weekly on the monitoring host)
prune-images: ## Remove Docker images and anonymous volumes no container uses (weekly on the monitoring host)
@# The unit says why: nothing else removes superseded digests, and they
@# filled `/` once (#136's cutover found it, 2026-09-29). Only images no
@# container references, running or stopped. The before and after are
@# printed so the journal records what each run reclaimed.
@docker system df --format '{{.Type}}: {{.Size}} ({{.Reclaimable}} reclaimable)' | grep '^Images'
@#
@# Then anonymous volumes no container references. Validation and scratch
@# runs leave them behind: the 2026-11-13 audit found 69, and 99 by
@# 2026-11-23. The filter selects only volumes carrying
@# `com.docker.volume.anonymous`, so a named volume is never removed and a
@# stack that is down keeps its data. The filter is explicit on purpose:
@# prune's own default of anonymous-only depends on the request's API
@# version, and a request below 1.42 (an old client, or
@# DOCKER_API_VERSION) prunes named volumes too. Proved on prometheus: an
@# API 1.41 request with this filter kept a dangling named volume.
@docker system df --format '{{.Type}}: {{.Size}} ({{.Reclaimable}} reclaimable)' | grep -E '^(Images|Local Volumes)'
docker image prune -a -f
@docker system df --format '{{.Type}}: {{.Size}} ({{.Reclaimable}} reclaimable)' | grep '^Images'
docker volume prune -f --filter label=com.docker.volume.anonymous
@docker system df --format '{{.Type}}: {{.Size}} ({{.Reclaimable}} reclaimable)' | grep -E '^(Images|Local Volumes)'

.PHONY: pkg-state
pkg-state: ## Collect package state from morpheus over SSH (FreeBSD, runs as robo)
Expand Down
19 changes: 19 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,30 @@ docstring gives: it is a record, not a claim about now.

## 2026-11-23

- **The monitoring host's weekly prune also removes anonymous volumes that
no container uses.** The 2026-11-13 audit of `prometheus` found 69 of them,
and there were 99 by today, left behind by validation and scratch runs.
They were pruned by hand today (121.5 MB reclaimed), and the three
`prometheus_` volumes from the 2025 compose project were removed with them.
`make prune-images` now runs `docker volume prune` after the image prune,
filtered to volumes labelled `com.docker.volume.anonymous`, so a named
volume survives even while its stack is down. The filter is explicit
because prune's own anonymous-only default depends on the request's API
version, and a request below 1.42 takes named volumes too. A probe on the
host proved it both ways, including with `DOCKER_API_VERSION=1.41`: a
dangling anonymous volume went, and a dangling named one stayed. The
agent hosts' copy is unchanged. The unit's
description changed, so the next `sudo make install-timers` on
`prometheus` is what brings the installed unit back in line.

- **The rack's temperature has fixed limits.** The probe's first reading, at
15:26 UTC after the deploy, was 22 °C: the card reports whole degrees in
`uioSensorStatusTemperatureDegC`, not the tenths PowerNet-MIB describes. That
settles what the probe entry below this one left open, and
`RackAmbientTemperatureHigh` (warning, over 30 °C for fifteen minutes) and
`RackAmbientTemperatureCritical` (critical, over 35 °C for ten) are added.
35 °C is the top of ASHRAE class A2, the DL360's rated inlet limit.

- **`neo`'s log leaves the switch
([ADR-0127](adr/0127-relay-neos-log-through-morpheus.md), accepted).**
The core switch kept its log in RAM, 1,000 lines deep. It now sends
Expand All @@ -49,6 +66,7 @@ docstring gives: it is a record, not a claim about now.
about one every seven seconds by the afternoon: 987 of the 1,000 lines in
the buffer. Nothing saw it, because nothing read the switch's log. Not
fixed here.

- **The agent's log pipeline is its own file, so the range host can ship
metrics and no logs ([#1651](https://github.com/Gerrrt/HomeLab/issues/1651),
[ADR-0126](adr/0126-monitor-gandalf-now-that-it-stays-on.md)).** `config.alloy`
Expand All @@ -64,6 +82,7 @@ docstring gives: it is a record, not a claim about now.
checked with `alloy validate` on the whole directory and on `config.alloy`
alone (the metrics-only case), both clean, so every cross-file reference
resolves and the metrics-only config has no dangling one.

- **`prometheus` will take SSH keys only, and stays without a host firewall
([ADR-0128](adr/0128-give-prometheus-a-key-only-sshd-and-no-host-firewall.md)).**
The root-only reads that finished the 2026-11-13 audit were taken today.
Expand Down
6 changes: 4 additions & 2 deletions docs/runbooks/schedule-maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ disabling the first proves the second, which is
so they install on the hypervisor and nowhere else.

**`prune-images` is the agent hosts' copy of the `prune-images` row above.** It
runs `docker image prune -a` on Mondays at 04:00, as the monitoring host's does,
runs `docker image prune -a` on Mondays at 04:00, as the monitoring host's does.
Unlike the monitoring host's, it leaves anonymous volumes alone. Those come from
`make validate` and scratch runs, which happen on the monitoring host. It runs
from `systemd/agent/homelab-prune-images.timer`. Nothing removed superseded
images on an agent host before it, and on 2026-10-01 `odin`'s 30 GB root was at
98%, 7.8 GB of it images no container used. It requires `/usr/bin/docker`, so
Expand Down Expand Up @@ -943,7 +945,7 @@ expected rather than a second fault.
| `smart-state-remote` exits 1 | `morpheus` could not be read over SSH | The warning line carries ssh's own message — `Permission denied (publickey)` means the key or the user is wrong, `No route to host` means the firewall is unreachable. This job runs as `robo` and uses the same key as `backup-firewall`, so if that job is also failing the cause is shared |
| `pkg-state` exits 1 | `morpheus` could not be read, or its catalogue fetch failed | The message carries ssh's or pkg's own words. A catalogue fetch needs the firewall to reach its update servers, so a WAN outage looks exactly like this and is not a fault in the collector — check `BlackboxProbeFailed` for the gateway before investigating. It runs as `robo` with the same key as `backup-firewall`, so if that is failing too the cause is shared |
| `silence-state` exits 1 | Alertmanager could not be read on loopback, or answered something that is not a silence list | The previous `alertmanager-silences.prom` is left in place, so the last known silences stay served and a silence deleted during the outage looks alive until the next successful run — by design, because an empty file would read as "no silences". `docker ps` for the container, then `make silence-state` by hand |
| `prune-images` exits non-zero | `docker image prune` failed, or the `backups` lock was held for the whole 900s wait | The journal line says which. A lock timeout means a backup or converge ran long, and the next week's run catches up. Anything else, run `make prune-images` by hand and read Docker's error. Until it runs, unused images accumulate at a few gigabytes a week, and `HostDiskWillFillIn24h` and `HostDiskCritical` are the backstop |
| `prune-images` exits non-zero | `docker image prune` or `docker volume prune` failed, or the `backups` lock was held for the whole 900s wait | The journal line says which. A lock timeout means a backup or converge ran long, and the next week's run catches up. Anything else, run `make prune-images` by hand and read Docker's error. Until it runs, unused images accumulate at a few gigabytes a week, and `HostDiskWillFillIn24h` and `HostDiskCritical` are the backstop |
| `check-versions` exits 1 | A document names an OS version the host is not running | Not an outage — nothing is broken. Read the FAIL lines: each names the document, the cell and what the host reports. Correct the document; the box is the source of truth. A `SKIP` for `morpheus` instead means `sysDescr` is not reaching Prometheus, which is a collection fault rather than a clean bill of health |
| `docker info` fails only under systemd | The unit is missing `SupplementaryGroups=docker` | A login shell picks the group up from `/etc/group` and a unit does not, which is why this never reproduces by hand |
| Timers exist but never fire | `WantedBy=timers.target` missing, or the timers were never enabled | `systemctl list-timers 'homelab-*'` shows nothing; re-run `make install-timers` |
Expand Down
3 changes: 2 additions & 1 deletion docs/runbooks/triage-a-critical-alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ A filesystem has less than 10% free.

- **Find what is growing:** `du -xh --max-depth=1 <mountpoint> | sort -h`
on the host. On a Docker host, `docker system df` first: superseded images
are the usual cause.
are the usual cause, and on the monitoring host, anonymous volumes left by
validation runs are the next.
- **The monitoring host:** Prometheus's retention is capped by size
(`PROMETHEUS_RETENTION_SIZE`), so it should not be Prometheus. Loki's
chunks and the backup staging directory are the usual suspects.
Expand Down
8 changes: 7 additions & 1 deletion systemd/homelab-prune-images.service
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,18 @@
# what was pulled this week". An image removed here that `make validate` wants
# again is re-pulled only on a proof-cache miss, which a new digest is anyway.
#
# Since 2026-11-23 it also removes anonymous volumes no container references
# (`docker volume prune` filtered to `com.docker.volume.anonymous`).
# Validation and scratch runs leave them behind: 99 had built up by then.
# Named volumes, which hold every stack's data, are never touched, even
# while a stack is down. The Makefile target says why the filter is explicit.
#
# Under the `backups` lock that converge and the backups share, so a prune can
# never land between a converge's pull and its `compose up`.
#
# See homelab-backup-volumes.service for why each directive below is set.
[Unit]
Description=HomeLab: remove Docker images no container uses
Description=HomeLab: remove Docker images and anonymous volumes no container uses
Documentation=file:///home/robo/code/Gerrrt/HomeLab/docs/runbooks/schedule-maintenance.md
After=docker.service

Expand Down