11 Restoring: the files alone

For a lost or damaged uploads volume, with the database still good. Unpacking only adds files, and as stored names are never reused, it cannot overwrite a newer file's contents. A file damaged in place is replaced by the archive's copy.

  1. Stop what uses the volume:

    docker compose rm -sf web worker
    
  2. Only if the volume is damaged, remove it, so the archive unpacks onto a new one. On a healthy volume this destroys every file newer than the archive. It also removes in-app backups from earlier versions, which no backup archive holds: if you may still need them, copy them off first, as "In-app backups from before this version" shows.

    PROJECT="$(docker compose config | sed -n 's/^name: *//p' | head -n 1)" &&
      docker volume rm "${PROJECT}_uploads"
    
  3. Restore the files, and start again. Add --profile tls to the second line if you use the bundled Caddy:

    ./deploy/restore.sh --files-only /var/backups/grc/uploads-<stamp>.tar.gz
    docker compose up -d
    
  4. Compare records with files. A record newer than the archive has no file, unless it is in a later backup:

    docker compose run --rm --no-deps worker ./node_modules/.bin/tsx --tsconfig tsconfig.worker.json src/lib/jobs/storage-reconcile.ts
    
  5. After restoring files, use Verify files on the evidence screens to check their fingerprints. Sessions and tokens are unaffected, so restore:finish is not needed here.