Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk11 min

Self-hosted n8n

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Self-hosted n8n lets you run automation workflows on your own infrastructure instead of relying on a managed service. That means more control over data, credentials, network access, and cost—plus the ability to tailor performance for your exact workload.

This guide is written for real deployments: choosing the right setup, wiring persistence, securing access, tuning production settings, and handling upgrades without surprises.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What Self-Hosted n8n Is (and Why It Matters)

n8n is an automation platform that executes workflows via a web UI and an HTTP API. When you self-host, you run the n8n server, its supporting services (like a database and optionally Redis), and your reverse proxy on your own machines or cloud.

Typical reasons teams self-host include compliance, private data handling, air-gapped environments, predictable latency, and avoiding per-run pricing. The tradeoff is operational responsibility—patching, backups, and uptime management.

Prerequisites and Planning Checklist

Decide how you’ll run it

Before installing, pick a deployment method: Docker (fastest), Docker Compose (for a clean multi-service stack), native Linux (if you prefer OS packages), or Kubernetes (if you already run it there).

Confirm system requirements

Exact needs depend on workflow volume and concurrency. A common starting point for a small-to-medium deployment is:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • CPU: 2+ vCPU
  • RAM: 4–8 GB (more for heavy queues or many concurrent executions)
  • Storage: enough for n8n data, workflow history, and file downloads; plan for growth
  • Network: inbound HTTPS to the n8n UI, outbound internet if integrations require it

Have these details ready

  • A domain name (example: automation.example.com) and a plan for TLS
  • Your preferred DNS method (A/AAAA records or wildcard)
  • Where you’ll store persistent data (Postgres is typical)
  • Credential handling approach (environment variables, secret manager, or .env for dev)

Choose Your Deployment Method

All methods can work, but each fits different operational styles. The “right” choice is usually the one you can maintain reliably.

Method Best for Effort Scalability Persistence setup
Docker Most teams and proof-of-concepts Low Good (with queue mode) Moderate (DB/volume wiring)
Docker Compose Single server with DB/Redis/Reverse proxy Low–Medium Good Easy (one repo config)
Native Linux Teams avoiding containers Medium Good with careful tuning Depends on your stack
Kubernetes Already running K8s High Excellent (replicas + autoscaling) Usually best practice with PVC

Method 1: Self-host with Docker (Recommended for Most Users)

Docker is the fastest path to a working self-hosted n8n. The version choice matters: pin n8n to a specific image tag so upgrades are intentional.

1) Pull and run n8n (dev-friendly)

Create a local directory for persistent data (workflows, credentials, and any local storage you use). Then run the container.

  1. mkdir -p ~/n8n
  2. docker volume create n8n_data
  3. docker run --rm -it \ -p 5678:5678 \ -v n8n_data:/home/node/.n8n \ n8nio/n8n:1.60.3

Visit http://localhost:5678. The first run usually prompts for setup (admin user and initial settings depending on your version).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2) Add a real database for production

For production, avoid relying only on container-local persistence. Use a Postgres database and configure n8n to use it.

Docker run example (Postgres assumed reachable at postgres:5432 from the container network):

  1. docker network create n8n_net
  2. Run Postgres on the same network (example): docker run -d --name postgres --network n8n_net -e POSTGRES_PASSWORD=strongpass -e POSTGRES_USER=n8n -e POSTGRES_DB=n8n postgres:16
  3. Run n8n with Postgres env vars:

Example:

docker run -d \ --name n8n \ --network n8n_net \ -p 5678:5678 \ -v n8n_data:/home/node/.n8n \ -e DB_TYPE=postgres \ -e DB_POSTGRESDB=n8n \ -e DB_POSTGRESUSER=n8n \ -e DB_POSTGRES_PASSWORD=strongpass \ -e DB_POSTGRES_HOST=postgres \ n8nio/n8n:1.60.3

Method 2: Self-host with Docker Compose (Opinionated Multi-Service Setup)

Docker Compose is a practical default when you need Postgres and optionally Redis for queue mode. It also makes upgrades and rollbacks easier because everything is versioned in one file.

Recommended compose file

Create docker-compose.yml:

services: postgres: image: postgres:16 environment: POSTGRES_USER: n8n POSTGRES_PASSWORD: strongpass POSTGRES_DB: n8n volumes: - postgres_data:/var/lib/postgresql/data networks: - n8n redis: image: redis:7 command: ["redis-server", "--appendonly", "yes"] volumes: - redis_data:/data networks: - n8n n8n: image: n8nio/n8n:1.60.3 ports: - "5678:5678" environment: # Core - DB_TYPE=postgres - DB_POSTGRESDB=n8n - DB_POSTGRESUSER=n8n - DB_POSTGRES_PASSWORD=strongpass - DB_POSTGRES_HOST=postgres # Queue mode (optional but common) - EXECUTIONS_MODE=queue - QUEUE_BULL_REDIS_HOST=redis - QUEUE_BULL_REDIS_PORT=6379 # Make sure n8n can generate correct URLs behind a proxy # (adjust these when you add a reverse proxy) - N8N_HOST=automation.example.com - N8N_PROTOCOL=https volumes: - n8n_data:/home/node/.n8n depends_on: - postgres - redis networks: - n8n

volumes: postgres_data: redis_data: n8n_data:

networks: n8n:

Run it

  1. docker compose up -d
  2. Check logs: docker compose logs -f n8n
  3. Open https://automation.example.com once you set up TLS (or use http://localhost:5678 while testing)

Method 3: Self-host with Native Install on Linux (Debian/Ubuntu)

If you prefer not to use Docker, you can still self-host on a Linux host. Native installs require more discipline around Node.js runtime versions, file permissions, and service management.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

1) Install prerequisites

  1. Update packages: sudo apt-get update
  2. Install Node.js runtime (n8n requires supported Node versions; verify your n8n release notes)
  3. Install npm: node -v and npm -v should both show installed versions

2) Install n8n as a service

In practice, teams often use either the official installation method from the n8n docs or a process manager like systemd. The critical production requirement is to run a fixed version and pin dependencies.

Common approach:

  1. npm i -g [email protected] (pin a version)
  2. Create an /etc/n8n directory and lock down permissions
  3. Create a systemd unit that runs n8n with environment variables for DB and queue mode

Because native setup varies heavily by distro and admin preference, confirm the exact environment variables supported by your n8n version before cutting over.

Method 4: Self-host on Kubernetes

Kubernetes is a good fit when you need autoscaling, multiple workers, and standardized deployments. n8n can run as a single pod, or you can separate “web” and “worker” responsibilities using queue mode.

Core Kubernetes components

  • Deployment for n8n
  • Service for stable networking
  • Ingress for TLS termination (or use a managed gateway)
  • Database (Postgres) and optionally Redis

Production pattern: queue mode + multiple replicas

Set EXECUTIONS_MODE=queue and configure Redis. Then scale the n8n worker deployment by replica count while keeping your web exposure controlled by Ingress.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make sure your n8n configuration uses stable DNS names (Kubernetes services), not pod IPs.

Networking, TLS, and Domain Setup

Your users need a stable URL for webhook targets and OAuth callbacks. If you’re behind a reverse proxy, configure n8n so generated links and webhook URLs match your public domain.

Set n8n host and protocol

In Docker Compose, the environment variables N8N_HOST and N8N_PROTOCOL are commonly used. Example:

  • N8N_HOST=automation.example.com
  • N8N_PROTOCOL=https

Reverse proxy basics

Use a reverse proxy like Nginx or Traefik. Route automation.example.com to container port 5678. Ensure websockets are supported if your proxy requires explicit upgrade headers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Also confirm webhook base URLs in n8n UI so external services can call back reliably.

Data Persistence: Databases, Credentials, and File Storage

n8n stores workflows, execution history, and credentials. How you persist that data is the difference between a stable production system and a fragile sandbox.

Database persistence

Use Postgres for production. Avoid “ephemeral” container storage unless you’re okay restoring from snapshots.

When queue mode is enabled, Redis handles job queues; Postgres remains the system of record for most workflow state.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Files and attachments

Some integrations download files during execution. If you upload or handle large payloads, confirm where your n8n instance stores temporary files and ensure disk capacity won’t run out mid-execution.

Common production practice is to mount a dedicated volume (or configure an external storage approach) if your workflows move large files.

Security Hardening: Auth, IP Controls, and Secret Management

Self-hosting means you’re responsible for access control. Treat the n8n UI as an admin surface, and protect it like you would a source code server.

Lock down the web UI

  • Require authentication (n8n defaults typically include an admin login flow; verify it after first setup)
  • Restrict public access using firewall rules (allow only your office/VPN IP ranges)
  • If exposed to the internet, enable TLS and use strong passwords

Store secrets outside the container image

Use environment variables injected at runtime or secret managers provided by your platform. Avoid committing credentials in docker-compose.yml.

Examples of secrets include:

  • Database passwords
  • Webhook signing secrets
  • SMTP credentials
  • OAuth client IDs and client secrets

Use least-privilege credentials in workflows

n8n credentials are powerful. For production, create dedicated service accounts for integrations (email, Slack, GitHub, eBay APIs, etc.) instead of using personal tokens.

Production Configuration: Queue Mode, Worker Scaling, and Resource Limits

Queue mode is the main lever for handling concurrency without timing out requests. It decouples workflow execution from the UI request lifecycle.

Enable queue mode

Set EXECUTIONS_MODE=queue and configure Redis connection parameters.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In Compose:

- EXECUTIONS_MODE=queue

- QUEUE_BULL_REDIS_HOST=redis

- QUEUE_BULL_REDIS_PORT=6379

Scale workers safely

