chadtmiller.com/knotless
git that lives in your Atmosphere account
1
10
Deploys cap buildkit's cache at 20 GB, which had no cap
deploy/deploy.sh+4−0
| @@ -148,6 +148,10 @@ EOF | ||
--build-arg "KNOTLESS_COMMIT=$COMMIT" --label "dev.knotless.run-commit=$run_commit" \ | ||
-t "$CANDIDATE" . | ||
say "built $CANDIDATE in $((SECONDS - began))s" | ||
# buildkit keeps every layer it ever built, with no cap of its own: it | ||
# held 49 GB when the disk filled (2026-10-31). Keep the 20 GB used | ||
# last, which hold the cargo cache mounts this build just read. | ||
$SSH "docker builder prune -f --max-used-space 20GB >/dev/null || true" | ||
} | ||
| ||
drop() { | ||
deploy/README.md+2−0
| @@ -75,6 +75,8 @@ cargo registry and `target/` are cache mounts on the host's builder, so | ||
a deploy rebuilds only our four crates, not their dependencies; a fresh | ||
checkout's files are all new to cargo, so all four, whichever changed. | ||
`docker buildx du --filter type=exec.cachemount` on the host shows them. | ||
Each build then prunes buildkit's cache to the 20 GB used last, which | ||
keeps those mounts; uncapped, it held 49 GB when the disk filled. | ||
| ||
By hand, `just deploy` does all three steps at once, as before. | ||
| ||
deploy/setup.sh+3−2
| @@ -18,7 +18,7 @@ | ||
# HTTP-01 once its records point here, and www redirected to it; | ||
# - a firewall letting in SSH, HTTP and HTTPS alone; | ||
# - unattended security upgrades, and a daily prune of images unused for | ||
# a week; | ||
# a week and of build cache past 20 GB; | ||
# - KNOTLESS_DATA (/mnt/data/knotless) and the runner's state | ||
# (/var/lib/knotless-run). | ||
# | ||
| @@ -120,11 +120,12 @@ echo "==> upgrades and pruning" | ||
dpkg-reconfigure -f noninteractive unattended-upgrades | ||
cat >/etc/systemd/system/knotless-prune.service <<'EOF' | ||
[Unit] | ||
Description=Removes images no container has used for a week | ||
Description=Removes images no container has used for a week, and build cache past 20 GB | ||
| ||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/bin/docker image prune -af --filter until=168h | ||
ExecStart=/usr/bin/docker builder prune -f --max-used-space 20GB | ||
EOF | ||
cat >/etc/systemd/system/knotless-prune.timer <<'EOF' | ||
[Unit] | ||