Self‑Host n8n on a VPS with Docker, PostgreSQL, and Caddy
Описание и применение
Развертывание n8n на VPS с Docker, PostgreSQL и Caddy: автоматическое HTTPS, защищённые креды и постоянное хранилище.
Задача
Deploy a production‑ready n8n instance with a persistent database, automatic HTTPS, and secure credentials management.
Результат
n8n is running securely behind Caddy with automatic Let's Encrypt certificates, persistent PostgreSQL storage, and encrypted credentials, ready for production use.
Рабочий процесс
- Create project directory and generate .env with POSTGRES_PASSWORD, N8N_ENCRYPTION_KEY, and N8N_HOST
- Write docker‑compose.yml defining postgres, n8n, and caddy services with appropriate environment variables and volumes
- Create Caddyfile with reverse_proxy to n8n:5678
- Run docker compose up -d and verify services with docker compose ps and logs
- Access https://
<domain>to create owner account and start building workflows - Apply hardening: backup .env, configure firewall to allow only SSH, 80, 443, and set restart policy
Доказательства
Use PostgreSQL, not the default SQLite: set DB_TYPE=postgresdb and the DB_POSTGRESDB_* variables.
Let Caddy own HTTPS: point your domain at the server and it provisions a Let's Encrypt certificate automatically.
- Дата записи: 2026-09-02T14:26:15.974Z