Skip to content

n8n

n8n is used for workflow automation and integration tasks.

  • Service Name: n8n
  • Default Port: 5678
  • URL: https://n8n.lage-beauty.de/
  • Credentials: Stored in Bitwarden (or configured via environment variables)
  • Cursor MCP: n8n MCP + Cursor — instance-level MCP for workflow search/build/trigger from the IDE

Encryption key (required)

n8n encrypts stored credentials with N8N_ENCRYPTION_KEY. If the key changes, every credential fails with bad decrypt.

  1. Set N8N_ENCRYPTION_KEY in production .env (store in Bitwarden).
  2. Never run the main n8n container as root — use the image default user (node). Execute Command runs in that container as UID 1000.
  3. Do not recreate the n8n_data volume without the same key.

Shared invoices volume permissions are fixed on service-invoice startup (root:1000, 2775) so n8n can mkdir under /home/node/.n8n-files/invoices/.

Restart & health

Compose (docker-compose.yml / docker-compose-portainer.yml) sets:

  • restart: unless-stopped on n8n and task runners
  • n8n healthcheck: GET http://127.0.0.1:5678/healthz
  • runners healthcheck: GET http://127.0.0.1:5680/healthz (launcher; idle runners wait for task offers — that is normal)
  • runners wait for n8n to be healthy before starting

Task runner memory

Code / Python nodes run in external runners (n8nio/runners). If a node fails with “Increase the memory available to the task runner with N8N_RUNNERS_MAX_OLD_SPACE_SIZE:

  1. Set on runner containers (not only main n8n):
  2. N8N_RUNNERS_MAX_OLD_SPACE_SIZE=24576 (default; override via env) — used by the launcher for the JS runner process
  3. NODE_OPTIONS=--max-old-space-size=${N8N_RUNNERS_MAX_OLD_SPACE_SIZE} — same heap for the child process
  4. Keep runner mem_limit above that heap (compose default 28g).
  5. Main n8n: heap default 12288 MB (N8N_NODE_MAX_OLD_SPACE_SIZE), mem_limit default 16g.
  6. Redeploy / recreate the runner containers (not only main n8n), then retry. For huge item batches, also split with a Loop node.

Portainer will show unhealthy and Docker will restart exited containers. Pair with Uptime Kuma on https://n8n.lage-beauty.de/healthz for alerts.

Recover the key from the volume (if still intact):

docker exec n8n cat /home/node/.n8n/config

Copy encryptionKey into .env as N8N_ENCRYPTION_KEY, redeploy n8n only (not a fresh n8n_data volume).

If the config was overwritten and you have no backup, re-enter credentials in the n8n UI manually.