Robin.te.Hofstee

Self-Hosting n8n on Proxmox

Robin te Hofstee8 min readViews1
Self-Hosting n8n on Proxmox

Deploying n8n on Proxmox using the Community Scripts LXC installer offers data privacy, unlimited execution, and full control compared to n8n Cloud, ideal for a homelab.

Self-Hosting n8n on Proxmox

n8n is a powerful workflow automation platform, but the cloud offering can quickly become a bottleneck or introduce unwanted dependencies. If you’re building workflows that interact with your home automation system, manage SSH credentials, or integrate with self-hosted APIs, the idea of trusting a third-party provider with that level of access can be unsettling. This tutorial will guide you through deploying n8n on your Proxmox server using the official Proxmox VE Community Scripts LXC installer, offering you complete control and data privacy.

Why Self-Host n8n?

Let’s be clear: n8n Cloud is a fantastic service, but it’s not for everyone. The main reasons to self-host n8n – especially in a homelab setting – are:

  • Data Privacy: You control the data entirely. No third-party logging, no potential security vulnerabilities outside your control. This is crucial if your workflows handle sensitive information.
  • No Execution Limits: Cloud plans often have execution time limits. With a self-hosted instance, you’re not restricted by these limitations.
  • Full Control: You decide which AI models and tools n8n can access – perhaps leveraging local LLMs via Ollama or other services on your network.
  • Customization: You can tailor the environment and add custom integrations far more easily.

What is the Proxmox Community Scripts Project?

The Proxmox VE Community Scripts project is a fantastic initiative that simplifies deploying applications within Proxmox LXC containers. Instead of painstakingly configuring everything yourself – creating a VM, installing the operating system, configuring networking, installing n8n, setting up systemd – you can achieve this with a single, streamlined command. It automates the process, significantly reducing the operational overhead. It's a much better approach than manually building a VM or container and manually installing n8n.

Running the Installer

The core of this setup is a single command provided by the Proxmox Community Scripts project for n8n. This command handles everything from downloading the base image to configuring the container.

Open a terminal on your Proxmox host and paste the following command:

curl -fsSL https://raw.githubusercontent.com/proxmox-ace/n8n-proxmox-community-scripts/main/install.sh | bash

Let's break this down:

  • curl: Downloads the script from GitHub.
  • -fsSL: Flags used to ensure a reliable download and handle potential redirects.
  • | bash: Pipes the downloaded script directly to the bash interpreter for execution.

The script will then prompt you for some information. Let’s walk through those prompts.

Interactive Prompts

The installer will present you with the following prompts:

  1. Container ID: This is the unique identifier for your n8n container. You can choose a name, but it's recommended to use something descriptive, like n8n-homelab.
  2. Hostname: This is the hostname assigned to the container. n8n or n8n-homelab are good choices.
  3. Disk Size: This determines the storage capacity for the container. For a home automation setup, 20-30GB is a reasonable starting point. You can always resize it later.
  4. CPU Cores: The number of CPU cores allocated to the container. For a homelab instance, 2-4 cores should be sufficient, depending on your other workloads.
  5. RAM Allocation: The amount of RAM allocated to the container. 4GB is a good starting point. Increase this if you run multiple resource-intensive workflows simultaneously.
  6. Systemd Service: The installer will automatically create a systemd service to ensure n8n starts automatically on boot.
  7. Data Directory: The script will create the n8n data directory, where all your workflows, credentials, and execution history are stored.

Automatic Setup

The script automatically installs:

  • Node.js: n8n requires Node.js to run.
  • n8n Itself: The core n8n application.
  • Systemd Service: Ensures n8n starts automatically when the container is launched.

The data directory is typically located at /var/lib/n8n/. This is where you'll find your workflows and configuration files. Regular backups of this directory are crucial.

Finding the IP Address and Accessing the UI

After the installation completes, the script will display the container's IP address. You can find this IP address in your Proxmox web interface under the LXC container's settings or by running ip addr on the Proxmox host. Using n8n or n8n-homelab is a good starting point if your network supports hostname resolution.

To access the n8n web UI, open your web browser and navigate to http://<container_ip>:8080. You'll likely be prompted to create an owner account, and you may need to authorize n8n to access your network.

Static Internal IP

Giving the container a static internal IP address is highly recommended. This prevents the IP address from changing when the container is restarted, which would break webhook URLs and chat trigger URLs.

You can configure a static IP in the Proxmox web interface under the LXC container’s settings, or by reserving an IP address in your router's DHCP settings based on the container's MAC address. It’s also possible to configure a static IP directly via the container's network configuration, but the Proxmox approach is generally easier.

Setting Environment Variables

If you're exposing n8n through a reverse proxy (like Nginx) or a custom domain, you must set the WEBHOOK_URL or N8N_EDITOR_BASE_URL environment variables correctly. These variables tell n8n where to send webhooks and what base URL to use for certain operations.

The Community Scripts setup typically utilizes an environment file or override mechanism for setting these variables. The location of this file will be displayed during the installation process. You'll need to edit this file to set these variables appropriately.

Updating n8n

The Proxmox Community Scripts approach typically includes a script to handle updates. You can usually run this script from the Proxmox host shell using ./update.sh. However, be aware that manually updating n8n can break compatibility, so stick to the provided update script.

Backing Up the Container

Use Proxmox's vzdump utility to create a backup of the container's filesystem. This is the primary backup strategy. Additionally, regularly back up the n8n data directory (/var/lib/n8n/) to protect your workflows, credentials, and execution history.

Connecting to Other Services

Once you have a stable n8n instance with a fixed IP address, you can easily connect it to other services on your homelab network, such as Ollama (for local LLM execution), a database, or SSH targets.

This concludes the basic setup. Now, you can start building complex workflows that leverage the power of n8n, all while maintaining complete control over your data and infrastructure.

Share this post
Robin te Hofstee

Written by Robin te Hofstee

Technology enthusiast with a deep love for programming. Sharing practical guides on React, Next.js, Linux and self-hosting.

Building an AI Agent Workflow in n8n

5

Learn how to build a fully automated AI content generation workflow in n8n, powered by a locally hosted Ollama model, triggered by a chat input and writing to a remote server via SSH.