Skip to content

n8n

n8n is a workflow automation platform that allows you to automate tasks and integrate various services together.

Linux Updates Dashboard

Prepare

Pull the image

podman pull docker.io/n8nio/n8n:latest

Create directories to store variables and persistent container data

mkdir -p $HOME/apps/{variables,container_data}

Create files to store variables and persistent container data

touch $HOME/apps/variables/n8n.env
mkdir -p $HOME/apps/container_data/n8n

Edit environment file

Edit the environment file and paste your default values for this service:

nano $HOME/apps/variables/n8n.env

Save the result for N8N_ENCRYPTION_KEY

openssl rand -base64 32

Example contents:

GENERIC_TIMEZONE=Europe/Athens
TZ=Europe/Athens
N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
N8N_RUNNERS_ENABLED=true
DB_TYPE=postgresdb
DB_POSTGRESDB_DATABASE=n8n
DB_POSTGRESDB_HOST=10.0.0.77
DB_POSTGRESDB_PORT=5432
DB_POSTGRESDB_USER=n8n
DB_POSTGRESDB_PASSWORD=password
WEBHOOK_URL=http://n8n.skynet.lan/
N8N_HOST=n8n.skynet.lan
N8N_SECURE_COOKIE=false
N8N_ENCRYPTION_KEY=change_me_with_random_key

Installation

Create .container in home folder

touch $HOME/.config/containers/systemd/n8n.container

Edit the file and paste this content

# n8n.container
[Unit]
Description=n8n

[Container]
ContainerName=n8n
HostName=n8n
AutoUpdate=registry
Image=docker.io/n8nio/n8n:latest
Network=skynet.network

EnvironmentFile=%h/apps/variables/n8n.env
Volume=%h/apps/container_data/n8n:/home/node/n8n

[Service]
Restart=always
TimeoutStartSec=300

[Install]
WantedBy=default.target
Reload systemd user daemons & start the container.

systemctl --user daemon-reload
systemctl --user start n8n
systemctl --user status n8n

Configuration of Nginx (Reverse Proxy)

Create nginx conf.

touch $HOME/apps/container_data/nginx/n8n.conf

Configuration for nginx conf for port 80.

server {
    listen 80;
    server_name n8n.skynet.lan;

    location / {
        proxy_pass http://n8n:5678/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 3600s;
        proxy_send_timeout 3600s;
        client_max_body_size 50M;
    }
}

Future Enhancement

SSL/HTTPS configuration should be added for production deployments.

Restart Nginx

systemctl --user restart nginx

Usage

Access with url in server_name of nginx configuration file.

e.g http://n8n.skynet.lan

Troubleshooting

Common issues and solutions.

Check Quadlet syntax.

/usr/lib/systemd/system-generators/podman-system-generator

Check service status & logs

systemctl --user status n8n
podman ps
podman logs -f n8n