[n8n-workbench-syncer] Syncing local n8n workflows with remote host

I’ve made it for myself, but as i’ve seen some similar questions regarding this, I decided to share it.

The idea is to develop n8n workflows locally, and then deploy them to the host with as small effort as possible. I use private bitbucket repo as a storage, so I did not bother with creds encryption yet, but will deal with it some moment later on.

Feel free to give it a shot and share feedback\suggestions:

2 Likes

I’ve pushed v 0.2.0 - now it supports encryption and other minor improvements.

Now the flow is even easier (the setup is the same: npm i and fill the .env with your repo data):
On the local machine, run npm run export-push - that will, well, export and push workflow+creds to the private repo.
On the host (i use remote RDP), run npm run pull-import - that will pull workflows+creds and import to the host n8n
Then just npm run n8n

There are still minor issues (i want to make it cross-platform), but in overall its looking good

2 Likes

Just pushed 0.3.0 and tested the whole flow - now its looking good. Will play a bit more for a week and will release 1.0.0.

Now the flow is probably the simplest possible:

  1. Upload the repo (with .env) to the host and run npm i on both local and host - one-time installation step
  2. Do changes in local n8n
  3. Run npm run ex
  4. Switch to the host
  5. Run npm run im
  6. Run npm run n8n

Profit

1 Like

Pushed 0.5.0 - now preserving the private git repo history (in previous versions it was overwritten).

Well, my todo and bugs lists for this project are clean now - have no idea what can be improved/fixed further :slight_smile:

If anyone is up for it, please do a test run and share the feedback.

1 Like

Just pushed 1.0.0.
The only change is i’ve added “npm run imr” which means “import”+“run”, just a shortcut.

in overall, i’m amazed how simple workflow is now: i do the change locally, run “npm run ex”, watch how the changes are exported and are pushed to the repo, then i switch to the host, run “npm run im” and “npm run n8n” (tbh i didnt test “imr” yet - bad practice, but no one watches :slight_smile: ) - changes are pulled and imported, and that’s freaking it!

Okay, just tested “imr” - works like a charm. For the continous workflow, “imr” is pretty useful, because it just takes you to stop the current n8n (Cmd+c) on the host, press up button to receive the previous “imr” command, and press enter to update and start n8n.

Just 2 things to note:

  1. Sometimes there’s an error “resource is busy” during the n8n run. Just re-run the command, and it fixes the issue.
  2. Workflows statuses are exported as well. So before the export, it’s important to enable the ones you wish to run on the host. Or enable them manually on the host afterwards, whatever you prefer.
2 Likes

Released 1.1.0.

Moved all n8n env variables from package.json to the .env. It’s a win-win, because package.json is looking much cleaner, also all envs are stored in a single place: .env file. Ah, also dropped some dependencies. So technically, its win-win-win :slight_smile:

3 Likes