Skip to content

fix: exclude volume-backups from web server backup rsync command#4015

Merged
Siumauricio merged 1 commit intocanaryfrom
3971-abnormal-webserver-backup-file-size-increase-500-kb-4-gb-overnight
Mar 17, 2026
Merged

fix: exclude volume-backups from web server backup rsync command#4015
Siumauricio merged 1 commit intocanaryfrom
3971-abnormal-webserver-backup-file-size-increase-500-kb-4-gb-overnight

Conversation

@Siumauricio
Copy link
Contributor

@Siumauricio Siumauricio commented Mar 17, 2026

  • Updated the rsync command in the runWebServerBackup function to exclude the 'volume-backups/' directory, ensuring that unnecessary data is not copied during the backup process.

What is this PR about?

Please describe in a short paragraph what this PR is about.

Checklist

Before submitting this PR, please make sure that:

  • You created a dedicated branch based on the canary branch.
  • You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
  • You have tested this PR in your local instance. If you have not tested it yet, please do so before submitting. This helps avoid wasting maintainers' time reviewing code that has not been verified by you.

Issues related (if applicable)

closes #3971

Screenshots (if applicable)

Greptile Summary

This PR adds --exclude='volume-backups/' to the rsync command in runWebServerBackup, preventing potentially large Docker volume backup files from bloating web server backups. The change is a minimal, targeted fix for issue #3971.

Key changes:

  • packages/server/src/utils/backups/web-server.ts: Excludes volume-backups/ from rsync during web server backup.

Issues found:

  • The exclude pattern 'volume-backups/' is not anchored to the rsync source root. Using '/volume-backups/' (with a leading /) would be more precise, though the current version works correctly given the known directory structure.
  • More importantly, the corresponding restore function (restoreWebServerBackup) performs a blanket rm -rf "${BASE_PATH}/"* to clear the destination before restoring. Since volume-backups/ is now excluded from the backup, any existing volume backups will be permanently deleted during a restore and will not be recovered. The restore logic should be updated to preserve volume-backups/ across the restore operation.

Confidence Score: 2/5

  • The backup exclusion is correct, but the restore counterpart has a data-loss risk that should be addressed before merging.
  • The rsync change itself is correct and harmless. However, by excluding volume-backups/ from backups without updating the restore logic, any user who restores a web server backup will silently lose all their Docker volume backups — the restore wipes BASE_PATH entirely before copying files back, and since volume-backups/ is no longer in the archive, it is never restored.
  • packages/server/src/utils/restore/web-server.ts — the blanket rm -rf "${BASE_PATH}/"* will destroy volume-backups/ during restore since it is no longer included in backups.

Last reviewed commit: a2f1421

Greptile also left 2 inline comments on this PR.

- Updated the rsync command in the runWebServerBackup function to exclude the 'volume-backups/' directory, ensuring that unnecessary data is not copied during the backup process.
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 17, 2026
@Siumauricio Siumauricio merged commit 6a1bedb into canary Mar 17, 2026
5 checks passed
@Siumauricio Siumauricio deleted the 3971-abnormal-webserver-backup-file-size-increase-500-kb-4-gb-overnight branch March 17, 2026 05:27

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
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
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
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 {} +`);

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

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Abnormal webserver backup file size increase (~500 KB → ~4 GB overnight)

1 participant