n8n/packages/cli
2019-08-06 20:45:43 +02:00
..
commands Make it possible to secure n8n via basic auth 2019-08-04 14:24:48 +02:00
config Make it possible to secure n8n via basic auth 2019-08-04 14:24:48 +02:00
src 🐛 Fix bug with slow push messages 2019-08-06 20:44:36 +02:00
index.ts Rename cli command "run" to "execute" 2019-06-24 08:28:24 +02:00
LICENSE.md Rename LICENSE files to LICENSE.md 2019-06-23 17:55:43 +02:00
package.json 🔖 Release n8n@0.13.4 2019-08-06 20:45:43 +02:00
README.md Make it possible to secure n8n via basic auth 2019-08-04 14:24:48 +02:00
tsconfig.json Use convict for configuration to make n8n easier to configure 2019-07-21 19:52:57 +02:00
tslint.json Initial commit to release 2019-06-23 12:35:23 +02:00

n8n - Workflow Automation Tool

n8n.io - Workflow Automation

n8n is a free node based "Open Source" (with Commons Clause) Workflow Automation Tool. It can be self-hosted, easily extended, and so also used with internal tools.

n8n.io - Screenshot

Is still in beta so can not guarantee that everything works perfectly. Also is there currently not much documentation. That will hopefully change soon.

Demo

A short demo (< 3 min) which shows how to create a simple workflow which automatically sends a new Slack notification every time a Github repository received or lost a star:

https://www.youtube.com/watch?v=ePdcf0yaz1c

Give n8n a spin

To simply spin up n8n to have a look and give it spin you can simply run:

npx n8n

It will then download everything which is needed and start n8n.

You can then access n8n by opening: http://localhost:5678

Installation

To fully install n8n globally execute:

npm install n8n -g

Start

After the installation n8n can be started by simply typing in:

n8n
# or
n8n start

Start with tunnel

To be able to use webhooks which all triggers of external services like Github rely on n8n has to be reachable from the web. To make that easy n8n has a special tunnel service which redirects requests from our servers to your local n8n instance.

To use it simply start n8n with --tunnel

n8n start --tunnel

Securing n8n

By default n8n can be accessed by everybody. This is OK if you have it only running locally buy if you deploy it on a server which is accessible from the web you have to make sure that n8n is protected! Right now we have very basic protection via basic-auth in place. It can be activated by setting the following environment variables:

N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=<USER>
N8N_BASIC_AUTH_PASSWORD=<PASSWORD>

Start with other Database

By default n8n uses SQLite to save credentials, past executions and workflows. n8n however also supports MongoDB and PostgresDB. To use them simply a few environment variables have to be set.

Start with MongoDB as Database

To use MongoDB as database you can provide the following environment variables like in the example bellow:

  • DB_TYPE=mongodb
  • DB_MONGODB_CONNECTION_URL=<CONNECTION_URL>

Replace the following placeholders with the actual data:

  • MONGO_DATABASE
  • MONGO_HOST
  • MONGO_PORT
  • MONGO_USER
  • MONGO_PASSWORD
export DB_TYPE=mongodb
export DB_MONGODB_CONNECTION_URL=mongodb://MONGO_USER:MONGO_PASSWORD@MONGO_HOST:MONGO_PORT/MONGO_DATABASE
n8n start

Start with PostgresDB as Database

To use PostgresDB as database you can provide the following environment variables

  • DB_TYPE=postgresdb
  • DB_POSTGRESDB_DATABASE (default: 'n8n')
  • DB_POSTGRESDB_HOST (default: 'localhost')
  • DB_POSTGRESDB_PORT (default: 5432)
  • DB_POSTGRESDB_USER (default: 'root')
  • DB_POSTGRESDB_PASSWORD (default: empty)
export DB_TYPE=postgresdb
export DB_POSTGRESDB_DATABASE=n8n
export DB_POSTGRESDB_HOST=postgresdb
export DB_POSTGRESDB_PORT=5432
export DB_POSTGRESDB_USER=n8n
export DB_POSTGRESDB_PASSWORD=n8n

n8n start

Passing Senstive Data via File

To avoid passing sensitive information via environment variables "_FILE" may be appended to some environment variables. It will then load the data from a file with the given name. That makes it possible to load data easily from Docker- and Kubernetes-Secrets.

The following environment variables support file input:

  • DB_MONGODB_CONNECTION_URL
  • DB_POSTGRESDB_DATABASE_FILE
  • DB_POSTGRESDB_HOST_FILE
  • DB_POSTGRESDB_PASSWORD_FILE
  • DB_POSTGRESDB_PORT_FILE
  • DB_POSTGRESDB_USER_FILE
  • N8N_BASIC_AUTH_PASSWORD_FILE
  • N8N_BASIC_AUTH_USER_FILE

Execute Workflow from CLI

Workflows can not just be started by triggers, webhooks or manually via the Editor it is also possible to execute them directly via the CLI.

Execute a saved workflow by its ID:

n8n execute --id <ID>

Execute a workflow from a workflow file:

n8n execute --file <WORKFLOW_FILE>

Create Custom Nodes

It is very easy to create own nodes for n8n. More information about that can be found in the documentation of "n8n-node-dev" which is a small CLI which helps with n8n-node-development.

To n8n-node-dev

Keyboard Shortcuts

The following keyboard shortcuts can currently be used:

General

  • Ctrl + a: Select all nodes
  • Ctrl + Alt + n: Create new workflow
  • Ctrl + o: Open workflow
  • Ctrl + s: Save current workflow
  • Ctrl + v: Paste nodes
  • Tab: Open "Node Creator". Type to filter and navigate with arrow keys. To create press "enter"

With node/s selected

  • ArrowDown: Select sibling node bellow the current one
  • ArrowLeft: Select node left of the current one
  • ArrowRight: Select node right of the current one
  • ArrowUp: Select sibling node above the current one
  • Ctrl + c: Copy nodes
  • Ctrl + x: Cut nodes
  • d: Deactivate nodes
  • Delete: Delete nodes
  • F2: Rename node
  • Shift + ArrowLeft: Select all nodes left of the current one
  • Shift + ArrowRight: Select all nodes right of the current one

License

Apache 2.0 with Commons Clause

Development

When developing n8n can be started with npm run start:dev. It will then automatically restart n8n every time a file changes.