This guide shows a clean, reliable way to run n8n on a Raspberry Pi 4 using Docker Compose.
📝 Note: I want to use this setup primarily for AI workflows (transcription, summarization, RAG, content drafting).
What is n8n?

n8n is an open‑source, self‑hostable workflow automation tool.
You build automations by connecting nodes in a visual editor:
Triggers like webhooks, schedules/cron, IMAP, polling start a workflow; you transform data, branch logic, handle errors, and call services/APIs or databases.
It’s ideal for glue code and recurring tasks without writing and deploying full apps.
🚀 Core Capabilities
What you can build with n8n:
- API & Service Integration: Connect HTTP APIs and webhooks.
- Data Pipelines (ETL): Sync data across files, databases, and SaaS platforms.
- Ops & Incidents: Automated notifications, alerts, and response workflows.
- Internal Tools: Streamline back-office tasks and custom dashboards.
- AI & LLM Orchestration: Build RAG pipelines, transcription/summarization, chatbots, and automated data extraction.
🍓 Raspberry Pi Use Cases
Optimized for local, low-power edge computing:
| Scenario | Scenario | Tools Involved |
|---|---|---|
| Home Monitoring | Ping devices on your LAN; if one is down, send a Telegram/email alert and log to SQLite in the n8n_data volume. | ICMP, Telegram, SQLite |
| Scheduled Backups | Nightly tar selected directories, copy to NAS/S3 via SSH/rclone, and notify on success/failure. | SSH, rclone, S3 |
| Social Content | Poll an RSS feed, find new items, post to Mastodon/Telegram with throttling. | RSS Read, Mastodon API |
| Email Triage | Watch a label via IMAP; create tasks in Notion/Trello/GitHub Issues; include attachments saved under /files. | IMAP, Notion, GitHub |
🤖 Advanced AI Automations
Leveraging Large Language Models (LLMs) on your self-hosted instance:
📧 Smart Email Triage
For new messages, generate summaries and priority labels; draft reply suggestions with an LLM; route high‑priority items to a chat channel.
📂 Local RAG (Retrieval-Augmented Generation)
- Ingest: Watch
/files/docsfor new PDFs. - Process: Generate embeddings and store in a Qdrant container.
- Query: Expose a webhook to answer questions based on your local data.
✍️ Content & Safety
- Auto-Drafting: For each RSS item, have an LLM generate a concise post with hashtags, then publish to Mastodon/Telegram; keep a dedupe key to avoid re-posts.
- Moderation: Redact PII (Personally Identifiable Information) using pattern matching and LLM verification before storage.
Installation
TL;DR / Quick Start
- Check architecture (arm64 preferred):
uname -m # aarch64 -> 64-bit, armv7l -> 32-bit - Create
docker-compose.ymlusing the snippet below. - Set
WEBHOOK_URL,GENERIC_TIMEZONE, andTZfor your locale. - Start:
docker compose up -d - Open:
http://raspi.local:5678(or your Pi’s IP) - Logs:
docker compose logs -f n8n— Stop:docker compose stop
Prerequisites
- Raspberry Pi 4
- Docker and Docker Compose
Check architecture (arm64 is preferred):
uname -m
# aarch64 -> 64-bit, armv7l -> 32-bit
Docker Compose file
Create a docker-compose.yml:
version: "3.8"
services:
n8n:
image: docker.n8n.io/n8nio/n8n
restart: unless-stopped
ports:
- "5678:5678"
environment:
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
- N8N_PORT=5678
- N8N_PROTOCOL=http
- N8N_RUNNERS_ENABLED=true
- N8N_SECURE_COOKIE=false
- NODE_ENV=production
- WEBHOOK_URL=http://raspi.local:5678
- GENERIC_TIMEZONE=Europe/Istanbul
- TZ=Europe/Istanbul
volumes:
- n8n_data:/home/node/.n8n
- ./local-files:/files
volumes:
n8n_data:
Environment variables
N8N_PORT: The port n8n listens on inside the container (mapped to 5678 on the host).N8N_PROTOCOL: http for local/LAN, https when behind a reverse proxy (e.g., Traefik) terminating TLS.WEBHOOK_URL: The externally reachable base URL n8n uses to generate webhooks and OAuth callbacks. Include scheme and port, e.g.,http://raspi.local:5678orhttps://n8n.example.com.N8N_SECURE_COOKIE: Set true when using HTTPS (prevents cookies over insecure transport); keep false for plain HTTP.N8N_RUNNERS_ENABLED: Enables n8n Runners to execute tasks in isolated processes/containers for performance and safety. If not using Runners, set tofalse.N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS: Ensures secure permissions on settings files (helps protect secrets).NODE_ENV: Useproductionfor better performance and fewer dev checks.GENERIC_TIMEZONEandTZ: Time zone for workflows and the container. Keep both aligned (e.g.,Europe/Istanbul).
Volumes
n8n_data: A volume mapped to/home/node/.n8n. n8n saves its SQLite database file and encryption key here../local-files: A local directory shared between the n8n instance and host. In n8n, use the/filespath to read from and write to this directory.
Networking
- This example exposes n8n over HTTP on your LAN and does not use a domain name.
- For HTTPS and a domain, place n8n behind a reverse proxy like Traefik with Let’s Encrypt. Set
N8N_PROTOCOL=httpsandWEBHOOK_URLto your HTTPS URL (e.g.,https://n8n.example.com); let the proxy terminate TLS and route requests to the n8n container.
Start the stack
docker compose up -d
# Visit: http://raspi.local:5678 (or your Pi’s IP)
To see the n8n logs:
docker compose logs -f n8n
To stop the containers:
docker compose stop
Tips
- Replace raspi.local with your Pi’s hostname or IP.
- Updates:
docker compose pull && docker compose up -d - Backups: stop the stack and copy the
n8n_datavolume (contains the SQLite DB and encryption key). - Local files backup: copy the host folder
./local-files(mapped to/filesin n8n) to your backup location. You can copy it live, but stopping workflows avoids partial writes. - HTTPS/domain: run n8n behind Traefik as a reverse proxy with Let’s Encrypt; set
N8N_PROTOCOL=httpsandWEBHOOK_URLto your domain (e.g.,https://n8n.example.com). The proxy handles TLS and forwards 443 traffic to n8n.
Troubleshooting
- Wrong
WEBHOOK_URLor port leads to failing webhooks/OAuth. Use the exact external URL clients will reach. - Permissions on
./local-files: if nodes can’t read/write, ensure the directory exists and is writable by the container user. - Time zone drift: keep
GENERIC_TIMEZONEandTZconsistent to avoid cron/schedule surprises. - 32‑bit OS: the image may pull
arm/v7. Prefer 64‑bit OS for better performance and compatibility.
FAQ
- What port does n8n use by default?
- 5678 inside the container. This guide maps host
5678to container5678.
- 5678 inside the container. This guide maps host
- Do I need HTTPS on my LAN?
- Not strictly, but use HTTPS for remote access or when handling credentials. Put n8n behind a reverse proxy that terminates TLS and set
N8N_SECURE_COOKIE=true.
- Not strictly, but use HTTPS for remote access or when handling credentials. Put n8n behind a reverse proxy that terminates TLS and set
- Where are my workflows and credentials stored?
- In the
n8n_datavolume under/home/node/.n8n(SQLite DB and encryption key).
- In the
- How do I update n8n safely?
docker compose pull && docker compose up -d. Back upn8n_datafirst for rollback safety.
Helpful resources
- Docs home: https://docs.n8n.io/
- Docker deployment guide: https://docs.n8n.io/hosting/installation/docker/
- Community forum: https://community.n8n.io/
- GitHub (releases, issues): https://github.com/n8n-io/n8n
