39 lines
2.0 KiB
PowerShell
39 lines
2.0 KiB
PowerShell
param(
|
|
[string]$BackupSource = "/mnt/user/backups/borg",
|
|
[string]$DumpSource = "/mnt/user/backups/borg/dumps/latest/postgresql17-paperless.dump",
|
|
[string]$RestoreRoot = "/mnt/user/backups/restore-lab/paperless",
|
|
[string]$ReportRoot = "/mnt/user/backups/restore-reports",
|
|
[string]$BorgPassphraseFile = "/mnt/user/appdata/secrets/borg_repo_passphrase.txt",
|
|
[switch]$WhatIf
|
|
)
|
|
|
|
$Mode = if ($WhatIf) { "WhatIf" } else { "PlanOnly" }
|
|
|
|
Write-Output "Paperless restore test scaffold"
|
|
Write-Output "BackupSource: $BackupSource"
|
|
Write-Output "DumpSource: $DumpSource"
|
|
Write-Output "RestoreRoot: $RestoreRoot"
|
|
Write-Output "ReportRoot: $ReportRoot"
|
|
Write-Output "BorgPassphraseFile: $BorgPassphraseFile"
|
|
Write-Output "Expected Borg source paths inside archive:"
|
|
Write-Output " - local/appdata/paperless-ngx/data"
|
|
Write-Output " - local/paperless/media"
|
|
Write-Output " - local/paperless/export"
|
|
Write-Output " - local/paperless/consume"
|
|
Write-Output "Mode: $Mode"
|
|
Write-Output ""
|
|
Write-Output "Planned steps:"
|
|
Write-Output "1. Prepare restore-lab target under /mnt/user/backups/restore-lab/paperless"
|
|
Write-Output "2. Restore Paperless file data into isolated test paths"
|
|
Write-Output ' Template: borg extract "$BORG_REPO" "::ARCHIVE_NAME" local/appdata/paperless-ngx/data local/paperless/media local/paperless/export local/paperless/consume'
|
|
Write-Output ' Passphrase source: $(cat /mnt/user/appdata/secrets/borg_repo_passphrase.txt)'
|
|
Write-Output "3. Start isolated test Postgres and test Redis"
|
|
Write-Output "4. Import /mnt/user/backups/borg/dumps/latest/postgresql17-paperless.dump into test Postgres"
|
|
Write-Output "5. Start restoretest-paperless against restored files and isolated DB/Redis"
|
|
Write-Output "6. Run smoke checks against the local web endpoint"
|
|
Write-Output "7. Write markdown report under /mnt/user/backups/restore-reports"
|
|
Write-Output "8. Stop test containers and clean restore data after success"
|
|
Write-Output ""
|
|
Write-Output "This script is intentionally a scaffold only."
|
|
Write-Output "No restore, no dump import, no container start, no file write is executed yet."
|