Skip to Content

n8n Coolify Deployment: The Cleanest Way to Self-Host Your Automation Stack

Learn how to deploy n8n on Coolify with persistent storage, a custom domain, and environment variables — production-ready in under 30 minutes.
n8n setup guide

n8n Coolify Deployment: The Cleanest Way to Self-Host Your Automation Stack

n8n is one of the best self-hosted automation platforms out there — flexible, powerful, and genuinely fun to work with. Coolify is the open-source PaaS that makes deploying and managing apps on your own server feel like a cloud platform. Put them together and you get a production-grade n8n Coolify deployment with automatic SSL, custom domains, persistent storage, and a clean UI for managing everything — no Kubernetes degree required.

If you're running n8n on Windows or want to understand the full self-hosting picture first, check out our guides on running n8n on Windows with WSL2 and self-hosting n8n for unlimited AI automation workflows. This guide focuses specifically on deploying via Coolify.


Prerequisites

  • A Linux VPS or dedicated server (Ubuntu 22.04 LTS recommended) with at least 2 vCPU and 2GB RAM
  • Coolify installed and running on that server (coolify.io/docs)
  • A domain name with DNS access — you'll point a subdomain at your server
  • Port 80 and 443 open on your firewall (Coolify handles the rest)
  • SSH access to the server for initial setup and debugging

Verify Coolify is up before continuing:

ssh user@your-server-ip
sudo systemctl status coolify
# Or check the Coolify dashboard at http://your-server-ip:8000

If Coolify isn't installed yet, the one-liner installer handles it:

curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash

What Is Coolify and Why Use It for n8n?

Coolify is a self-hosted Heroku/Netlify/Vercel alternative. It sits on top of Docker and gives you a web UI to deploy apps, manage databases, configure domains, handle SSL certificates via Let's Encrypt, and monitor services — all on infrastructure you own.

Why Coolify Over Raw Docker Compose?

  • Automatic SSL — Let's Encrypt certs provisioned and renewed without any manual config
  • Reverse proxy built in — Coolify uses Traefik under the hood; no manual Nginx config required
  • Persistent volume management — map volumes from the UI without editing Compose files by hand
  • Environment variable editor — set and update secrets from the dashboard, no SSH needed
  • One-click redeployments — update n8n versions with a button click
  • Multi-app server — run n8n alongside other services on the same VPS without port conflicts

For a deeper look at why self-hosting n8n is worth it compared to n8n Cloud, read our post on self-hosting n8n for unlimited AI automation workflows.


Setting Up the DNS and Domain

Before deploying anything, point your subdomain at your server. Log in to your DNS provider and create an A record:

# DNS A Record
Type:  A
Name:  n8n          (results in n8n.yourdomain.com)
Value: YOUR_SERVER_IP
TTL:   300

Give DNS a few minutes to propagate. You can verify it's resolving before proceeding:

dig +short n8n.yourdomain.com
# Should return your server IP

Deploying n8n on Coolify: Step-by-Step

Step 1: Create a New Service in Coolify

  1. Open your Coolify dashboard and navigate to your Server → New Resource
  2. Select Docker Compose as the deployment type
  3. Give the service a name — e.g., n8n

Step 2: Add the Docker Compose Configuration

In the Compose editor, paste the following configuration. This sets up n8n with SQLite persistence (solid for most use cases) and the correct environment for running behind Coolify's Traefik proxy:

version: '3.8'

services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: unless-stopped
    environment:
      - N8N_HOST=${N8N_HOST}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${N8N_HOST}/
      - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=${N8N_BASIC_AUTH_USER}
      - N8N_BASIC_AUTH_PASSWORD=${N8N_BASIC_AUTH_PASSWORD}
      - GENERIC_TIMEZONE=UTC
      - TZ=UTC
    volumes:
      - n8n_data:/home/node/.n8n
    ports:
      - "5678:5678"

volumes:
  n8n_data:

Step 3: Set Environment Variables

In Coolify's Environment Variables tab for this service, add the following. Never hardcode secrets in the Compose file itself:

N8N_HOST=n8n.yourdomain.com
N8N_ENCRYPTION_KEY=a-random-32-char-string-here
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=a-strong-password-here

Generate a secure encryption key with:

openssl rand -hex 16
# Returns a 32-char hex string — paste this as N8N_ENCRYPTION_KEY

Important: the N8N_ENCRYPTION_KEY encrypts all your stored credentials. If you lose it or change it, your credentials become unreadable. Store it somewhere safe — a password manager or secrets vault.

Step 4: Configure the Domain in Coolify

  1. In your service settings, go to the Domains tab
  2. Add your domain: https://n8n.yourdomain.com
  3. Enable SSL / Let's Encrypt — Coolify handles cert provisioning automatically
  4. Set the internal port to 5678

Step 5: Deploy

Click Deploy. Coolify pulls the n8n image, starts the container, provisions an SSL certificate, and wires up the Traefik routing. Watch the deployment log — it takes about 60–90 seconds on a typical VPS.

Once complete, open https://n8n.yourdomain.com. You'll hit the basic auth prompt, then land on the n8n setup screen to create your owner account.


