Skip to content

n8n container setup

Introduction

As a big fan of Node-RED and Apache Hop, it took me a long time to give n8n a try. n8n is an extendable workflow automation tool. With a fair-code distribution model, n8n will always have visible source code, be available to self-host, and allow you to add your own custom functions, logic and apps. n8n’s node-based approach makes it highly versatile, enabling you to connect anything to everything.

Because n8n is one of the few platforms that offers out-of-the-box nodes for QuestDB, and because I wanted to store data from a P1 smartmeter reader in QuestDB, I had a compelling reason to give n8n a try. I might also explore the integration for Home Assistant.

First experiences with n8n

Unfortunately, the first thing you’ll be asked to do is create an n8n account, but you can skip this step if you prefer. Afterward, a user survey screen will appear without a skip button, though it’s worth knowing you don’t have to enter anything there. It’s also important to note that n8n includes paid features like environments and logging.

Despite the option to self-host n8n, I’m beginning to wonder if it might be too commercial for my liking, considering there are already excellent open-source alternatives available. On the other hand, the modern UI is appealing, and I’ve successfully received data from my P1 smartmeter reader via the webhook.

Currently, my gut feeling is that n8n sits somewhere between IFTTT and Node-RED in terms of capabilities and target audience. It can’t really be compared to Apache Hop, which targets BI/ETL and is more focused on (meta) data than on workflow automation and linking services. Nonetheless, I’ll continue exploring n8n’s capabilities and give it a fair chance!

Update 2022-08-09: It takes some getting used to, but n8n works great. It’s particularly nice that you can add test data and use it to try out nodes. Additionally, the expression editor allows you to easily select data from previous steps and even drag data into your expression. Error handling is effective (set this for each flow), and you can monitor the execution of your work through the “Workflow Executions” list.

Setup

  1. Create the folders needed by the container

    Run the following commands inside your home folder:

    # Open your terminal application
    cd ~
    mkdir -p n8n/data
    cd n8n
  2. Create the script needed to run the container

    Save the following script as n8n_run.sh:

    n8n_run.sh
    # To create this script use your text editor application, for example Nano
    docker run -d \
    --name=n8n \
    --hostname=n8n \
    -p 5678:5678 \
    -v $PWD/data:/home/node/.n8n \
    -e N8N_BASIC_AUTH_ACTIVE=true \
    -e N8N_BASIC_AUTH_USER=<username> \
    -e N8N_BASIC_AUTH_PASSWORD=<password> \
    -e GENERIC_TIMEZONE="Europe/Amsterdam" \
    -e TZ="Europe/Amsterdam" \
    --restart unless-stopped \
    n8nio/n8n
    # IMPORTANT: Please read the instructions below
    Instructions:
    • Optional Replace docker with podman if needed
    • Required Replace port number 5678 (on the left side of :) with a port number that is available if needed.
    • Optional Replace $PWD/data with the location of your data if needed. This can be a fileserver mount
    • Optional Remove -e N8N_BASIC_AUTH_ACTIVE=true if you want n8n to be accessible by everyone
    • Optional Replace <username> with your username. Remove this setting if you want n8n to be accessible by everyone
    • Optional Replace <password> with your password. Remove this setting if you want n8n to be accessible by everyone
    • Required Replace Europe/Amsterdam with your own timezone. The GENERIC_TIMEZONE setting is used by for example the Cron-Node
  3. Run the script to create the container

    Run the following command:

    # Open your terminal application
    sudo sh n8n_run.sh

    The image n8nio/n8n is automatically pulled and the container is created.

  4. Check the results

    If needed you can check if the container is running properly.

    Now you can use n8n by opening a web browser and going to: http://localhost:5678. Replace localhost with the relevant IP address or FQDN if needed, and adjust the port if you changed it earlier.

Favorites

Comments

    No comments found for this note.

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

    Copyright 2021- Fiction Becomes Fact