How to Deploy n8n on an Ubuntu VPS with Docker
A production n8n install on Ubuntu 24.04 using Docker Compose, PostgreSQL and Caddy for automatic TLS — with the encryption key, webhook URL and backup steps most quickstarts leave out.
Automation you own, with the operational details the quickstart skips.
n8n is a workflow automation tool you can run yourself. Nodes connect to APIs, data flows between them, and the whole thing is inspectable — every execution keeps the payload at each step, which makes debugging far easier than in a hosted alternative that shows you a status icon.
Reach for it when a process touches several systems that have APIs and no single one of them is the natural home for the logic. Reach for code instead when the logic is genuinely complex; a workflow with forty nodes and nested branching is a program written in the wrong editor.
The self-hosting story has four settings that decide whether the instance is
production-ready. N8N_ENCRYPTION_KEY, which protects stored credentials and is
not in your database backup. WEBHOOK_URL, without which production webhook URLs
point at localhost. DB_TYPE=postgresdb, because SQLite write contention becomes
the bottleneck sooner than people expect. And TLS, because n8n holds API keys for
everything it integrates with.
On the workflow side, the recurring failure is silent loss. A transient API error fails an execution, the data exists only in the execution log, and nobody notices for a week. Two settings fix it: retry on the nodes that call external systems, and a workflow-level error workflow that writes the raw payload somewhere durable before it alerts.
Everything published here is verified against a self-hosted instance with PostgreSQL storage, and states the n8n version it was run on — the environment variable surface has changed enough between minors to matter.
Start here
A production n8n install on Ubuntu 24.04 using Docker Compose, PostgreSQL and Caddy for automatic TLS — with the encryption key, webhook URL and backup steps most quickstarts leave out.
A reading order that builds n8n knowledge in the sequence it is actually needed.
A production n8n install on Ubuntu 24.04 using Docker Compose, PostgreSQL and Caddy for automatic TLS — with the encryption key, webhook URL and backup steps most quickstarts leave out.
Failure modes that come up repeatedly with n8n, and where each one is solved.
A production n8n install on Ubuntu 24.04 using Docker Compose, PostgreSQL and Caddy for automatic TLS — with the encryption key, webhook URL and backup steps most quickstarts leave out.
A production n8n install on Ubuntu 24.04 using Docker Compose, PostgreSQL and Caddy for automatic TLS — with the encryption key, webhook URL and backup steps most quickstarts leave out.
SQLite is fine for a personal instance with a handful of workflows. PostgreSQL from the start if anything else depends on it — migrating later means exporting and reimporting, and the failure that forces the move is usually mid-incident.
Every stored credential — API keys, OAuth tokens, database passwords. It is not included in a database dump, and losing it means re-entering every integration by hand. Store it separately from the backups.
When a single n8n process can no longer keep up with concurrent executions, which shows up as executions queuing rather than starting. Queue mode adds Redis and separate worker containers.