Access remote n8n server with CLI

I couldn’t find a way to run n8n CLI against a remote n8n server. Is there one?

If you set up the same database on both of them, then it should work.

Can you elaborate?

Is CLI connecting directly to the database?
If that’s the case, all I need is to provide env variables for the DB to do import/export?

Cheers

Everything is kept in the database so if you were to run the CLI on one instance the other instance would also pick up the change.

Is this a general question or do you have something in mind that you want to do?

There is a request to have an API which could help or what you could do is use webhooks with Bash-Dash (or similar) and that may do the job.

1 Like

I have two machines, each running docker with n8n server and a database.
One is my laptop and holds all my workflows,
the other is a remote server with a fresh n8n install.

I’d like to move all my workflows and credentials from my laptop to the server.

I have currently two problems with that:

  • running n8n export on my laptop doesn’t export anything
  • don’t know how to connect n8n CLI to a remote n8n server.

For security reasons I don’t want to migrate raw SQL data (different encryption keys for credentials)

1 Like

I didn’t understand the n8n CLI/server architecture. There’s no client-server communication. Both CLI and the server are equal clients to the database. CLI accepts the same env variables as the server and this way it can export or import workflows or credentials.