Skip to content

Restore

Kronik Maintainers edited this page Nov 26, 2026 · 1 revision

Restore

Goal: recover a separately backed-up installation without overwriting live state, substituting keys, or claiming the unshipped tail was recovered.

Preconditions

Use a fresh owned recovery directory and the correct recorded engine or an explicitly checked candidate engine. Have the original file/environment master key, or the matching KMS configuration and provider authority, available from the separate recovery channel. Never generate a replacement seed over an existing encrypted store.

Procedure

  1. Keep the source and failed installation intact for investigation. Select the actual bucket/prefix and shipped recovery point, not a guessed LSN.

  2. Review a dry run, then restore into the empty recovery directory:

    kronik restore --from s3://example-backups/installation \
      --config /owned/recovery/kronik.toml --data-dir /owned/recovery/data --dry-run
    kronik restore --from s3://example-backups/installation \
      --config /owned/recovery/kronik.toml --data-dir /owned/recovery/data

    The paths and bucket are examples to replace. Supply file/env key material through its documented separate key source, never argv or this runbook. KMS restore installs and validates the shipped ciphertext envelope before publishing encrypted stores. Do not use --force against live data. Run as root against the directory of the nonroot service (owned by the kronik user), the command reads the key and the remote's credentials as root, gives up root, and finishes as kronik: a file:// source must be readable by that user, and the command says so before it writes anything. --dry-run as root cannot tell.

    A Skipped line (snapshots_skipped in the JSON) means the bucket's newest snapshot is ahead of the segments it holds: restore installed the log's last covered snapshot, and the recovery point is Log last LSN (log_last_lsn), not the skipped snapshot. Record the skipped LSNs and the gap; do not treat the unshipped records as recovered.

    A failure naming a snapshot's manifest (the manifest of snapshot <L>) means the bucket lists an object it cannot serve intact: a failed GET, or bytes that no longer parse. Restore refused rather than silently install the older snapshot. Investigate the bucket and copy the object aside; then repair it, or delete that manifest object — the state retention leaves — to restore explicitly from the older snapshot.

  3. Refuse MASTER_KEY_MISSING, MASTER_KEY_MISMATCH, KEY_SOURCE_UNAVAILABLE or KEYSTORE_INCOMPLETE until the actual source/key problem is resolved. --allow-missing-keys and --without-keystore explicitly accept unreadable or discarded subject keys; they are data-loss decisions, not routine fixes.

  4. If the candidate engine differs, follow the upgrade runbook before starting it. Start only this owned recovered instance using its own config, gateway port and API socket:

    kronik serve --config /owned/recovery/kronik.toml

    The first start of a restored directory may install the newest snapshot that the log continues (the restore registered it) and replay the log from there, because an actor database that came with the snapshot can be older than the log the bucket kept; the daemon logs installed a snapshot as the branch's state, and kronik upgrade check on the restored directory notes it before the start.

  5. Compare kronik --json integrity --through <source-LSN> against the recorded source state/log hashes. Check keys_missing is empty and read known fixture key-value and SQL values. Confirm the next audit records include the real restore marker; new mutations may legitimately increase the head. Forks/proposals/diffs not shipped by the format are not magically restored.

  6. Perform an identity replay of the recovered fixture's recorded roots in isolated and continuous modes. Require complete roots, no behavioral changes and no synthetic/approximate effects before declaring recovery. Reopen external traffic only after the actual checks pass.

Drill record

Record binary/engine and fixture hashes, the exact restore command, source and restored LSNs, state/log comparisons, key inventory, replay counts and observed errors. In a disposable fixture, separately check missing/wrong keys are refused; never experiment with production keys. A same-host file target proves format flow only, not off-host backup availability or an unobserved recovery point/time objective.

Clone this wiki locally