99% Full: When a Kamal Deploy Dies on Disk Space

A routine deploy failed for a boring reason: the shared server's disk was full. What filled it, what we pruned, and the trade-off you accept when you delete old images.

The deploy that shipped our new game pages failed. The tests were green, the build was green, and then the Kamal step fell over on the server.

The cause was as unglamorous as they come: the disk was 99% full, with about 410 MB free. The new image couldn't be extracted.

Why the disk filled up

This droplet runs six apps, including loadout.ca and TourChamp, all deployed with Kamal from GitHub Actions. Every deploy pulls a new image. Kamal keeps a few previous containers and images around on purpose, so you can roll back quickly when a release goes wrong.

Six apps deploying several times a day, each keeping its history, adds up. Nobody was watching the number, so it crept to the ceiling.

Finding it

gh run view <id> --log-failed, filtered for "space", "disk" and "error", got to the cause in a couple of minutes. After that, on the server:

df -h /
docker system df
docker ps --format "{{.Names}}  {{.Image}}  {{.Status}}"
docker images --format "{{.Repository}}:{{.Tag}}    {{.Size}}   {{.CreatedSince}}"

docker system df is the one to remember. It tells you how much of the disk is images, containers, volumes and build cache, and how much of each is reclaimable.

What we removed, and the trade-off

There were three stopped containers and three images that no running container used: two older loadout.ca builds and one older TourChamp build.

docker container prune -f
docker image prune -a -f

That freed about 3.6 GB, and the deploy went through on the re-run.

Neither command touches running containers or volumes, so the apps never blinked. But it isn't free: those old images were the rollback. Until each app deploys again a couple of times, "roll back to the previous release" means rebuilding it. That's why it was a decision, made on purpose, not something a script does quietly at 3 a.m.

What changes

  • Disk usage on shared hosts is now something we check, not something we discover.
  • Retention per app should match how much rollback history each app actually needs. A marketing site doesn't need the same safety net as a production tour app.
  • More apps per server is where we're heading anyway (it's half of a cost project we're running), so headroom has to be planned, not hoped for.

Previously in Kamal stories: How Two Spaces Almost Sank an Aircraft Carrier.