Infrastructure worth keeping — and kept patched.

Upgrade a self-hosted build cache and keep its data

Can you move a build cache to a newer release without losing what it holds? I tested it with the only two published releases: I stored entries on 0.1.0, started 0.2.1 on the same data volume, wrote more, and then went back to 0.1.0. This is what happened.

What was tested, and what was not

The upgrade

docker pull ghcr.io/fosterstack/cache:0.2.1
docker stop fscache && docker rm fscache
docker run -d --name fscache -p 127.0.0.1:8080:8080 \
  -v fscache-data:/home/nonroot \
  ghcr.io/fosterstack/cache:0.2.1

Use the same volume and the same settings (environment variables for the password and size cap) as the old container. Pin the exact tag you want, as above, rather than latest.

What I saw

StepResult
0.1.0: store three entries on a fresh volume201 each; its metrics show 3 entries, 29 bytes
Stop 0.1.0, start 0.2.1 on the same volumestarts normally; the status page shows "version": "v0.2.1", 3 entries, 29 bytes; all three values read back
0.2.1: store two more201 each; 5 entries
Stop 0.2.1, start 0.1.0 on the same volume againstarts normally; all values read back, including the two written by 0.2.1

So in my test an upgrade lost nothing, and a rollback to the old release could still read what the new one had written.

Two differences between the releases

If you want a safety net

A build cache can always be rebuilt, so losing one costs time, not work. If refilling would hurt, take a copy first: back up and restore a build cache. To start clean instead: clear or reset a build cache.

Related: how releases are built and signed and verify a release yourself, so you can check the new version before you run it.

Changelog FosterStack home