Choose what this site may use

This site uses strictly necessary cookies to work and to remember your privacy choices. With your permission it would also load content hosted by other services, such as videos, maps and fonts, which then receive your network address and device data. We do not sell or share your personal information and we run no advertising. Choose Accept all, Reject all or Customise. You can change your mind at any time through Privacy choices at the foot of every page.

  • Always on

    Needed for the site to work and to remember your privacy choices. Always on.

  • Remembers settings you choose, such as the light or dark display, in your browser.

  • Loads videos, maps and other content hosted by other services. Those services receive your address and device data.

Menu Close
In this section: Learn
Start
Guides
Domain packs
Participants
Security and privacy
Pilot kits
Operations
Ecosystem

Restore

Source docs/ops/restore.md

On this page
  1. What a backup is
  2. Restore into a Kubernetes volume
  3. Restore from a volume snapshot
  4. Partial last line
  5. Plain machines
  6. Restore drill

Every store of the deployment is an append-only JSON-lines file on its own volume: the gateway (one per replica), the registry, the log, the conformance runner’s report log and, in dev, the federation service. A store is restored from a backup object (S3-compatible storage, written by infra/deploy/scripts/backup.sh) or from a volume snapshot. The tests in tests/test_deploy.py run both scripts against a stand-in object store.

What a backup is

<bucket>/<environment>/<service>/<replica>/<UTC time>-<bytes>.jsonl: the store’s prefix up to its last complete line when the backup started, and next to it <same name>.manifest.json with the byte count, line count and SHA-256. The script reads the stored object back and compares digests before it counts the backup as done. Because the store is append-only, a newer backup contains every older one; older objects are deleted after RETAIN_DAYS.

Restore into a Kubernetes volume

  1. Pick the object: list <bucket>/<environment>/<service>/<replica>/ and take the newest *.manifest.json whose time is before the event you are recovering from.
  2. Stop writers: for the gateway, first remove the autoscaler (kubectl -n <ns> delete hpa obsp-gateway; it is re-applied from the rendered manifests in step 5), then kubectl -n <ns> scale statefulset/obsp-<service> --replicas=0.
  3. Start the restore job with the object name (the rendered job targets ordinal 0; for another replica, edit the claim name in the created Job before it runs):
kubectl -n <ns> create job --from=cronjob/obsp-<service>-restore restore-1 --dry-run=client -o yaml \
  | sed 's/REPLACE-WITH-OBJECT-NAME/<object name without .jsonl>/' | kubectl apply -f -
kubectl -n <ns> logs -f job/restore-1
  1. The job refuses, and changes nothing, when the object’s digest does not match its manifest, or when the store on the volume is not a prefix of the backup (restoring would drop records). In the second case decide: if the volume’s store is damaged, re-run with RESTORE_FORCE=yes; the replaced file stays next to the restored one as <file>.before-restore-<time> and is never deleted by the job.
  2. Scale back up; re-apply the HPA; watch readiness (the gateway replays the whole file on start).
  3. Records written after the backup are lost from this store. Node agents resend unanswered batches from their outbox; for answered ones, compare with the kept file and ask senders to replay.

Restore from a volume snapshot

Where snapshots.enabled: create a claim from the VolumeSnapshot (dataSource: {kind: VolumeSnapshot, name: ..., apiGroup: snapshot.storage.k8s.io}) named like the StatefulSet’s claim (store-obsp-&lt;service>-&lt;ordinal>) after deleting the damaged claim with the workload scaled to zero. A snapshot is crash-consistent: check the last line.

Partial last line

After a power loss the store can end in a partial line, and the gateway refuses to start (line N: ...). Backups never contain one. On the volume (from a debug pod with the volume mounted, workload scaled to zero): copy the file aside, then cut it after its last newline, for example head -c "$(( $(wc -c < f) - $(printf '%s' "$(tail -n 1 f)" | wc -c) ))" f > f.cut && mv f.cut f, and keep the copy. The cut line was never answered to its sender (a write is answered only after it is written).

Plain machines

systemctl stop obsp-<service>, then run /opt/obsp/infra/deploy/scripts/restore.sh as the obsp user with the variables of /etc/obsp/backup.env and /etc/obsp/backup-<service>.env plus RESTORE_OBJECT (and RESTORE_FORCE=yes when needed), then systemctl start obsp-<service>.

Restore drill

Monthly in staging, quarterly in production: restore the newest backup of each store into a scratch volume, start the service on it read-only, and compare its line count and SHA-256 with the manifest. Record the time it took; that is the recovery time the SLO discussion (OD-08) needs.