Skip to content

feat: Add FTP, SFTP, and Google Drive backup destination types via rclone#1455

Open
brs7gd4r88-creator wants to merge 28 commits intoCortexFlow-AI:mainfrom
brs7gd4r88-creator:feat/multi-destination-types
Open

feat: Add FTP, SFTP, and Google Drive backup destination types via rclone#1455
brs7gd4r88-creator wants to merge 28 commits intoCortexFlow-AI:mainfrom
brs7gd4r88-creator:feat/multi-destination-types

Conversation

@brs7gd4r88-creator
Copy link

Summary

Resolves #168 — Adds support for FTP, SFTP, and Google Drive as backup destination types, in addition to the existing S3-compatible storage.

Motivation

Previously Dokploy only supported S3-compatible storage for backups. Many users need to back up to FTP/SFTP servers or Google Drive. Since rclone (which already ships with Dokploy) supports all these protocols, we can leverage it to add multi-destination support with minimal additional dependencies.

Changes

Schema & Database

  • Added destinationType enum: s3, ftp, sftp, google-drive
  • Added new columns to the destination table:
    • FTP/SFTP: ftpHost, ftpPort, ftpUser, ftpPassword, ftpPath, sftpKeyPath
    • Google Drive: googleDriveClientId, googleDriveClientSecret, googleDriveRefreshToken, googleDriveFolderId
  • Made S3-specific columns (accessKey, secretAccessKey, bucket, region, endpoint) nullable for non-S3 destinations
  • Added migration 0150_add_destination_types.sql

Backend

  • Created getRcloneFlags(destination) — returns the correct rclone CLI flags based on destination type
  • Created getRcloneRemotePath(destination, subPath) — returns the correct rclone remote path (e.g., :s3:, :ftp:, :sftp:, :drive:)
  • Updated all backup runners (postgres, mysql, mariadb, mongo, compose, web-server) to use destination-agnostic helpers
  • Updated all restore functions to use destination-agnostic helpers
  • Updated volume backup/restore to use destination-agnostic helpers
  • Updated testConnection in the destination router to test all destination types

Frontend

  • Added destination type selector (dropdown) to the Add/Edit Destination dialog
  • Form shows different fields based on selected type:
    • S3: Provider, Access Key, Secret Key, Bucket, Region, Endpoint (unchanged)
    • FTP: Host, Port, Username, Password, Remote Path
    • SFTP: Host, Port, Username, Password, SSH Key Path, Remote Path
    • Google Drive: OAuth Client ID, Client Secret, Refresh Token, Folder ID
  • Destination list now shows a type badge next to each destination
  • Updated header text from "S3 Destinations" to "Backup Destinations"

Backward Compatibility

  • Existing S3 destinations automatically get destinationType = 's3' via the column default
  • All existing backup/restore functionality continues to work unchanged
  • The getS3Credentials function is preserved for any external consumers

Testing

  • Verified all import chains resolve correctly across the monorepo
  • Migration is backward-compatible (adds columns + enum, makes columns nullable)

Волков Дмитрий Сергеевич and others added 28 commits March 10, 2026 23:16
When editing a notification, only the notification.all query cache was
invalidated. The notification.one query retained stale data, causing
the edit form to display previous values on subsequent edits.
…ion-cache-on-edit

fix: invalidate notification.one query cache on update
…auth

chore: update better-auth dependencies to version 1.5.4 and refactor …
…s in components

- Introduced new test files for permission checks, including `check-permission.test.ts`, `enterprise-only-resources.test.ts`, `resolve-permissions.test.ts`, and `service-access.test.ts`.
- Implemented permission checks in various components to ensure actions are gated by user permissions, including `ShowTraefikConfig`, `UpdateTraefikConfig`, `ShowVolumes`, `ShowDomains`, and others.
- Enhanced the logic for displaying UI elements based on user permissions, ensuring that only authorized users can access or modify resources.
…h new definitions

- Deleted the old SQL files for organization_role and audit_log.
- Introduced new SQL file defining organization_role and audit_log with updated foreign key constraints and indexes.
- Updated metadata snapshots to reflect the new table structures and relationships.
- Adjusted access control permissions for backup and notification operations to include update capabilities.
- Replaced the delete operation with an update for organization roles, ensuring existing roles are modified instead of removed.
- Adjusted the return value to reflect the updated role instead of a newly created entry.
- Reintroduced the audit logging functionality for role updates.
feat: add comprehensive permission tests and enhance permission check…
- Added new components for displaying and managing audit logs, including a data table and filters for user actions.
- Introduced a custom roles management interface, allowing users to create and modify roles with specific permissions.
- Updated permission checks to ensure proper access control for audit logs and custom roles.
- Refactored existing components to integrate new functionality and improve user experience.
…-submit

fix: prevent Watch Paths tooltip button from submitting the form
- Replaced direct state checks with a derived variable `isCollapsed` for better readability and maintainability.
- Updated class names and conditions in the SidebarLogo component to use the new `isCollapsed` variable.
- Adjusted overflow behavior in Sidebar and SidebarContent components for improved layout management.
- Removed TimeBadge from the ShowProjects component and integrated it into the BreadcrumbSidebar.
- Added a query to determine if the environment is cloud-based, allowing for conditional display of the TimeBadge.
- Updated layout in BreadcrumbSidebar for improved spacing and organization.
…tate-has-usability-and-visual-issues

3979 collapsed sidebar state has usability and visual issues
- Updated MariaDB, MongoDB, MySQL, PostgreSQL, and Redis schemas to include an optional dockerImage field for enhanced configuration flexibility.
…ker-image-reset-to-default-for-any-unrelated-change

feat: add optional dockerImage field to database schemas
- Updated the rsync command in the runWebServerBackup function to exclude the 'volume-backups/' directory, ensuring that unnecessary data is not copied during the backup process.
…backup-file-size-increase-500-kb-4-gb-overnight

fix: exclude volume-backups from web server backup rsync command
- Updated the mechanizeDockerContainer function to conditionally use authConfig when creating a Docker service, ensuring proper service creation based on authentication settings.
…eploy-to-swarm-worker-fails-with-unauthorized-no-such-image-retry-succeeds

fix: handle optional authConfig in mechanizeDockerContainer function
…n-off

fix(volume-backups): restart container before S3 upload in volume backup
…lone

Resolves CortexFlow-AI#168

Previously, Dokploy only supported S3-compatible storage as backup destinations.
This change adds support for FTP, SFTP, and Google Drive destinations using rclone,
which already ships with Dokploy.

Changes:
- Added 'destinationType' enum (s3, ftp, sftp, google-drive) to destination schema
- Added new DB columns for FTP/SFTP (host, port, user, password, path, SSH key path)
  and Google Drive (clientId, clientSecret, refreshToken, folderId)
- Created getRcloneFlags() and getRcloneRemotePath() helpers that generate the correct
  rclone flags/paths based on destination type
- Updated all backup runners (postgres, mysql, mariadb, mongo, compose, web-server),
  all restore functions, and volume backup/restore to use the new destination-agnostic helpers
- Updated the destination router's testConnection to support all destination types
- Updated frontend form with destination type selector and conditional fields per type
- Updated destination list UI to display the destination type badge
- Added DB migration (0150_add_destination_types.sql)
- Made S3-specific columns nullable for non-S3 destinations (backward compatible)
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.

5 participants