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
The Best Self-Hosted Docker Dashboards in 2026 (Honestly Compared)
Portainer, Dockge, Yacht, Lazydocker, InfraPilot — there are more Docker management UIs than ever. Here's an honest breakdown of which one fits which use case, from CLI-lovers to teams that want a full web dashboard.
Nginx Proxy Manager vs InfraPilot: Is There a Better Alternative?
Nginx Proxy Manager is the most popular Docker reverse proxy GUI — but it only manages proxies and SSL. If you're already running Docker containers, there's a case for combining your proxy management with your container dashboard.
Portainer vs InfraPilot: The Honest Docker Management Comparison (2026)
Portainer is great — but it doesn't manage Nginx, SSL, or give you traffic analytics. Here's an honest comparison of when to use Portainer, when to use InfraPilot, and what actually matters for single-server Docker setups.