Self-Host n8n Workflow Automation with InfraPilot
InfraPilot Team
April 1, 2026
Why Self-Host n8n?
n8n Cloud costs $20–50/mo. The self-hosted version is free for unlimited workflows, unlimited executions, and unlimited users. More importantly, your automation logic and the data it processes stays on your infrastructure — not in a third-party SaaS cloud. For automations that touch customer data, invoices, or API keys, this matters.
Prerequisites
- VPS with Docker installed, minimum 1 GB RAM
- InfraPilot installed:
curl -fsSL https://infrapilot.org/install.sh | bash - A subdomain for n8n (e.g.
automation.yourdomain.com)
Step 1 — Create the Compose Stack
mkdir -p ~/apps/n8n && cd ~/apps/n8n
services:
n8n:
image: n8nio/n8n:latest
restart: unless-stopped
environment:
N8N_HOST: automation.yourdomain.com
N8N_PORT: 5678
N8N_PROTOCOL: https
WEBHOOK_URL: https://automation.yourdomain.com
GENERIC_TIMEZONE: Europe/London
DB_TYPE: postgresdb
DB_POSTGRESDB_HOST: db
DB_POSTGRESDB_PORT: 5432
DB_POSTGRESDB_DATABASE: n8n
DB_POSTGRESDB_USER: n8n
DB_POSTGRESDB_PASSWORD: ${DB_PASSWORD}
N8N_BASIC_AUTH_ACTIVE: "true"
N8N_BASIC_AUTH_USER: ${N8N_USER}
N8N_BASIC_AUTH_PASSWORD: ${N8N_PASSWORD}
ports:
- "5678:5678"
volumes:
- n8n_data:/home/node/.n8n
depends_on:
- db
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: n8n
POSTGRES_USER: n8n
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- db_data:/var/lib/postgresql/data
volumes:
n8n_data:
db_data:
Create .env:
DB_PASSWORD=strong-n8n-db-password
N8N_USER=admin
N8N_PASSWORD=strong-n8n-password
docker compose up -d
Step 2 — SSL and Reverse Proxy via InfraPilot
- InfraPilot → Traffic → Proxy Hosts → Add Proxy Host
- Domain:
automation.yourdomain.com - Forward host:
n8n, port:5678 - Enable WebSocket support — n8n's editor uses WebSockets for live execution updates
- Enable Let's Encrypt SSL and force HTTPS
n8n also uses webhooks to receive data from external services. The WEBHOOK_URL environment variable tells n8n its public URL so it can generate correct webhook URLs for your workflows. Make sure this matches the domain you set in InfraPilot.
Step 3 — Log In and Build Workflows
Visit https://automation.yourdomain.com, log in with your basic auth credentials, and you'll see the n8n workflow editor. Connect it to Slack, GitHub, Google Sheets, Stripe, Airtable, or any of n8n's 400+ integrations.
Useful Automations to Start With
- New GitHub PR → Slack notification — never miss a review request
- New Stripe payment → update a Google Sheet — lightweight revenue tracking
- InfraPilot webhook alert → PagerDuty — route infrastructure alerts to your on-call system
- Scheduled database backup → upload to S3 — automated DR for self-hosted databases
Monitoring n8n with InfraPilot
n8n execution queues can pile up if a workflow is waiting on a slow external API. Watch the n8n container's CPU and memory in InfraPilot — if memory climbs steadily, check for stuck workflows in the n8n Executions log. Set a restart policy and an InfraPilot alert to notify you if the container restarts unexpectedly.
Related posts
Letting an AI Assistant Deploy for You, Safely
AI assistants are good at ops work, but you do not want a model wired straight to production. Preview-only API keys let an assistant build and tear down disposable environments while production stays off limits.
Preview Environments for Every Branch, on Your Own Box
Reviewing a diff only gets you so far. Preview environments give every branch a live URL on your own servers, with wildcard SSL and automatic teardown, so reviewers click instead of imagine.
Running Docker Across Three Servers Without Kubernetes
One server is easy and Kubernetes is a lot. Fleet is the middle path: run Docker across several servers with a scheduler, replicas, self-healing, and a private mesh, and no cluster to operate.