Skip to content

feat(backups): add SFTP and FTP backup destination types#1462

Open
VladislavTsytrikov wants to merge 2 commits intoCortexFlow-AI:canaryfrom
VladislavTsytrikov:fix/168-sftp-ftp-backup-destinations
Open

feat(backups): add SFTP and FTP backup destination types#1462
VladislavTsytrikov wants to merge 2 commits intoCortexFlow-AI:canaryfrom
VladislavTsytrikov:fix/168-sftp-ftp-backup-destinations

Conversation

@VladislavTsytrikov
Copy link
Copy Markdown

@VladislavTsytrikov VladislavTsytrikov commented Mar 27, 2026

Summary

Fixes #168

Adds SFTP and FTP as backup destination types alongside existing S3 compatible storage, using rclone's native backends.

What changed

Schema & Migration:

  • Added destinationType column (default "s3" for backward compat)
  • Added nullable host, port, username, password, basePath columns for SFTP/FTP
  • Migration 0155_add_destination_types.sql

Backend (packages/server):

  • getRcloneFlags(destination) — generates rclone CLI flags based on destination type (S3/SFTP/FTP)
  • getRcloneRemote(destination, subpath) — generates the rclone remote path (:s3:, :sftp:, :ftp:)
  • obscureRclonePassword(password) — obscures passwords via rclone obscure before DB storage
  • Shell-escaping for SFTP/FTP credential values to prevent injection
  • All backup, restore, and volume-backup modules updated to use the new functions

Frontend (apps/dokploy):

  • Destination type selector dropdown (S3 Compatible / SFTP / FTP)
  • Conditional form fields based on selected type
  • Conditional validation — S3 fields required for S3, host/username required for SFTP/FTP
  • Type badge shown in destination list
  • Test connection works for all destination types

How I tested this

  1. Set up local dev environment (pnpm run dokploy:setup && dokploy:dev)
  2. Ran docker run -d --name test-sftp -p 2222:22 atmoz/sftp user:pass:::backups for a test SFTP server
  3. Created SFTP destination via UI → Test Connection → "Connection Success"
dokploy-destinations-check sftp-connection-success sftp-destination-created sftp-form-filled
  1. Created the destination → saved to DB with type badge visible
  2. Verified S3 form still works (backward compatible)
  3. pnpm run test — 418 passed (4 pre-existing Docker integration failures)
  4. Biome lint clean on all changed files

Backward compatibility

Existing S3 destinations continue to work without any changes. The destinationType column defaults to "s3", and all existing code paths fall through to the original S3 logic.

/claim #168

Add support for SFTP and FTP as backup destination types alongside
existing S3 compatible storage. Uses rclone's native backends.

Changes:
- Add destinationType column to destination schema with migration
- Add getRcloneFlags() and getRcloneRemote() to centralize rclone
  command generation for all destination types
- Passwords are obscured via rclone obscure before storage
- Shell-escape user inputs to prevent command injection
- Update all backup, restore, and volume-backup modules
- Add destination type selector in UI with conditional form fields
- Add conditional validation (S3 fields required for S3, host/username
  required for SFTP/FTP)
- Show destination type badge in destination list

Fixes CortexFlow-AI#168
@VladislavTsytrikov VladislavTsytrikov force-pushed the fix/168-sftp-ftp-backup-destinations branch from 21cf4b5 to 799ca4c Compare March 27, 2026 20:51
S3-specific fields (accessKey, bucket, etc.) now default to empty string
in the API schema instead of being required. Frontend only sends fields
relevant to the selected destination type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to backup to more destination types

1 participant