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.
- Set
N8N_ENCRYPTION_KEYin production.env(store in Bitwarden). - Never run the main
n8ncontainer as root — use the image default user (node). Execute Command runs in that container as UID 1000. - Do not recreate the
n8n_datavolume 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-stoppedonn8nand 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
n8nto 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”:
- Set on runner containers (not only main
n8n): N8N_RUNNERS_MAX_OLD_SPACE_SIZE=24576(default; override via env) — used by the launcher for the JS runner processNODE_OPTIONS=--max-old-space-size=${N8N_RUNNERS_MAX_OLD_SPACE_SIZE}— same heap for the child process- Keep runner
mem_limitabove that heap (compose default28g). - Main
n8n: heap default12288MB (N8N_NODE_MAX_OLD_SPACE_SIZE),mem_limitdefault16g. - 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.