Deploying Self-Hosted n8n on a VPS with Docker: Production Architecture Guide
The Case for Self-Hosting Your Automation Engine
SaaS automation providers charge based on workflow runs or node operations. If you build continuous data synchronization pipelines, automated webhook responders, or multi-step AI document processing, a single busy workflow can trigger hundreds of thousands of operations every week, pushing your SaaS bills into hundreds of dollars monthly.
By hosting n8n on your own dedicated Virtual Private Server (VPS), you decouple your workflow execution volume from operating costs. A $10/month VPS can easily execute upwards of 250,000 webhook events monthly with zero marginal cost.
Recommended Production Architecture
For a reliable single-node setup that handles automatic TLS certificates and database persistence, we use:
- Host OS: Ubuntu 24.04 LTS (minimum 2 vCPU, 4GB RAM).
- Orchestrator: Docker & Docker Compose.
- Database: PostgreSQL 16 (replacing the default SQLite for concurrent execution integrity).
- Reverse Proxy: Caddy 2 for automated zero-configuration Let's Encrypt SSL issuance.
Minimal Docker Compose Configuration
A resilient compose architecture isolates database volumes, sets health checks, and mounts webhook network bridges. Ensure environment variables are secured using an isolated .env file on your host machine.
Handling Production Webhook Volumes
When connecting third-party platforms like Stripe or e-commerce webhooks, ensure you configure WEBHOOK_URL to match your public HTTPS domain. If your workflows execute high-latency AI calls via OpenAI or local Ollama endpoints, use sub-workflows to immediately respond 200 OK to the inbound webhook before triggering downstream asynchronous tasks.
Need Pre-Built Enterprise Workflows?
Download our production pack of 25 tested n8n blueprints for solopreneurs, including webhook triage and media repurposing.
View 25 Production Blueprints →