✓ 99.9% UPTIME ✓ 24/7 SUPPORT ✓ SINCE 2016 Status Looking Glass +92 312 6565434
Automation · 2026-11-21 · Zain Ul Abddin

Self-hosting n8n: the setup that survives real workloads

Docker Compose, Postgres instead of SQLite, queue mode when volume grows, HTTPS, backups and the limits that bite at scale.

Automation workflows on a monitoring wall

n8n is the automation tool most of our clients ask for: visual workflows, hundreds of integrations, and no per-task bill. Self-hosting it is easy; self-hosting it well is a short list of decisions that decide whether it runs for a year or falls over in month three.

Start with Postgres, not SQLite

The default SQLite database is fine for testing and wrong for production: concurrent workflow writes lock, and backups are less predictable. Point n8n at Postgres from day one — migrating later is possible but tedious.

docker run -d --name n8n-db -e POSTGRES_USER=n8n \
  -e POSTGRES_PASSWORD=change-me -e POSTGRES_DB=n8n \
  -v /srv/n8n/db:/var/lib/postgresql/data postgres:16

Compose, with a real volume

Keep workflows, credentials and binary data on a named volume outside the container. Without it, a rebuild wipes your work.

services:
  n8n:
    image: docker.n8n.io/n8nio/n8n
    restart: unless-stopped
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=n8n-db
      - N8N_HOST=automation.example.com
      - WEBHOOK_URL=https://automation.example.com/
      - GENERIC_TIMEZONE=Asia/Karachi
    volumes:
      - /srv/n8n/data:/home/node/.n8n
    ports: ["127.0.0.1:5678:5678"]

Bind to localhost and put nginx or Caddy in front. Never expose 5678 directly — the editor is an admin surface.

HTTPS and basic hardening

Use a real certificate, force HTTPS, and enable n8n's user management. If the instance is only for your team, put it behind an IP allowlist or a VPN instead of the open internet. Rotate the encryption key only with a backup in hand: losing it makes stored credentials unreadable.

When to switch to queue mode

Single-process n8n is fine for dozens of executions a day. When you hit slow UI, long-running HTTP calls blocking other workflows, or webhook bursts, move to queue mode with Redis and one or more workers. That is also the point where a 4 GB box stops being enough.

Backups that matter

Two things: the Postgres dump and the /home/node/.n8n volume (credentials, encryption key). Back up both, and test restoring into a scratch container. A workflow export is not a backup — it misses credentials.

What we install

Docker, Postgres, n8n with a persistent volume, Caddy/nginx with HTTPS, a systemd or restart policy, log rotation and a nightly dump. Specs and the handover checklist are on the n8n page; a 2 GB VPS handles a small team, 4 GB is the comfortable floor once workflows multiply.

Questions from readers

Can n8n run on 2 GB RAM?

Yes for a small team with light workflows. Move to 4 GB when you add queue mode or many concurrent executions.

Do I need Redis?

Only for queue mode, when you split the main process and workers. Single-process installs do not need it.

How do I back up n8n?

Dump the Postgres database and copy the .n8n volume, which holds credentials and the encryption key.

Need this set up for you?

Managed VPS and Windows RDP from $12.50/mo, with the stack installed before handover.

Chat on WhatsApp See prices