This n8n workflow automates the regular backup of n8n workflows and credentials to a GitLab repository. It is triggered periodically by a cron schedule at four different times daily (midnight, 6 AM, noon, and 6 PM). When triggered, the workflow exports all current workflows and credentials from n8n, then stages, commits, and pushes these backups to a specified GitLab repository. This ensures a consistent and automated version control process for your automation setups, minimizing data loss risk, and maintaining a history of changes.
### Workflow Breakdown:
1. **Cron Trigger:** The workflow is initiated four times a day, ensuring that backups occur regularly without manual intervention.
2. **Export Workflows:** Uses the ‘npx n8n export:workflow’ command to export all workflows into a designated directory.
3. **Export Credentials:** Uses the ‘npx n8n export:credentials’ command to export all credentials into a specific folder.
4. **Git Add:** Stages all changes in the repository, marking files for commit.
5. **Git Commit:** Creates a commit with a message that includes the current timestamp, documenting when the backup was made.
6. **Git Push:** Pushes the committed changes to the remote GitLab repository, ensuring backups are saved externally.
7. **Manual Trigger:** Also includes a manual trigger node allowing for on-demand backups.
### Use Cases:
This workflow is ideal for individuals or teams managing multiple n8n workflows who want to implement automatic version control, safeguard their automation setup, and easily revert to previous versions if needed. It is especially useful in collaborative environments or when maintaining compliance with change management protocols.
Reviews
There are no reviews yet.