Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/server/src/utils/backups/web-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const runWebServerBackup = async (backup: BackupSchedule) => {
await execAsync(cleanupCommand);

await execAsync(
`rsync -a --ignore-errors --no-specials --no-devices ${BASE_PATH}/ ${tempDir}/filesystem/`,
`rsync -a --ignore-errors --no-specials --no-devices --exclude='volume-backups/' ${BASE_PATH}/ ${tempDir}/filesystem/`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Anchor the exclude pattern to source root

The pattern --exclude='volume-backups/' will match a directory named volume-backups/ at any depth within BASE_PATH. While this works correctly today since volume-backups/ only exists at the top level of BASE_PATH, using a leading / anchors the pattern to the rsync source root and is more precise:

Suggested change
`rsync -a --ignore-errors --no-specials --no-devices --exclude='volume-backups/' ${BASE_PATH}/ ${tempDir}/filesystem/`,
`rsync -a --ignore-errors --no-specials --no-devices --exclude='/volume-backups/' ${BASE_PATH}/ ${tempDir}/filesystem/`,

);
Comment on lines 69 to 71
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Restore wipes volume-backups not included in backup

Now that volume-backups/ is excluded from the web server backup, the corresponding restore operation in packages/server/src/utils/restore/web-server.ts will permanently destroy all volume backups during a restore. The restore code (line 56) does:

await execAsync(`rm -rf "${BASE_PATH}/"*`);

This blanket deletion removes ${BASE_PATH}/volume-backups/, but since the directory is no longer included in the backup, it is never restored. Any volume backups present at the time of restoration will be silently lost.

Consider updating the restore logic to preserve volume-backups/ by moving it aside before wiping BASE_PATH and placing it back afterwards, or by using a targeted delete that skips volume-backups/:

// Delete everything except volume-backups
await execAsync(`find "${BASE_PATH}" -maxdepth 1 -mindepth 1 ! -name 'volume-backups' -exec rm -rf {} +`);


writeStream.write("Copied filesystem to temp directory\n");
Expand Down
Loading