n8n Production Self-Hosting Kit

Docker Compose + Postgres 17 + HTTPS, with encrypted backups, a restore drill and safe upgrades.
Self-host n8n the way you would for a client: HTTPS, PostgreSQL, and backups you have actually restored.
What you get
docker-compose.yml: n8n (pinned version), PostgreSQL 17 and Caddy with automatic Let's Encrypt HTTPS. Includes health checks, execution-data pruning, correct webhook/proxy settings, and the n8n 2.x file-access setting.setup.sh: generates a strong DB password and encryption key and locks down.env. It never overwrites an existing key.backup.sh: database dump, n8n data volume, per-workflow JSON exports, and a manifest with checksums and key fingerprint. Optional AES-256 encryption, rclone off-site copy, retention, and healthchecks.io-style pings.restore.sh: verifies checksums and refuses to restore with the wrong encryption key. Supports new-server recovery from one encrypted archive plus a passphrase.restore-drill.sh: restores into a throwaway stack and proves every credential decrypts. Production is untouched.upgrade.sh: backup first, refuseslatest, health check, optional automatic rollback.healthcheck.sh, cron examples, and a step-by-step PDF guide with troubleshooting.
Tested end to end: we wiped every volume, restored, and confirmed workflows were back and credentials decrypted. We also rebuilt from an encrypted archive on a "new server", ran negative tests (wrong key, corrupt archive, wrong passphrase), and confirmed all scripts pass shellcheck.
Pinned to n8n 2.40.6 (September 2026). Not affiliated with n8n GmbH.
Built with AI assistance and tested by running it end to end (details in the guide).
Refunds: 30-day refund if it doesn't work as described (refund policy).
Learn the method (free)
- How to Back Up n8n Properly: Database, Encryption Key and a Restore Test
Exporting workflows isn't a backup. What an n8n backup must contain, the exact commands (tested on n8n 2.40.6 with Postgres), and how to prove it restores.
- Self-Host n8n with Docker Compose, PostgreSQL and Automatic HTTPS (2026 Guide)
A production-grade n8n 2.x setup on one small server, with Postgres 17, Caddy for HTTPS, a pinned version, and the three settings that trip people up in n8n 2.x.
- How to Update Self-Hosted n8n in Docker Compose Without Losing Data (Tested 2.40 → 2.41)
The safe way to upgrade a self-hosted n8n: pin the version, back up the database and encryption key, pull, verify, and roll back properly. Every step tested in a real upgrade drill.
Related free tools
- n8n Docker Compose Generator (Postgres + HTTPS)
Generate a production docker-compose.yml, .env with a strong encryption key, and Caddyfile for self-hosting n8n 2.x. Runs entirely in your browser.
Save with a bundle
- n8n Production Bundle
3 products for $49 instead of $60 (save $11).
- Complete Bundle (all 6 core products)
6 products for $69 instead of $109 (save $40).
Checkout, delivery, receipts and sales tax are handled by Gumroad. Questions after purchase: reply to your Gumroad receipt email. Not tax, legal or financial advice.