Self Hosting N8N Application on Hetzner with Coolify

Self Hosting N8N Application on Hetzner with Coolify

Self Hosting N8N Application on Hetzner with Coolify

Self-hosting your applications offers unparalleled control, often at a more attractive price point than fully managed services. If you’re looking to deploy powerful tools like n8n, a versatile workflow automation platform, or even a personal blog, and you appreciate a streamlined deployment process, then combining Hetzner for your server infrastructure with Coolify as your self-hosted Heroku/Netlify alternative is a fantastic choice. This guide will walk you through the essential steps to get your applications running smoothly.

Why Hetzner and Coolify?

  • Hetzner: Renowned for its highly competitive pricing and robust server performance, Hetzner provides excellent value for cloud servers. This makes it an ideal backbone for a variety of applications, from lightweight static sites to more resource-intensive ones like workflow automation tools. You can choose a server with specifications that suit your needs, for example, a cloud server with 2 vCPUs and 4GB RAM.
  • Coolify: This open-source platform simplifies the deployment and management of applications on your own server. It acts as a user-friendly interface, abstracting away much of the complexity of Docker, Nginx, and SSL certificate management, giving you a Heroku-like experience on your own hardware.
  • n8n: Whether it’s a dynamic blog, a powerful automation tool (like n8n), or a simple personal introduction page, this combination empowers you to host it all efficiently.

Prerequisites

Before diving in, ensure you have:

  1. A Hetzner Cloud Server: Provisioned and ready. Note down its Public IPv4 address.
  2. Coolify Installed on Your Hetzner Server: You should have successfully installed Coolify on your server.
  3. A Domain Name: You’ll need a domain (e.g., app.yourdomain.com, blog.yourdomain.com, or just yourdomain.com) and access to its DNS settings (e.g., Namecheap) to point it to your Hetzner server’s Public IPv4 address using A records. Wildcard A records (* and @ pointing to your server’s IP) are highly beneficial for easily managing subdomains.

Step-by-Step Guide

Step 1: Add Your Hetzner Server to Coolify

This is the foundational step to connect your infrastructure with Coolify’s management capabilities.

  1. Access Coolify: Log in to your Coolify dashboard (typically http://[Your Hetzner Server's Public IPv4]:3000).
  2. Navigate to Servers: In the left sidebar, click on “Servers”.
  3. Add Your Server: Click the “+ Add” button next to “Servers”.
  4. Enter Details:
    • Name: Give your server a recognizable name (e.g., “Hetzner Main Server”).
    • IP Address/Domain: Enter your Hetzner Cloud Server’s Public IPv4 address.
    • User: Typically root for a fresh installation.
    • Port: The default SSH port is 22.
    • Private Key: Paste the private SSH key associated with your server.
  5. Save and Validate: Click “Save” and Coolify will attempt to validate the server connection. Once validated, you’ll see a “Server is reachable and validated” message.

Step 2: Organize with Coolify Projects (Recommended)

Projects help keep your applications organized within Coolify.

  1. In Coolify: Go to “Projects” in the left sidebar.
  2. Create a New Project: Click “+ Add” next to “Projects”.
  3. Name Your Project: Give it a logical name (e.g., “Automation Tools,” “Personal Blog,” “Static Pages”).

Step 3: Deploy Your Application (e.g., n8n, or a Static Site)

The deployment process will vary slightly depending on your application type, but the core steps remain similar.

  1. Add Application: Inside your chosen project, click “+ Add Application” or “New Application.”
  2. Select Application Type:
    • Git Repository: For applications deployed from a GitHub/GitLab/Bitbucket repository (e.g., a static HTML page with a Dockerfile, or a Docker Compose stack like n8n). Choose “Private Repository (with GitHub App)” for a secure and automated integration with GitHub.
    • Service Stack: For pre-defined services like n8n with MySQL.
    • Static Site: (If available and simple HTML/CSS/JS is all you need without a Dockerfile).
  3. Configure Details:
    • Name: A descriptive name for your application.
    • Repository/Image: Select your Git repository or Docker image source.
    • Branch/Tag: Specify the branch (e.g., main) or Docker image tag.
    • Build Pack: Choose Dockerfile, Docker Compose, or the appropriate language/framework.
    • Domains: This is critical. Add the custom domain(s) for your application (e.g., n8n.yourdomain.com, blog.yourdomain.com, or yourdomain.com). Remember that a domain can only be assigned to one application at a time within Coolify. If you encounter an “already in use” error, check your Coolify Instance Settings and other applications to ensure the domain is not claimed elsewhere.
    • Server: Select your “Hetzner Main Server.”
    • Environment Variables: Provide any necessary environment variables (e.g., database credentials for n8n).
    • Resource Limits: Crucially, set CPU and RAM limits for your application containers. This is vital on a shared server (like your 4GB RAM, 2 vCPU Hetzner server) to prevent one application from consuming all resources and crashing the server. Assign conservative limits based on your server’s total capacity.
  4. Deploy: Click “Deploy” to initiate the build and deployment process. Coolify will fetch your code, build the images, create containers, and automatically provision SSL certificates via Let’s Encrypt.

Step 4: Verify and Access Your Application

  1. Monitor Logs: Keep an eye on the “Logs” tab of your application in Coolify to ensure the deployment completes without critical errors. Messages like “Rolling update completed” generally indicate success.
  2. Check Status: Confirm the application status shows “Running.”
  3. Access: Open your web browser and navigate to your custom domain (e.g., https://n8n.yourdomain.com or https://yourdomain.com). Your application should now be live!

Troubleshooting Tips

  • “Site can’t be reached” / “ERR_TIMED_OUT”: This often points to the server being overloaded, the Coolify proxy not running, or incorrect DNS settings.
    • Check Hetzner graphs for CPU/RAM spikes.
    • Verify “Proxy Running” status in Coolify’s Server settings.
    • Restart your Hetzner server from the Hetzner Cloud Dashboard if it’s unresponsive.
  • “Domain already in use”: This means the domain is assigned to another application or the Coolify instance itself. Remove it from its current location before assigning it to your desired application.
  • Resource Management: If applications frequently crash or are unresponsive, increase your Hetzner server’s RAM and CPU, or reduce the number/resource limits of applications running on it.