feat: add remote service migration - #5195
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
| await updateCompose(composeId, { | ||
| serverId: normalizedTargetServerId, | ||
| serviceNetworks: [], | ||
| }); | ||
| ownershipMoved = true; | ||
| await updateServiceMigrationProgress(migrationRow.serviceMigrationId, { | ||
| phase: "ownership_moved", | ||
| ownershipMoved: true, | ||
| }); |
There was a problem hiding this comment.
If the process exits or the progress write fails after serverId is updated, ownershipMoved remains false, so rollback restarts the workload on the source without restoring its record from the target. The migration row is then deleted, leaving Dokploy managing the wrong server while an orphaned workload runs on the source. The database move at database-move.ts:402-410 has the same split write.
Knowledge Base Used:
| ); | ||
| } | ||
|
|
||
| await onTargetCreated?.(); |
There was a problem hiding this comment.
If the process exits or onTargetCreated fails after the target volume is created, its name is never persisted and this helper does not remove it. Recovery therefore omits the volume, which can contain partial data and blocks later migrations at the collision check; the directory path at line 154 has the same gap.
Knowledge Base Used: Managed databases and storage
Summary
This port is based directly on the remote migration work from
a1dfb1a7f,070de6adc, and6f0195a5e, adapted to current Canary APIs. It is independent of AutoDNS, does not include the AutoDNS commits, and does not depend oncodex/autodns-provider.Related context: DenisHoppe/dokploy#1 and DenisHoppe/dokploy#2.
Validation
pnpm --filter @dokploy/server typecheckpnpm --filter dokploy typecheckGreptile Summary
This PR adds durable, two-phase remote moves for Compose and managed database services, including streamed data transfer, target collision protection, explicit finalization, rollback, and dashboard controls.
Confidence Score: 3/5
The PR should not merge until migration recovery cannot lose track of ownership changes or newly created target artifacts.
Separate writes can leave service placement inconsistent with migration state after interruption, while unrecorded target volumes or directories survive rollback and block safe retries.
Files Needing Attention: packages/server/src/services/compose-move.ts, packages/server/src/services/database-move.ts, packages/server/src/utils/migration/transfer.ts
Reviews (1): Last reviewed commit: "feat: add remote service migration" | Re-trigger Greptile
Context used (3)