Switching to PostgreSQL for Production

SQLite works fine for personal use and small teams. But if you're running heavy workflows, parallel executions, or need multi-instance support, switch to PostgreSQL. Add a Postgres service in Coolify first, then update your n8n Compose config:

version: '3.8'

services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: unless-stopped
    environment:
      - N8N_HOST=${N8N_HOST}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${N8N_HOST}/
      - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=${N8N_BASIC_AUTH_USER}
      - N8N_BASIC_AUTH_PASSWORD=${N8N_BASIC_AUTH_PASSWORD}
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=${POSTGRES_HOST}
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
      - DB_POSTGRESDB_USER=${POSTGRES_USER}
      - DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
      - GENERIC_TIMEZONE=UTC
      - TZ=UTC
    volumes:
      - n8n_data:/home/node/.n8n
    ports:
      - "5678:5678"

volumes:
  n8n_data:

Add the Postgres environment variables in Coolify's env editor:

POSTGRES_HOST=your-postgres-container-name
POSTGRES_DB=n8n
POSTGRES_USER=n8n
POSTGRES_PASSWORD=a-strong-db-password

Redeploy after saving. n8n will run its database migrations against Postgres automatically on first start.


Tips, Gotchas, and Troubleshooting

Webhooks Not Receiving Requests

The most common post-deploy issue. Make sure WEBHOOK_URL is set to your full public HTTPS URL including the trailing slash. n8n uses this to build webhook endpoint URLs — if it's wrong, the URLs it shows you inside the editor will be wrong too.

# Correct:
WEBHOOK_URL=https://n8n.yourdomain.com/

# Wrong (missing trailing slash, or wrong domain):
WEBHOOK_URL=https://n8n.yourdomain.com

SSL Certificate Not Provisioning

Let's Encrypt requires your domain to resolve to the server's public IP before it can issue a cert. If cert provisioning fails, check:

  • DNS A record is pointing at the correct IP
  • Port 80 is open on your firewall (Let's Encrypt uses HTTP-01 challenge)
  • You haven't hit the Let's Encrypt rate limit (5 certs per domain per week)
# Check that port 80 is open
sudo ufw status
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

# Verify DNS from the server itself
curl -s https://dns.google/resolve?name=n8n.yourdomain.com&type=A | jq .Answer

n8n Container Keeps Restarting

Pull the logs from Coolify's log viewer or via SSH:

docker logs n8n --tail 50 -f

Common causes: missing N8N_ENCRYPTION_KEY, wrong database credentials, or a volume permission issue. If it's permissions on the data volume:

# Fix volume ownership (node user = UID 1000 in n8n container)
docker run --rm -v n8n_data:/data alpine chown -R 1000:1000 /data

Updating n8n

In Coolify, go to your n8n service and click Redeploy after updating the image tag to the new version. Your data volume is preserved. To pin to a specific version (recommended for production stability), replace latest with the version tag:

# Pin to a specific version
image: n8nio/n8n:1.40.0

# Or track latest (easier updates, less predictable)
image: n8nio/n8n:latest

Check the n8n releases page for changelogs before upgrading in production.

Pro Tips

  • Back up your n8n_data volume regularly — it contains your workflows, credentials, and execution history. A daily docker cp or volume snapshot is enough for most setups.
  • Use n8n's built-in credential store for API keys instead of hardcoding them in workflow nodes — it's encrypted with your N8N_ENCRYPTION_KEY and reusable across workflows.
  • Set EXECUTIONS_DATA_PRUNE=true and EXECUTIONS_DATA_MAX_AGE=168 (7 days in hours) to prevent your execution log from bloating the database over time.
  • Use Coolify's built-in monitoring to track CPU and memory usage — n8n workflows that run heavy JavaScript or process large payloads can spike memory unexpectedly.
  • For Windows development before going to a VPS, check out our guide on running n8n on Windows with WSL2 to build and test workflows locally first.

Wrapping Up

An n8n Coolify deployment gives you the best of both worlds: n8n's powerful automation engine on infrastructure you control, managed through Coolify's clean PaaS layer so you're not fighting Docker configs every time something needs updating.

The setup takes under 30 minutes, SSL is automatic, and once it's running you can focus entirely on building workflows instead of maintaining infrastructure. Start with SQLite, move to Postgres when you need it, and use Coolify's redeployment flow to keep n8n up to date without downtime.

Want to go deeper on what you can build once n8n is running? Read our guide on self-hosting n8n for unlimited AI automation workflows for workflow ideas, AI integrations, and advanced configuration.


Need a Production Automation Stack Built and Managed?

If you're deploying n8n for a team or business — with high availability, SSO, workflow governance, or integration into existing infrastructure — the sysbrix team can design and run it for you. We handle the architecture so you can focus on the automations that matter.

Talk to Us →
Dify AI Platform Setup: Build and Ship AI Apps Without the Infrastructure Nightmare
Learn how to self-host the Dify AI platform with Docker, connect your LLM providers, and build production-ready AI workflows and chatbots on your own infrastructure.