Deploy n8n Workflow Automation with Docker Compose
Self-hosted fair-code workflow automation with 400+ integrations and AI agent nodes.
n8nio/n8n:latest1. Production docker-compose.yml Configuration
Copy this stack definition or deploy directly from your Vexlo Cloud console with automatic Let's Encrypt TLS and persistent volume mounts.
services:
n8n:
image: n8nio/n8n:latest
restart: unless-stopped
ports:
- "5678:5678"
environment:
- N8N_PORT=${N8N_PORT:-5678}
- N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY:-change-me-32-char-secret}
- WEBHOOK_URL=${WEBHOOK_URL:-https://n8n.yourdomain.com/}
- EXECUTIONS_MODE=${EXECUTIONS_MODE:-queue}
volumes:
- app_data:/home/node/.n8n
depends_on:
- postgres
- redis
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-change-me-db-password}
- POSTGRES_DB=n8n
volumes:
- postgres_data:/var/lib/postgresql/data
redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
volumes:
app_data:
postgres_data:
redis_data:2. Required Environment Variables
| Variable | Default / Example | Description |
|---|---|---|
| N8N_PORT | 5678 | Internal HTTP port bound by n8n web UI and webhooks. |
| N8N_ENCRYPTION_KEY | change-me-32-char-secret | Symmetric key used to encrypt stored third-party credentials. |
| WEBHOOK_URL | https://n8n.yourdomain.com/ | Public HTTPS endpoint for incoming webhook triggers. |
| EXECUTIONS_MODE | queue | Run executions in Redis queue mode for high throughput. |
n8n Workflow Automation Self-Hosting FAQs
How much RAM is required to self-host n8n Workflow Automation in production?
n8n Workflow Automation requires a minimum of 1 GB RAM (Pro recommended). On Vexlo Cloud Pro (₹149/mo via UPI in India or $5/mo globally), you get 2 vCPU, 3 GB RAM, and 2 managed databases—more than enough headroom for production workloads.
How do I expose n8n Workflow Automation with automatic HTTPS/SSL on Vexlo Cloud?
Deploy the n8nio/n8n:latest container on Vexlo Cloud, set the exposed port to 5678, and attach your custom domain in the Domains tab. Vexlo automatically provisions and renews Let's Encrypt TLS certificates.
How is persistent data backed up for n8n Workflow Automation?
Mount /home/node/.n8n to a persistent Docker volume and connect Vexlo Cloud's automated S3 / Cloudflare R2 backup scheduler to snapshot your database daily or weekly.
More 1-Click Docker Templates
View all 25 templates →Uptime Kuma
Self-hosted uptime monitoring dashboard with HTTP, TCP, DNS, and Telegram/Discord alerts.
PocketBase
Single-binary Go backend with embedded SQLite, real-time subscriptions, auth, and file storage.
Supabase Self-Hosted
Open-source Firebase alternative with PostgreSQL, GoTrue Auth, PostgREST, Realtime, and Studio.
Umami Analytics
Privacy-first, cookie-free web analytics alternative to Google Analytics 4 backed by PostgreSQL.