Skip to content

fix(backups): honor user-defined S3 prefix#4405

Open
imajus wants to merge 1 commit into
Dokploy:canaryfrom
imajus:fix/backup-prefix-honors-user-config
Open

fix(backups): honor user-defined S3 prefix#4405
imajus wants to merge 1 commit into
Dokploy:canaryfrom
imajus:fix/backup-prefix-honors-user-config

Conversation

@imajus
Copy link
Copy Markdown

@imajus imajus commented May 14, 2026

Summary

Restores the user-defined backup prefix as authoritative while preserving the retention-cleanup fix from #3919.

PR #3919 fixed a real bug in keepLatestNBackups (issue #3855) where path.join() mangled rclone's :s3:bucket remote syntax, causing every scheduled run to delete all backups. Alongside that fix it bundled an unrelated structural change: prepending the auto-generated appName to every backup path (bucket/{appName}/{prefix}/...).

That second change is what issue #4051 reports:

  • The user-defined prefix is no longer authoritative — appName always sits in front of it.
  • Pre-v0.28.5 backups stored at bucket/{prefix}/... are orphaned by the new retention logic.
  • Bucket-layout assumptions break silently (e.g. a previously-private path can now land alongside a public one with the same name).
  • Shipped without a changelog entry or migration path.

This PR keeps the actual retention fix from #3919 and removes the appName insertion across all backup writers and the cleanup paths.

After this change, paths are again:

bucket/{userPrefix}/{filename}                      # all DB / web-server backups
bucket/{userPrefix}/{filename}                      # volume backups, prefix set
bucket/{volume-app-name}/{filename}                 # volume backups, prefix empty (fallback unchanged)

The appName segment introduced in Dokploy#3919 was bundled with the actual
retention fix and made the user-defined prefix non-authoritative
(bucket/{appName}/{prefix}/... instead of bucket/{prefix}/...).

Remove the appName insertion from all backup paths (compose, mariadb,
mongo, mysql, postgres, web-server) and from keepLatestNBackups.
Restore the pre-Dokploy#3919 fallback semantics for volume backups: appName
is used only when no prefix is configured.

The path.join -> template-string + normalizeS3Path fix from Dokploy#3919
that actually repaired retention is preserved.

Closes Dokploy#4051
@imajus imajus marked this pull request as ready for review May 14, 2026 17:03
@imajus imajus requested a review from Siumauricio as a code owner May 14, 2026 17:03
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant