Docker - n8n Workflow Automation Container Setup


As a big fan of Node-RED and Apache Hop, it took me a long time to give n8n a try. But because n8n is one of the few that has out-of-the-box nodes for QuestDB and because I wanted to store data from a P1 smartmeter reader in QuestDB, I had a good reason to give n8n a try. And maybe I’ll also take a look at the integration for Home Assistant…

QuestDB is by the way an alternative to InfluxDB and I wanted to give it a try too. I’m aware that QuestDB has support for the InfluxDB line protocol, among other things, which also works great with Node-RED and Apache Hop, but as said before, I wanted a reason to finally try n8n! At the bottom are my first experiences described.

Installation

Here I describe the installation of the Docker n8n container. I run this Docker container on a Ubuntu VM that runs via [[ Proxmox VE ]]. I perform the following on the CLI.

Docker pull command:

docker pull n8nio/n8n

Within my home folder I have created a Docker folder where I create a subfolder for each container:

cd ~
mkdir -p docker/n8n
cd docker/n8n

Also create folders where the data can be stored:

mkdir data

Now create a shell script with Nano:

sudo nano n8n_run.sh

With this shell script we are going to create the container. Copy the following into n8n_run.sh:

docker run -d \
 --name=n8n \
 --hostname=n8n \
 -p 5678:5678 \
 -v $PWD/data:/home/node/.n8n \
 -e TZ="Europe/Amsterdam" \
 -e GENERIC_TIMEZONE="Europe/Amsterdam" \
 -e N8N_BASIC_AUTH_ACTIVE=true \
 -e N8N_BASIC_AUTH_USER=MY_USER \
 -e N8N_BASIC_AUTH_PASSWORD=MY_PASSWORD \
 --restart unless-stopped \
 n8nio/n8n

If necessary, adjust the following:

-p 5678:5678
Choose a port that is still available. Check this with netstat

-v $PWD/data:/data
Choose the location for the data. In this example it is the data map we created

-e TZ=Europe/Amsterdam
Pick the right timezone. This is the system timezone which controls what some scripts and commands return like $ date

-e GENERIC_TIMEZONE=”Europe/Amsterdam
*Pick the right timezone. This is used by for example the Cron-Node.

(OPTIONAL) -e N8N_BASIC_AUTH_ACTIVE=true
By default n8n can be accessed by everybody but you can use this environment variable to make sure that access to n8n is protected

(OPTIONAL) N8N_BASIC_AUTH_USER=MY_USER
Replace MY_USER with you own username if you have activated protection via basic-auth

(OPTIONAL) N8N_BASIC_AUTH_PASSWORD=MY_PASSWORD
Replace MY_PASSWORD with you own password if you have activated protection via basic-auth

Exit Nano with CTRL-X and save the changes.

Start the container:

sudo sh n8n_run.sh

Check if the container is running properly.

Using n8n

n8n can now be accessed via the following URL:

http://<IP DOCKER HOST>:5678/

See also my notes about updating containers with Portainer or via the CLI. With Synology’s Docker Application, updating a container is also very easy.

First experiences with n8n

Unfortunately, the first thing you will be asked is to create a n8n account, but you can skip this if you want. Then an user survey screen will appear without a skip button, but it might be good to know that you don’t have to enter anything there. It is also good to know that there are also paid features like environments and logging. Despite being able to host n8n myself, I’m starting to wonder if n8n isn’t too commercial for me. There are already excellent open-source alternatives that you can use. But on the other hand, the modern UI is interesting and the webhook has already successfully received data from my P1 smartmeter reader.

At this time my gut feeling is that n8n is somewhere between IFTTT and Node-RED in terms of capabilities and target audience. And you can’t really compare n8n with Apache hop. Apache Hop has BI/ETL as its target audience and is more focused on (meta) data than on workflow automation and linking services. But I will continue to explore the possibilities of n8n and try to give it a chance!

Update 2022-08-09: It takes some getting used to but n8n works great! For example it is very nice that you can add test data and use it to try out nodes. Furthermore, with the expression editor you can easily select data from previous steps and even drag data into your expression. Error handling works also very well (set this for each flow) and you can keep an eye on the execution of your work by consulting the “Workflow Executions” list.


Read other notes

Comments

    No comments found for this note.

    Join the discussion for this note on this ticket. Comments appear on this page instantly.

    Tags


    Notes mentioning this note

    • Docker - QuestDB Container Setup
      QuestDB is a high-performance, open-source SQL database. QuestDB’s stack is engineered from scratch, zero-GC Java and dependency-free. It includes endpoints...

    Notes Graph