When queue mode is enabled, scaling n8n replicas can increase throughput. Start with 2 replicas, monitor CPU/RAM, and increase gradually.

  • Set CPU and memory limits in Docker or Kubernetes
  • Monitor queue depth and execution latency
  • Prevent thundering herds by capping concurrency in workflows where possible

Resource sizing tips

  • If your workflows call many external APIs, network latency dominates—scale workers rather than CPU first.
  • If you process large files, disk IO and memory become bottlenecks—watch node heap usage and disk utilization.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Upgrades and Version Management

Upgrading n8n is usually straightforward, but treat it like a release: pin the target version, test workflows, then roll out carefully.

Pin versions

Use an explicit image tag (for Docker) like n8nio/n8n:1.60.3. Avoid latest in production.

Upgrade workflow (safe approach)

  1. Take a database backup (and Redis persistence snapshot if you’re using it)
  2. Deploy the new version to a staging instance with a copy of configs (or run with read-only workflows)
  3. Verify webhooks, OAuth callbacks, and critical scheduled workflows
  4. Roll out to production during a maintenance window
  5. Watch logs for 30–60 minutes after cutover

Backups, Disaster Recovery, and Monitoring

Backups are the only realistic way to recover from bad deployments, broken workflows, or accidental deletions.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Back up what matters

  • Postgres: workflows, credentials metadata, execution history
  • n8n data volume: any local storage you rely on
  • Redis: job queues (recovery depends on your queue durability settings)

Monitoring to set up immediately

  • Container health (uptime, restarts)
  • CPU/RAM saturation
  • Disk usage
  • Execution failures rate and queue depth
  • Reverse proxy errors (502/504) for connectivity issues

Log access

Logs should be centralized in production. At minimum, keep docker compose logs accessible and retain them long enough to diagnose failed runs.

Troubleshooting Playbook

When self-hosted n8n fails, it’s usually one of: database connectivity, wrong public URL settings, webhook reachability, or resource exhaustion.

Problem: n8n container starts but UI won’t load

  • Verify port mapping: -p 5678:5678
  • Check logs: docker logs n8n --tail 200
  • If behind a proxy, confirm automation.example.com routes to 5678

Problem: workflows can’t access the database

  • Confirm DB host matches your network name (e.g., postgres in Compose)
  • Validate credentials and database name
  • Check Postgres readiness—avoid starting n8n before Postgres is accepting connections

Problem: webhooks fail or callbacks hit the wrong URL

  • Set N8N_HOST and N8N_PROTOCOL correctly
  • Confirm webhook URL in the workflow points to your public domain, not localhost
  • Check firewall rules: inbound must allow the third-party service to reach your reverse proxy

Problem: executions queue grows without completing

  • Confirm Redis connectivity and correct ports (QUEUE_BULL_REDIS_PORT=6379)
  • Check worker replica count (queue mode needs running execution processes)
  • Look for rate limits or external API errors inside workflow execution logs

Problem: OAuth or integrations fail with redirect errors

  • Validate redirect/callback URLs in the integration settings match your n8n public URL
  • Ensure TLS is enabled if the OAuth provider expects https
  • Confirm your reverse proxy doesn’t strip headers required for auth flows

Common mistakes that waste hours

  • Using ephemeral storage for production data
  • Leaving latest in image tags and getting unexpected breaking changes
  • Forgetting to configure N8N_HOST/N8N_PROTOCOL behind HTTPS proxies
  • Exposing the UI directly to the internet without IP restrictions
  • Under-sizing workers and expecting long workflows to finish instantly

FAQ

Do I need Redis if I’m not using queue mode?

No. If you run in default execution mode (not queue), Redis isn’t required for job queueing. If you enable EXECUTIONS_MODE=queue, Redis becomes part of the critical path.

What’s the safest production starting point?

Most teams start with Docker Compose: Postgres for persistence and queue mode with Redis for concurrency. Pin all image tags, add TLS via a reverse proxy, then monitor queue depth and failures.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I upgrade without losing workflows?

Back up Postgres first, pin the target n8n version, test in staging, then roll out to production. Verify that webhooks and OAuth callbacks still resolve to the correct public domain.

Can I run n8n behind a load balancer?

Yes, but you must ensure webhook and UI URLs are consistent (use N8N_HOST and N8N_PROTOCOL). With queue mode, multiple replicas can work well; keep sticky sessions in mind only if your reverse proxy or auth flow requires it.

Is self-hosted n8n good for webhooks with third-party integrations?

It can be excellent, as long as your DNS, TLS, and webhook URLs are correct and reachable. A misconfigured public URL is the most common reason external services report 404/timeout errors.

Bottom Line

Self-hosted n8n is a strong choice when you need control over data, integrations, and execution performance. The winning setup for most teams is Docker Compose with pinned n8n versions, Postgres persistence, and queue mode with Redis.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Plan your domain/TLS early, secure the UI like an admin panel, and treat upgrades as releases. If you do those basics well, n8n becomes a dependable automation backbone instead of an operational chore.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.