User Tools

Site Tools


services:n8n

This is an old revision of the document!


n8n

Workflow automation platform.

Access

Item Value
URL https://n8n.home.miskam.xyz
Internal https://n8n.srv.internal
Container CT 111
IP 10.100.161.111:5678

Installation

# Container erstellen
pct create 111 local:vztmpl/debian-12-standard_12.7-1_amd64.tar.zst \
  --hostname n8n \
  --memory 1024 --swap 512 \
  --cores 2 \
  --net0 name=eth0,bridge=vmbr0,tag=160,ip=10.100.161.111/23,gw=10.100.161.254 \
  --features nesting=1 \
  --unprivileged 1 \
  --start 1
 
# Node.js installieren
pct exec 111 -- bash -c '
apt update && apt install -y curl
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt install -y nodejs
'
 
# n8n installieren
pct exec 111 -- npm install -g n8n
 
# PostgreSQL-Datenbank anlegen (auf CT 110)
pct exec 110 -- su - postgres -c "psql" << SQL
CREATE USER n8n WITH PASSWORD 'DB_PASSWORD';
CREATE DATABASE n8n OWNER n8n;
SQL
 
# Systemd Service erstellen
pct exec 111 -- tee /etc/systemd/system/n8n.service << SERVICE
[Unit]
Description=n8n
After=network.target
 
[Service]
Type=simple
User=root
Environment=N8N_HOST=0.0.0.0
Environment=N8N_PORT=5678
Environment=N8N_PROTOCOL=https
Environment=WEBHOOK_URL=https://n8n.home.miskam.xyz/
Environment=DB_TYPE=postgresdb
Environment=DB_POSTGRESDB_HOST=10.100.161.110
Environment=DB_POSTGRESDB_PORT=5432
Environment=DB_POSTGRESDB_DATABASE=n8n
Environment=DB_POSTGRESDB_USER=n8n
Environment=DB_POSTGRESDB_PASSWORD=DB_PASSWORD
Environment=N8N_ENCRYPTION_KEY=ENCRYPTION_KEY
ExecStart=/usr/bin/n8n
Restart=always
 
[Install]
WantedBy=multi-user.target
SERVICE
 
pct exec 111 -- systemctl daemon-reload
pct exec 111 -- systemctl enable --now n8n

Configuration

Variable Description
N8N_ENCRYPTION_KEY Für Credential-Verschlüsselung (einmal setzen, nie ändern!)
WEBHOOK_URL Externe URL für Webhooks
DB_* PostgreSQL-Verbindung

Encryption Key in Vaultwarden gespeichert.

Management

# Status
pct exec 111 -- systemctl status n8n
 
# Logs
pct exec 111 -- journalctl -u n8n -f
 
# Restart
pct exec 111 -- systemctl restart n8n

Backup

Daten in PostgreSQL — siehe PostgreSQL Backup.

services/n8n.1770421583.txt.gz · Last modified: by 127.0.0.1