fix(volume-backups): restart services after backup failure - #5081
Closed
bestmaa wants to merge 1 commit into
Closed
Conversation
bestmaa
marked this pull request as ready for review
August 14, 2026 11:41
Comment on lines
+31
to
+35
| set -e | ||
| ${startCommand} | ||
| if [ "$DOKPLOY_VOLUME_BACKUP_STATUS" -ne 0 ]; then | ||
| exit "$DOKPLOY_VOLUME_BACKUP_STATUS" | ||
| fi |
Contributor
There was a problem hiding this comment.
Restart overrides backup status
When both the backup and restart fail, set -e exits at the restart command before the saved backup status is checked, causing deployment diagnostics and notifications to report the secondary restart failure instead of the original backup failure.
Suggested change
| set -e | |
| ${startCommand} | |
| if [ "$DOKPLOY_VOLUME_BACKUP_STATUS" -ne 0 ]; then | |
| exit "$DOKPLOY_VOLUME_BACKUP_STATUS" | |
| fi | |
| ${startCommand} | |
| DOKPLOY_VOLUME_RESTART_STATUS=$? | |
| set -e | |
| if [ "$DOKPLOY_VOLUME_BACKUP_STATUS" -ne 0 ]; then | |
| exit "$DOKPLOY_VOLUME_BACKUP_STATUS" | |
| fi | |
| if [ "$DOKPLOY_VOLUME_RESTART_STATUS" -ne 0 ]; then | |
| exit "$DOKPLOY_VOLUME_RESTART_STATUS" | |
| fi |
Knowledge Base Used: Backups and Schedules
Author
|
Replaced by #5082 using the contributor-owned branch name fix/volume-backup-restart. The code and verified commit are unchanged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When Turn Off Container During Backup is enabled, the generated volume-backup script stops the application or Compose service before creating the archive. Because the script runs with
set -e, a backup failure exits immediately and skips the restart command, leaving the service offline until someone restarts it manually.This is especially disruptive for transient failures such as an unavailable image registry or a failed
ubuntuimage pull.What changed
Impact
Services that are intentionally stopped for a consistent volume backup are brought back online even when archive creation fails. Successful backup and upload behavior remains unchanged.
Validation
pnpm --filter=dokploy exec vitest --config __test__/vitest.config.ts run __test__/backups— 21 tests passedpnpm --filter=@dokploy/server typecheckpnpm --filter=dokploy typecheckFixes #4263
Greptile Summary
The PR changes volume-backup command generation so stopped application and Compose services are restarted after archive failures while retaining failure signaling.
Confidence Score: 4/5
The restart sequencing needs correction before merging because a failed restart can override the original backup failure that this change promises to preserve.
The saved backup status is checked only after a fallible restart executes under errexit, so simultaneous backup and restart failures surface the wrong exit status and diagnostics.
Files Needing Attention: packages/server/src/utils/volume-backups/backup.ts
Reviews (1): Last reviewed commit: "fix(volume-backups): restart services af..." | Re-trigger Greptile
Context used: