Full Guide to Self-Hosting n8n on Hetzner and Deploying via Coolify

members
4 min read
Full Guide to Self-Hosting n8n on Hetzner and Deploying via Coolify

I've been experimenting quite a lot with n8n and decided to try self-hosting instead of using the cloud version. The cloud-hosted option crashed multiple times with larger files, and the higher-tier plans are too expensive for a few private projects. Self-hosting turned out to be not only cheaper but also more privacy-friendly since you control your server’s location. Here’s a complete guide on setting it up. It might look a bit daunting, but it’s definitely doable.


Prerequisites

  • An account with Hetzner Cloud
  • Your own domain (e.g., yourdomain.com) — optional but highly recommended
  • A terminal program (e.g., Windows Terminal, PuTTY, or the default Terminal on macOS/Linux)

Step-by-Step Guide

Prepare and Create the Hetzner Cloud Server

  • Create an SSH Key (if you don’t have one):
    • Open your local terminal.
    • Generate a secure key with: ssh-keygen -t ed25519
    • Press Enter to confirm the default save location.
    • Assign a secure passphrase and remember it.
    • This creates two files in your .ssh directory. The important file for Hetzner ends in .pub (e.g., id_ed25519.pub).
  • Create a Hetzner Cloud Server:
    • Log in to your Hetzner Cloud Console and create a new project (e.g., "Testproject").
    • Click "Add server".
    • Location: Choose a location in Germany (Nuremberg or Falkenstein) for GDPR compliance.
    • Image: Select Ubuntu 24.04 (or the latest LTS version).
    • Type: Under "Shared vCPU," select CPX11 or CPX21 to start.
      • Note: You can scale up CPU and RAM later, but disk size cannot be scaled down.
    • SSH Key: Add your .pub file’s content and name it (e.g., "My-Desktop-Key").
    • Firewall & Name: Skip firewall for now; name the server (e.g., "n8n-server").
    • Click "Create & Buy now".

Connect to the Server and Install Coolify

  • Copy IP Address: From Hetzner’s overview, copy your server’s public IPv4 address.
  • Connect via SSH: Replace YOUR_SERVER_IP with your server’s IP:
  • ssh root@YOUR_SERVER_IP
  • Confirm the host’s authenticity and enter your SSH key’s passphrase.
  • Get Coolify Installation Command:
  • Install Coolify: Paste and run the command in your terminal. Installation may take a few minutes.

Click "Self-hosted" and copy the installation command (e.g.):
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash