Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/holger

.nornir/replication-for-idiots.md

Repository replication — the beginner's guide

The problem, in one sentence

You have two package servers and you want the second one to hold copies of everything on the first — without copying the same file twice.

The kitchen analogy

Think of two pantries. The source pantry is full; the destination pantry is being stocked. Replication walks the full pantry shelf by shelf and, for each jar, checks: does the other pantry already have this exact jar?

You never take anything out of the full pantry — you only read its labels and copy jars into the empty one. And if you run the whole walk again, nothing happens: every jar is already there. That "nothing happens the second time" is what we mean by idempotent.

"By content id" — what makes it skip

Every artifact has a fingerprint: a sha256 hash of its bytes (its "content id"). Replication decides "already there?" by that fingerprint, not just the name. So if the destination already has the exact same bytes, it is skipped. If the bytes differ, it is recopied so the destination matches the source.

Try it on your laptop (no network)

You need two config files (two "stores"). Point them at two different folders. Then:

# 1. See what WOULD happen (writes nothing):
holger-server replicate --from source.ron --to dest.ron

# 2. Actually do it:
holger-server replicate --from source.ron --to dest.ron --execute

# 3. Do it AGAIN — notice it copies nothing this time:
holger-server replicate --from source.ron --to dest.ron --execute

The first execute prints copied N. The second prints copied 0, skipped N. That is replication working correctly: it never does the same work twice.

The safety rails

Where to go next