Skip to content

fix(restore): let the same --fresh command finish a failed recovery - #37

Open
T3ST3ST3R0N wants to merge 1 commit into
mainfrom
fix/fresh-restore-retry
Open

T3ST3ST3R0N wants to merge 1 commit into
mainfrom
fix/fresh-restore-retry

Conversation

@T3ST3ST3R0N

@T3ST3ST3R0N T3ST3ST3R0N commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up from the review of #34.

A --fresh run that failed after installing .env and docker-compose.yml (for example when the database never became ready) left non-empty directories and a database container behind, so running the same command again was refused. The only way on was an ordinary restore.

  • Once .env and the Compose file are installed, --fresh writes APP_DIR/.pasarguard-fresh-restore with the SHA256 of the backup's checksum inventory. A successful restore removes it.
  • Running --fresh again with that marker continues as an ordinary restore of the provisioned installation, after checking that the archive is the same backup; a different backup is refused. Nothing is rolled back or deleted.
  • If the continuation fails, it does not start the services of the half-provisioned installation.
  • Backups and restores skip the marker file.
  • pasarguard install removes a leftover marker, so a later --fresh cannot continue into the new installation.

Known small leftover: a continued --fresh still makes the usual pre-restore copies of the half-provisioned directories. Skipping them touches the same lines as #35, so I'll add it after #35 lands, to keep the two PRs free of conflicts.

Tests: unit cases for the marker, the continuation and a different backup (red against main). tests/fresh_recovery_roundtrip.sh gets a failing-healthcheck mode: the first --fresh fails, and the same command again must finish the recovery. CI runs it for PostgreSQL, and it passes locally with Docker.

Follow-up from the review of #34 (F4). A --fresh run that failed after
installing .env and docker-compose.yml left non-empty directories and a
database container, so running the same command again was refused, and
the only way on was an ordinary restore.

- Once .env and the Compose file are installed, --fresh writes
  APP_DIR/.pasarguard-fresh-restore with the SHA256 of the backup's
  checksum inventory. A successful restore removes it.
- Running --fresh again with that marker continues as an ordinary
  restore of the provisioned installation, after checking that the
  archive is the same backup. Nothing is rolled back or deleted.
- A failed continuation does not start the services of the
  half-provisioned installation.
- Backups and restores skip the marker file.
- tests: unit cases for the marker, the continuation and a different
  backup; a failing-healthcheck variant of the real fresh round trip,
  also run in CI for PostgreSQL.
@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8d0f637f-3dfd-4541-b44c-d543bc3bc02e

📥 Commits

Reviewing files that changed from the base of the PR and between 7bccaec and 45d7b8b.


📒 Files selected for processing (8)
  • .github/workflows/backup-restore.yml
  • docs/backup-and-restore.fa.md
  • docs/backup-and-restore.md
  • lib/pasarguard-backup.sh
  • lib/pasarguard-restore.sh
  • pasarguard.sh
  • tests/fresh_recovery_roundtrip.sh
  • tests/unit_restore_recovery.sh


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant