How to host n8n with Coolify?
This guide shows how to host n8n with Coolify on a VPS using Docker and Node.js. You can host n8n with Coolify by installing Coolify on your server, then deploying the n8n Docker image through Coolify or by running n8n directly with Docker. The steps below provide clear commands and a safe setup for beginners in automation.
How to host n8n with Coolify – What You Need
- A VPS with Ubuntu 20.04+ and a domain name.
- Access to the server via SSH and a non-root sudo user.
- Docker and the Docker Compose plugin installed.
- Basic DNS control to point a domain to the VPS.
Step 1: Install Docker and Docker Compose
Install Docker and the Compose plugin on Ubuntu. Run each command as a user with sudo.
sudo apt update
sudo apt install -y ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo usermod -aG docker $USER
Log out and back in to apply the Docker group change. Test Docker with a quick run.
docker run --rm hello-world
Step 2: Install Coolify
Clone the Coolify repository and start it with Docker Compose. Edit .env before starting to set your domain and email for Let’s Encrypt.
git clone https://github.com/coollabsio/coolify.git
cd coolify
cp .env.example .env
# Edit .env to set DOMAIN and EMAIL with your values
docker compose up -d
After launch, open the Coolify URL (your domain) and create the admin account. Coolify will handle app deployments and SSL certificates.
Step 3: Deploy n8n using Coolify or Docker
Option A: Use the Coolify UI to add a new Docker image. Use image n8nio/n8n:latest and set environment variables and a persistent volume for /home/node/.n8n.
Option B: Test n8n directly with Docker using these commands. This creates a persistent volume and runs n8n on port 5678.
docker volume create n8n_data
docker run -d --name n8n \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
-e N8N_BASIC_AUTH_ACTIVE=true \
-e N8N_BASIC_AUTH_USER=admin \
-e N8N_BASIC_AUTH_PASSWORD=strongpassword \
-e WEBHOOK_URL=https://example.com/ \
n8nio/n8n:latest
Replace WEBHOOK_URL with your domain or the Coolify-managed URL. Use the Coolify UI to set environment variables if you deploy through Coolify.
Step 4: Configure Domain and SSL
Point your domain A record to the VPS IP. In Coolify, add the domain to the service and enable automatic Let’s Encrypt certificates. Wait a few minutes for the certificate to issue.
Update
Keep Coolify and n8n updated. For Coolify, pull the repo and restart the stack. For n8n, pull the image and recreate the container.
# Update Coolify
cd ~/coolify
git pull
docker compose pull
docker compose up -d --remove-orphans
# Update n8n (if running via Docker)
docker pull n8nio/n8n:latest
docker stop n8n && docker rm n8n
# Re-run the docker run command from above with the same options
Security
- Use HTTPS for all traffic. Coolify can provision Let’s Encrypt certificates.
- Enable n8n basic auth or OAuth for the editor. Use strong, unique passwords.
- Run the server firewall (ufw) to allow only needed ports (80, 443, 22).
- Use SSH keys and disable password SSH login.
- Back up /home/node/.n8n volume regularly and store backups offsite.
Done
You now have a basic, working setup that shows how to host n8n with Coolify on a VPS. Use Coolify to manage updates and SSL, and use the Coolify UI to add environment variables, volumes, and domains for production-ready deployments.