Skip to content

Rabbittoly/n8n-hully-stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

n8n-hully-stack Production Docker Template

n8n.io - Workflow Automation

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.

📊 Architecture

                                   ┌─────────────┐
                                   │             │
                        ┌─────────►│   Redis     │
                        │          │             │
                        │          └─────────────┘
                        │
┌────────────┐    ┌─────────────┐    ┌─────────────┐
│            │    │             │    │             │
│  Traefik   ├────►    n8n      ├────►  PostgreSQL │
│            │    │             │    │             │
└────────────┘    └─────────────┘    └─────────────┘
      │
      │
      ▼
 HTTPS with
Let's Encrypt

Components:

  • 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.

🚀 Quick Start

Requirements

  • 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)

One-Command Installation

curl -sSL https://raw.githubusercontent.com/rabbittoly/n8n-hully-stack/main/quickstart.sh | bash

Manual Installation

  1. Clone this repository:

    git clone https://github.com/rabbittoly/n8n-hully-stack.git
    cd n8n-docker-template
  2. Run the installation:

    make install

    This will:

    • Install Docker if needed
    • Set up directories
    • Create a .env file (and prompt for your domain)
    • Generate secure random passwords
  3. Deploy n8n:

    make deploy
  4. Access your n8n instance:

    https://your-domain.com
    

    Log in with the admin username/password shown during installation.

🔧 Configuration

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

📋 Commands

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!)

🛡️ Cloudflare Setup (optional)

If you use Cloudflare to manage your domain's DNS, follow these instructions for proper operation with Let's Encrypt:

For HTTP-01 challenge mode (default):

  1. Log in to your Cloudflare dashboard
  2. Go to the DNS section for your domain
  3. 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)
  4. In the SSL/TLS section, set the mode to "Full" or "Full (strict)"

For DNS-01 challenge mode (automatically configured by the script if Cloudflare is selected):

  1. Log in to your Cloudflare dashboard
  2. Go to the "API Tokens" section (https://dash.cloudflare.com/profile/api-tokens)
  3. Copy your Global API Key
  4. 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).

💾 Backup and Restore

Creating a backup

make backup

This will create a backup archive in the current directory containing:

  • PostgreSQL database dump
  • n8n data (workflows, credentials)
  • Configuration files

Restoring from backup

  1. Copy the backup archive to the server

  2. Extract it:

    tar -xzf n8n_backup_YYYY-MM-DD.tar.gz
  3. Stop the services:

    make stop
  4. 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

  5. Restore n8n data rm -rf ./data/n8n/* tar -xzf backups/YYYY-MM-DD/n8n_data.tar.gz -C ./data/n8n

  6. Optionally restore configuration cp backups/YYYY-MM-DD/.env.backup .env

  7. Restart the services:

    make restart

🔄 Updating

To update n8n to the latest version:

make update

This will:

  1. Create a backup
  2. Pull the latest Docker images
  3. Restart the services

🔍 Troubleshooting

Checking logs

make logs

Add -f service_name to view logs for a specific service:

docker-compose logs -f n8n

Common issues

  1. Cannot access n8n : Make sure your domain correctly points to your server's IP address.
  2. HTTPS certificate issues : Make sure ports 80 and 443 are open in your server's firewall.
  3. Database connection issues : Check PostgreSQL logs and verify credentials in the .env file.

🔒 Security Recommendations

  • Change default passwords in the .env file
  • Enable a firewall (UFW)
  • Set up regular backups and store copies off-server
  • Keep your system up to date

🌐 Resource Requirements

The setup is optimized for a server with:

  • 2 CPU cores
  • 4 GB RAM
  • 20+ GB storage (depends on your workflow usage)

📜 License

This template is provided under the MIT License.

n8n is licensed under the Sustainable Use License.

About

Docker template for deploying n8n with Traefik

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors