This repository provides a production-ready template for deploying n8n - a workflow automation tool - using Docker Compose, PostgreSQL, Redis, and Traefik as a reverse proxy with automatic HTTPS.
┌─────────────┐
│ │
┌─────────►│ Redis │
│ │ │
│ └─────────────┘
│
┌────────────┐ ┌─────────────┐ ┌─────────────┐
│ │ │ │ │ │
│ Traefik ├────► n8n ├────► PostgreSQL │
│ │ │ │ │ │
└────────────┘ └─────────────┘ └─────────────┘
│
│
▼
HTTPS with
Let's Encrypt
- Traefik : Manages routing and automatic HTTPS certificate setup
- n8n : Workflow automation engine
- PostgreSQL : Database for storing workflows and executions
- Redis : Caching and performance enhancement
All data is persisted in volumes on the host machine in the ./data directory.
- Server with Ubuntu 22.04 (recommended 2 CPU, 4GB RAM)
- Domain name pointing to your server's IP address
- Docker and Docker Compose (will be automatically installed if missing)
curl -sSL https://raw.githubusercontent.com/rabbittoly/n8n-hully-stack/main/quickstart.sh | bash-
Clone this repository:
git clone https://github.com/rabbittoly/n8n-hully-stack.git cd n8n-docker-template -
Run the installation:
make install
This will:
- Install Docker if needed
- Set up directories
- Create a
.envfile (and prompt for your domain) - Generate secure random passwords
-
Deploy n8n:
make deploy
-
Access your n8n instance:
https://your-domain.comLog in with the admin username/password shown during installation.
All configuration is managed through the .env file. See: .env.example Here are the main settings:
| Variable | Description |
|---|---|
| N8N_DOMAIN | Your domain for accessing n8n |
| ACME_EMAIL | Email for Let's Encrypt notifications |
| POSTGRES_* | PostgreSQL database settings |
| N8N_ENCRYPTION_KEY | Secret key for credentials encryption |
| SMTP_* | Settings for sending emails |
| N8N_BASIC_AUTH_* | Basic authentication credentials |
Use the Makefile for main operations:
make help # Show all available commands
make install # Set up the environment
make deploy # Initial deployment
make start # Start all services
make stop # Stop all services
make restart # Restart all services
make status # Check container status
make logs # View logs
make backup # Create a backup
make update # Update to the latest n8n version
make clean # Remove everything (CAUTION!)If you use Cloudflare to manage your domain's DNS, follow these instructions for proper operation with Let's Encrypt:
- Log in to your Cloudflare dashboard
- Go to the DNS section for your domain
- Create a new A record:
- Name: your subdomain (e.g., n8n)
- IP address: your server's IP address
- Important : Turn off "Proxy status" (gray cloud instead of orange)
- In the SSL/TLS section, set the mode to "Full" or "Full (strict)"
- Log in to your Cloudflare dashboard
- Go to the "API Tokens" section (https://dash.cloudflare.com/profile/api-tokens)
- Copy your Global API Key
- Enter this key and your Cloudflare email when running the installation script
Note : When using DNS-01 challenge, you can leave "Proxy status" enabled (orange cloud).
make backupThis will create a backup archive in the current directory containing:
- PostgreSQL database dump
- n8n data (workflows, credentials)
- Configuration files
-
Copy the backup archive to the server
-
Extract it:
tar -xzf n8n_backup_YYYY-MM-DD.tar.gz
-
Stop the services:
make stop
-
Restore PostgreSQL database docker-compose up -d postgres docker exec -i n8n-postgres pg_restore -U n8n -d n8n < backups/YYYY-MM-DD/n8n_postgres.dump
-
Restore n8n data rm -rf ./data/n8n/* tar -xzf backups/YYYY-MM-DD/n8n_data.tar.gz -C ./data/n8n
-
Optionally restore configuration cp backups/YYYY-MM-DD/.env.backup .env
-
Restart the services:
make restart
To update n8n to the latest version:
make updateThis will:
- Create a backup
- Pull the latest Docker images
- Restart the services
make logsAdd -f service_name to view logs for a specific service:
docker-compose logs -f n8n- Cannot access n8n : Make sure your domain correctly points to your server's IP address.
- HTTPS certificate issues : Make sure ports 80 and 443 are open in your server's firewall.
- Database connection issues : Check PostgreSQL logs and verify credentials in the
.envfile.
- Change default passwords in the
.envfile - Enable a firewall (UFW)
- Set up regular backups and store copies off-server
- Keep your system up to date
The setup is optimized for a server with:
- 2 CPU cores
- 4 GB RAM
- 20+ GB storage (depends on your workflow usage)
This template is provided under the MIT License.
n8n is licensed under the Sustainable Use License.
