VPS Hosting for n8n
Self-host n8n workflow automation on budget VPS infrastructure (Hetzner, DigitalOcean) with Docker, persistent databases, and zero task execution caps.
The Goal:
"Self-hosted n8n instance running 24/7 on dedicated VPS with unlimited workflow executions and persistent database"
Self-hosting n8n on an affordable VPS is one of the highest-ROI infrastructure decisions an automation team can make. While n8n Cloud charges $20 to $120+ per month with strict execution caps, self-hosting n8n on a $4 to $10/month VPS gives you unlimited workflow runs, custom community nodes, and local data residency.
Sizing and System Requirements
- **Minimum:** 1 vCPU, 2 GB RAM (good for light testing).
- **Recommended Production:** 2 vCPU, 4 GB RAM with NVMe SSD (e.g. Hetzner CX22 for ~€3.79/mo).
- **Database:** Always pair n8n with PostgreSQL in production. The default SQLite database is suitable only for local prototyping and will suffer from concurrency locks under heavy webhook volume.
Operational Responsibilities
When self-hosting, you own the uptime and security of your instance. Essential maintenance includes enabling execution data pruning, scheduling automated PostgreSQL dumps to remote S3 storage, and firewalling unused ports.
verifiedBest Practices
Use External PostgreSQL Over SQLite
For production workloads with frequent triggers, always configure PostgreSQL rather than default SQLite to prevent database locks.
Prune Execution History Periodically
Configure EXECUTIONS_DATA_PRUNE=true and EXECUTIONS_DATA_MAX_AGE=168 (7 days) to keep disk space under control.
warningCommon Mistakes
Underprovisioning RAM
Running n8n on a 1 GB RAM VPS causes out-of-memory container crashes during concurrent webhook triggers.
Provision at least 2 GB (preferably 4 GB) of RAM.
Exposing Unencrypted HTTP Webhooks
Running webhooks over plain HTTP exposes API credentials and payload data in transit.
Always terminate SSL via reverse proxy (Caddy, Traefik, or Cloudflare).
Your Action Roadmap
Check off steps as you go to track your momentum.
1. Server Provisioning
Launch an unmanaged Ubuntu Linux VPS with adequate compute for concurrent automation runs.
Expected Result
Fresh Ubuntu 24.04 server with 2 vCPUs and 4 GB RAM.
Pro Tip
Hetzner CX22 (€3.79/mo) or DigitalOcean $6/mo Droplet provide ample power for tens of thousands of daily workflows.
2. Install Docker & Compose
Set up the container runtime engine on the host server.
Expected Result
Docker and docker-compose plugin installed and enabled as a systemd service.
Pro Tip
Use the official Docker convenience script: curl -fsSL https://get.docker.com | sh.
3. Configure PostgreSQL & n8n Compose
Set up production-grade state persistence and execution history pruning.
Expected Result
Production docker-compose.yml running n8nio/n8n alongside PostgreSQL 16.
Pro Tip
Always configure EXECUTIONS_DATA_PRUNE=true and EXECUTIONS_DATA_MAX_AGE=168 to prevent runaway disk usage.
4. Reverse Proxy & SSL Termination
Expose secure HTTPS webhooks to external services like Stripe, Slack, and OpenAI.
Expected Result
Automated Let's Encrypt certificate issuance on your custom domain.
Pro Tip
Set WEBHOOK_URL=https://n8n.yourdomain.com in environment variables so webhook URLs are correctly formatted.
The Ultimate Starter Stack
Don't want to overthink it? Use this battle-tested combination of tools.
Docker Compose on VPS Stack
alt_routeDirect root control without intermediate control planes.
Tech Stack
Custom Stack Explorer
Prefer to build your own stack? Browse all 6 curated tools for this goal.
Recommended AI Tools
6 tools found
Railwayverified
Modern infrastructure PaaS for containers, microservices, and persistent AI background workers
Coolifyverified
Self-hosted open-source PaaS and Vercel/Heroku alternative for any Linux server
Dokployverified
Lightweight open-source Docker deployment software and control plane for self-hosters
Hetznerverified
High-performance, low-cost European and US cloud VPS servers with massive bandwidth
DigitalOceanverified
Developer-friendly cloud infrastructure with Droplets, App Platform, and 1-click marketplaces
Hostingerverified
Budget KVM VPS hosting with hPanel control panel, Docker templates, and AI assistant
Ready-to-Use Prompts
Copy and paste these exact prompts into your AI tools to get immediate results.
Production n8n Compose Template
// Production n8n Compose Template
Generate a production docker-compose.yml file for n8n with PostgreSQL 16, persistent volumes, environment pruning, and automated Caddy reverse proxy.Pro Tip: Set N8N_ENCRYPTION_KEY explicitly to avoid losing credential encryption on rebuild.
Frequently Asked Questions
Between $4 and $10/month. The n8n Community Edition is free and open-source. You only pay for the VPS server (e.g. Hetzner at ~€3.79/mo or DigitalOcean at $6/mo).
A 2 vCPU / 4 GB RAM VPS on Hetzner can easily process tens of thousands of workflow executions daily when backed by PostgreSQL with execution pruning enabled.
You are responsible for periodic VPS security updates (apt upgrade), database backups (Postgres pg_dump), and monitoring disk space.
Explore More Goals
Keep Discovering AI
Follow AIToolsHaven for new AI tools, workflows and useful AI resources.