Skip to content

fix: clear old deployment records and logs keeping only active deployment#4554

Open
Irwnda wants to merge 2 commits into
Dokploy:canaryfrom
Irwnda:fix/clear-old-deployments-keep-active
Open

fix: clear old deployment records and logs keeping only active deployment#4554
Irwnda wants to merge 2 commits into
Dokploy:canaryfrom
Irwnda:fix/clear-old-deployments-keep-active

Conversation

@Irwnda
Copy link
Copy Markdown

@Irwnda Irwnda commented Jun 6, 2026

Problem

clearOldDeployments was only deleting log files via rm -rf. The modal says "This will delete all old deployment records and logs, keeping only the active deployment", but records were never actually deleted.

Changes

  • Now fetches deployment records by applicationId or composeId
  • Keeps the most recent successful (done) deployment, falling back to the latest if none is found
  • Deletes rollbacks, log files, and DB records for all others via removeDeployment
  • Remote log files are explicitly deleted via a batched rm -f command before removeDeployment is called, since removeDeployment cannot handle remote log cleanup for application/compose deployments (serverId is not stored on the deployment record itself)

Verification

[x] Triggered clear old deployments on an application: confirmed only the active deployment record and log remain
[x] Triggered clear old deployments on a compose: same result
[x] Verified remote server deployments are cleaned up correctly

Before

Before.fix.mov

After

After.Fix.mov

Note

removeDeployment does not correctly delete log files for remote server deployments because serverId is never stored on the deployment record for application/compose deployments.

@Irwnda Irwnda requested a review from Siumauricio as a code owner June 6, 2026 07:55
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Jun 6, 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