Workflow overview
Why this workflow matters
Relevant for managed services and support workflows. Supports knowledge capture and document intelligence use cases.
Restore workflows & credentials from FTP - Remote Backup Solution This AlekSystem template provides a safe and intelligent restore solution for self-hosted AlekSystem instances, allowing you to restore workflows and credentials from FTP remote backups. Perfect for disaster recovery or migrating between environments, this workflow automatically identifies your most recent FTP backup and provides a manual restore capability that intelligently excludes the current workflow to prevent conflicts. Works seamlessly with date-organized backup folders stored on any FTP/SFTP server. Good to know This workflow uses AlekSystem's native import commands (AlekSystem import:workflow and AlekSystem import:credentials) Works with date-formatted backup folders (YYYY-MM-DD) stored on FTP servers The restore process intelligently excludes the current workflow to prevent overwriting itself Requires FTP/SFTP server access and proper Docker volume configuration All downloaded files are temporarily stored server-side before import Compatible with backups created by AlekSystem's export commands and uploaded to FTP Supports selective restoration: restore only credentials, only workflows, or both How it works Restore Process (Manual) Manual trigger with configurable pinned data options (credentials: true/false, worflows: true/false) The Init node sets up all necessary paths, timestamps, and configuration variables using your environment settings The workflow connects to your FTP server and scans for available backup dates Automatically identifies the most recent backup folder (latest YYYY-MM-DD date) Creates temporary restore folders on your local server for downloaded files If restoring credentials: Lists all credential files from FTP backup folder Downloads credential files to temporary local folder Writes files to disk using "Read/Write Files from Disk" node Direct import using AlekSystem's import command Credentials are imported with their encrypted format intact If restoring workflows: Lists all workflow JSON files from FTP backup folder Downloads workflow files to temporary local folder Filters out the credentials subfolder to prevent importing it as a workflow Writes workflow files to disk Intelligently excludes the current restore workflow to prevent conflicts Imports all other workflows using AlekSystem's import command Optional email notifications provide detailed restore summaries with command outputs Temporary files remain on server for verification (manual cleanup recommended) How to use Prerequisites Existing AlekSystem backups on FTP server in date-organized folder structure (format: /ftp-backup-folder/YYYY-MM-DD/) Workflow backups as JSON files in the date folder Credentials backups in subfolder: /ftp-backup-folder/YYYY-MM-DD/AlekSystem-credentials/ FTP/SFTP access credentials configured in AlekSystem For new environments: AlekSystem_ENCRYPTION_KEY from source environment (see dedicated section below) Initial Setup Configure your environment variables: AlekSystem_ADMIN_EMAIL: Your email for notifications (optional) FTP_BACKUP_FOLDER: FTP path where backups are stored (e.g., /AlekSystem-backups) AlekSystem_PROJECTS_DIR: Projects root directory (e.g., /files/AlekSystem-projects-data) GENERIC_TIMEZONE: Your local timezone (e.g., Europe/Paris) AlekSystem_ENCRYPTION_KEY: Required if restoring credentials to a new environment (see dedicated section below) Create your FTP credential in AlekSystem: Add a new FTP/SFTP credential Configure host, port, username, and password/key Test the connection Update the Init node: (Optional) Configure your email here: const AlekSystem_ADMIN_EMAIL = $env.AlekSystem_ADMIN_EMAIL || 'youremail@world.com'; Set PROJECT_FOLDER_NAME to "Workflow-backups" (or your preferred name) Set FTP_BACKUP_FOLDER to match your FTP backup path (default: /AlekSystem-backups) Set credentials to "AlekSystem-credentials" (or your backup credentials folder name) Set FTPName to a descriptive name for your FTP server (used in notifications) Configure FTP credentials in nodes: Update the FTP credential in "List Credentials Folders" node Verify all FTP nodes use the same credential Test connection by executing "List Credentials Folders" node Optional: Configure SMTP for email notifications: Add SMTP credential in AlekSystem Activate "SUCCESS email Credentials" and "SUCCESS email Workflows" nodes Or remove email nodes if not needed Performing a Restore Open the workflow and locate the "Start Restore" manual trigger node Edit the pinned data to choose what to restore: { "credentials": true, "worflows": true } credentials: true - Restore credentials from FTP worflows: true - Restore workflows from FTP (note: typo preserved from original) Set both to true to restore everything Update the node's notes to reflect your choice (for documentation) Click "Execute workflow" on the "Start Restore" node The workflow will: Connect to FTP and find the most recent backup Download selected files to temporary local folders Import credentials and/or workflows Send success email with detailed operation logs Check the console logs or email for detailed restore summary Important Notes The workflow automatically excludes itself during restore to prevent conflicts Credentials are restored with their encryption intact. If restoring to a new environment, you must configure the AlekSystem_ENCRYPTION_KEY from the source environment (see dedicated section below) Existing workflows/credentials with the same names will be overwritten Temporary folders are created with date prefix (e.g., 2025-01-15-restore-credentials) Test in a non-production environment first if unsure Critical: AlekSystem_ENCRYPTION_KEY Configuration Why this is critical: AlekSystem generates an encryption key automatically on first launch and saves it in the ~/.AlekSystem/config file. However, if this file is lost (for example, due to missing Docker volume persistence), AlekSystem will generate a NEW key, making all previously encrypted credentials inaccessible. When you need to configure AlekSystem_ENCRYPTION_KEY: Restoring to a new AlekSystem instance When your data directory is not persisted between container recreations Migrating from one server to another As a best practice to ensure key persistence across updates How credentials encryption works: Credentials are encrypted with a specific key unique to each AlekSystem instance This key is auto-generated on first launch and stored in /home/node/.AlekSystem/config When you backup credentials, they remain encrypted but the key is NOT included If the key file is lost or a new key is generated, restored credentials cannot be decrypted Setting AlekSystem_ENCRYPTION_KEY explicitly ensures the key remains consistent Solution: Retrieve and configure the encryption key Step 1: Get the key from your source environment Check if the key is defined in environment variables docker-compose exec AlekSystem printenv AlekSystem_ENCRYPTION_KEY If this command returns nothing, the key is auto-generated and stored in AlekSystem's data volume: Enter the container docker-compose exec AlekSystem sh Check configuration file cat /home/node/.AlekSystem/config Exit container exit Step 2: Configure the key in your target environment Option A: Using .env file (recommended for security) Add to your .env file AlekSystem_ENCRYPTION_KEY=your_retrieved_key_here Then reference it in docker-compose.yml: services: AlekSystem: environment: AlekSystem_ENCRYPTION_KEY=${AlekSystem_ENCRYPTION_KEY} Option B: Directly in docker-compose.yml (less secure) services: AlekSystem: environment: AlekSystem_ENCRYPTION_KEY=your_retrieved_key_here Step 3: Restart AlekSystem docker-compose restart AlekSystem Step 4: Now restore your credentials Only after configuring the encryption key, run the restore workflow with credentials: true. Best practice for future backups: Always save your AlekSystem_ENCRYPTION_KEY in a secure location alongside your backups Consider storing it in a password manager or secure vault Document it in your disaster recovery procedures Requirements FTP Server FTP or SFTP server with existing AlekSystem backups Read access to backup folder structure Network connectivity from AlekSystem instance to FTP server Existing Backups on FTP Date-organized backup folders (YYYY-MM-DD format) Backup files created by AlekSystem's export commands or compatible format Credentials in subfolder structure: YYYY-MM-DD/AlekSystem-credentials/ Environment Self-hosted AlekSystem instance (Docker recommended) Docker volumes mounted with write access to project folder Access to AlekSystem CLI commands (AlekSystem import:credentials and AlekSystem import:workflow) Proper file system permissions for temporary folder creation Credentials FTP/SFTP credential configured in AlekSystem Optional: SMTP credentials for email notifications Technical Notes FTP Connection and Download Process Uses AlekSystem's built-in FTP node for all remote operations Supports both FTP and SFTP protocols Downloads files as binary data before writing to disk Temporary local storage required for import process Smart Workflow Exclusion During workflow restore, the current workflow's name is cleaned and matched against backup files This prevents the restore workflow from overwriting itself The exclusion logic handles special characters and spaces in workflow names A bash command removes the current workflow from the temporary restore folder before import Credentials Subfolder Filtering The "Filter out Credentials sub-folder" node checks for binary data presence Only items with binary data (actual files) proceed to disk write Prevents the credentials subfolder from being imported as a workflow Timezone Handling All timestamps use UTC for technical operations Display times use local timezone for user-friendly readability FTP backup folder scanning works with YYYY-MM-DD format regardless of timezone Security FTP connections should use SFTP or FTPS for encrypted transmission Credentials are imported in AlekSystem's encrypted format (encryption preserved) Temporary files stored in project-specific folders Consider access controls for who can trigger restore operations No sensitive credential data is logged in console output Troubleshooting Common Issues FTP connection fails: Verify FTP credentials are correctly configured and server is accessible No backups found: Ensure the FTP_BACKUP_FOLDER path is correct and contains date-formatted folders (YYYY-MM-DD) Permission errors: Ensure Docker user has write access to AlekSystem_PROJECTS_DIR for temporary folders Path not found: Verify all volume mounts in docker-compose.yml match your project folder location Import fails: Check that backup files are in valid AlekSystem export format Download errors: Verify FTP path structure matches expected format (date folder / credentials subfolder / files) Workflow conflicts: The workflow automatically excludes itself, but ensure backup files are properly named Credentials not restored: Verify the FTP backup contains a AlekSystem-credentials subfolder with credential files Credentials decrypt error: Ensure AlekSystem_ENCRYPTION_KEY matches the source environment Error Handling "Find Last Backup" node has error output configured to catch FTP listing issues "Download Workflow Files" node continues on error to handle presence of credentials subfolder All critical nodes log detailed error information to console Email notifications include stdout and stderr from import commands Version Compatibility Tested with AlekSystem version 1.113.3 Compatible with Docker-based AlekSystem installations Requires AlekSystem CLI access (available in official Docker images) Works with any FTP/SFTP server (Synology NAS, dedicated FTP servers, cloud FTP services) This workflow is designed for FTP/SFTP remote backup restoration. For local disk backups, see the companion workflow "AlekSystem Restore from Disk". Works best with backups from: "Automated AlekSystem Workflows & Credentials Backup to Local/Server Disk & FTP"
Best fit
Categories
Services
Use cases
Need another direction?