n8n Production Stack
n8n + Postgres + Nginx — production-grade workflow automation with persistent storage, TLS-ready proxy, and daily backups.
n8n Production Stack
A production-ready n8n deployment backed by Postgres instead of SQLite, with an Nginx reverse proxy and automated daily database backups. Runs behind a domain with TLS in minutes.
What's Included
- n8n — Latest stable release configured to use Postgres for all workflow and execution storage
- PostgreSQL 16 — Persistent database with named volume; no data loss on container restarts
- Nginx Sidecar — Pre-configured reverse proxy; swap in your domain and optionally add Certbot for TLS
- Backup Cron — Runs
pg_dumpnightly, retains 7 rolling backups in a local volume
Production-Ready Setup
- Postgres backend replaces default SQLite — handles concurrent executions and large workflow histories without corruption
- Proper named volumes for n8n user data and Postgres — data survives
docker compose down - Nginx config included for HTTP and commented HTTPS block ready for your certificate
- Environment variables for n8n encryption key, webhook URL, and basic auth all documented
- Backup container runs on a cron schedule, dumps Postgres, and prunes old files automatically
- Health check on Postgres — n8n waits until the database is accepting connections before starting
What You Get
docker-compose.yml— fully configured production stacknginx/n8n.conf— reverse proxy config with WebSocket support for n8n editorbackup/backup.sh— cron-driven Postgres dump script with rotationentrypoint.sh— waits for Postgres health before starting n8n.env.examplewith every variable documentedREADME.md— deploy guide, domain setup, TLS instructions, and backup restore steps
Service URLs
| Service | URL |
|---|---|
| n8n Editor | http://localhost:5678 (or via Nginx on port 80) |
| Nginx Proxy | http://localhost:80 |
Requirements
Docker Engine with the Compose plugin on a Linux VPS or server. 1 GB RAM minimum; 2 GB recommended for larger workflows.