Deploy n8n Workflow Automation with Docker Compose in FlyWP

Ever wished you could make your apps talk to each other without writing boring glue code? That’s exactly what n8n lets you do. Now you can easily automate tasks across apps and APIs visually, all through a clean drag-and-drop interface.

In this quick guide, you’ll learn how to self-host n8n using Docker Compose on a FlyWP-managed server. Whether you want to keep it simple or hook it up with a custom domain and SSL, we’ve got you covered. So, let’s roll up our sleeves and get this automation workflow.

What Is n8n and Why Use It?

n8n (pronounced “n-eight-n”) is a powerful, open-source workflow automation tool that lets you connect apps and services without writing full-blown code. Think of it as your personal Zapier, only self-hosted, privacy-focused, and infinitely customizable.

You can drag, drop, and wire up actions between tools like Gmail, Notion, GitHub, Slack, and 350+ others. Whether you’re automating lead collection or syncing data between platforms, n8n gives you the power to build without getting locked into costly SaaS traps.

n8n Workflow Examples to Try Right Now

N8n workflow automation

To make the most of n8n, here are a few workflow ideas you can build with just a few nodes:

  • Auto-post tweets when you publish a new blog post
  • Send Telegram alerts from form submissions
  • Sync Airtable tasks with your Google Calendar
  • Back up new Gmail attachments to Dropbox
  • Auto-clean completed Notion tasks every Sunday

The best part? You can trigger all of this with webhooks, schedules, or manual input, and you can host it all on your own FlyWP-managed setup.

Why Host n8n Yourself (vs n8n Cloud)?

n8n offers both cloud and self-hosted options. Here’s why self-hosting, especially on a managed server, is often the smarter move:

Featuren8n CloudSelf-Hosted (Docker + FlyWP)
Monthly costStarts at $20+Just server cost
Data privacyLimitedFull control
Custom integrationsRestrictedUnlimited
Performance tuningNo controlFull flexibility
Domain + SSL supportPremium onlyFree via Let’s Encrypt

n8n Docker Installation Guide: Docker Compose + FlyWP

Want to run n8n on your own server without the headaches? Docker Compose makes it easy. In this n8n Docker installation guide, you’ll learn how to spin up n8n and its database in minutes, with no complex setup, no mystery. Just straight-up automation, your way.

Prerequisites:

  • SSH access to your server.
  • Docker and Docker Compose are installed.
  • nginx-proxy container is already running as part of the FlyWP stack.

Step 0: SSH Into Your Server

ssh fly@your-server-ip

Step 1: Create Docker Network

We will create a dedicated network for n8n and connect it to nginx-proxy for potential reverse proxy or SSL handling:

docker network create n8n-network
docker network connect n8n-network nginx-proxy

Step 2: Prepare Docker Compose File

Create a folder and docker-compose.yml file for n8n:

mkdir ~/n8n && cd ~/n8n
nano docker-compose.yml

Paste the following content:

version: '3.8'

services:
  n8n:
    image: n8nio/n8n
    container_name: n8n
    restart: unless-stopped
    environment:
      - N8N_SECURE_COOKIE=false
      - WEBHOOK_TUNNEL_URL=http://<your-server-ip>:5678
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=n8n-db
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_USER=n8n
      - DB_POSTGRESDB_PASSWORD=n8npass
    ports:
      - "5678:5678"
    volumes:
      - n8n_data:/home/node/.n8n
    networks:
      - n8n-network
    depends_on:
      - n8n-db

  n8n-db:
    image: postgres:15-alpine
    container_name: n8n-db
    restart: unless-stopped
    environment:
      - POSTGRES_DB=n8n
      - POSTGRES_USER=n8n
      - POSTGRES_PASSWORD=n8npass
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      - n8n-network

volumes:
  n8n_data:
  postgres_data:

networks:
  n8n-network:
    external: true

Replace <your-server-ip> with your actual server IP.

Step 3: Deploy n8n

Run:

docker compose up -d

This will pull the latest n8n image, set up the container, and start it on port 5678.

Step 4: Access n8n

Open your browser and visit:

http://<your-server-ip>:5678

You will be prompted to create an admin account and can start building workflows.

Alternative: Deploy n8n with SSL and Domain Using Script

If you’d like to automate the setup and include domain and SSL, use the following script:

Script: install-n8n.sh

#!/bin/bash

set -e

EMAIL="[email protected]"  # Replace with your actual email
PORT=5678

read -p "Enter your domain (e.g. automate.example.com): " DOMAIN

echo "🚨 Ensure that Cloudflare proxy (orange cloud) is DISABLED for this domain."
echo "✅ It must be DNS-Only. Otherwise Let's Encrypt HTTP challenge will FAIL!"
read -p "Press Enter to continue..."

echo "🔧 Setting up Docker volumes..."
for volume in nginx_certs nginx_vhost nginx_html; do
  docker volume inspect $volume >/dev/null 2>&1 || docker volume create $volume
done

echo "🔧 Creating Docker networks (if missing)..."
docker network inspect nginx-proxy &>/dev/null || docker network create nginx-proxy
docker network inspect n8n-network &>/dev/null || docker network create n8n-network

echo "🚀 Deploying nginx-proxy..."
if ! docker ps --format '{{.Names}}' | grep -q '^nginx-proxy$'; then
  docker run -d \
    --name nginx-proxy \
    -p 80:80 -p 443:443 \
    -v nginx_certs:/etc/nginx/certs \
    -v nginx_vhost:/etc/nginx/vhost.d \
    -v nginx_html:/usr/share/nginx/html \
    -v /var/run/docker.sock:/tmp/docker.sock:ro \
    --network nginx-proxy \
    --restart unless-stopped \
    nginxproxy/nginx-proxy:alpine
else
  echo "✅ nginx-proxy already running"
fi

echo "🔐 Deploying Let's Encrypt companion..."
if ! docker ps --format '{{.Names}}' | grep -q '^nginx-letsencrypt$'; then
  docker run -d \
    --name nginx-letsencrypt \
    --volumes-from nginx-proxy \
    -v /var/run/docker.sock:/var/run/docker.sock:ro \
    -v nginx_certs:/etc/nginx/certs:rw \
    -v nginx_vhost:/etc/nginx/vhost.d \
    -v nginx_html:/usr/share/nginx/html \
    -e DEFAULT_EMAIL=$EMAIL \
    --network nginx-proxy \
    --restart unless-stopped \
    jrcs/letsencrypt-nginx-proxy-companion
else
  echo "✅ Let's Encrypt companion already running"
fi

# Connect proxy containers to app network
docker network connect n8n-network nginx-proxy || true
docker network connect n8n-network nginx-letsencrypt || true

echo "📡 Ensuring ports 80 and 443 are open..."
if command -v ufw &> /dev/null; then
  sudo ufw allow 80/tcp || true
  sudo ufw allow 443/tcp || true
fi

# PostgreSQL setup
echo "📦 Checking PostgreSQL container..."
if ! docker ps --format '{{.Names}}' | grep -q '^n8n-db$'; then
  docker run -d \
    --name n8n-db \
    -e POSTGRES_DB=n8n \
    -e POSTGRES_USER=n8n \
    -e POSTGRES_PASSWORD=n8npass \
    -v postgres_data:/var/lib/postgresql/data \
    --network n8n-network \
    --restart unless-stopped \
    postgres:15-alpine
else
  echo "✅ PostgreSQL already running"
fi

# Wait for DB readiness
echo "⏳ Waiting for PostgreSQL to be ready..."
until docker exec n8n-db pg_isready -U n8n &>/dev/null; do
  sleep 2
done
echo "✅ PostgreSQL is ready"

# Deploy n8n
echo "🚀 Starting n8n..."
if ! docker ps --format '{{.Names}}' | grep -q '^n8n$'; then
  docker run -d \
    --name n8n \
    -p $PORT:$PORT \
    -e VIRTUAL_HOST=$DOMAIN \
    -e VIRTUAL_PORT=$PORT \
    -e LETSENCRYPT_HOST=$DOMAIN \
    -e LETSENCRYPT_EMAIL=$EMAIL \
    -e N8N_SECURE_COOKIE=false \
    -e DB_TYPE=postgres \
    -e DB_POSTGRESDB_HOST=n8n-db \
    -e DB_POSTGRESDB_PORT=5432 \
    -e DB_POSTGRESDB_DATABASE=n8n \
    -e DB_POSTGRESDB_USER=n8n \
    -e DB_POSTGRESDB_PASSWORD=n8npass \
    -v n8n_data:/home/node/.n8n \
    --network n8n-network \
    --restart unless-stopped \
    n8nio/n8n
else
  echo "✅ n8n already running"
fi

# Trigger cert renewal
echo "🔄 Triggering SSL issuance/renewal..."
docker exec nginx-letsencrypt /app/signal_le_service || true

echo ""
echo "✅ n8n has been deployed successfully!"
echo "🌐 Visit your instance at: http://$DOMAIN/setup"
echo "📋 If SSL fails, ensure DNS is set to DNS-only (not proxied) and port 80 is open."

Make it executable and run it:

chmod +x install-n8n.sh
./install-n8n.sh

Common Errors When Deploying n8n (and How to Fix Them)

Running into issues while deploying n8n? Don’t worry – it happens to the best of us. Here are some common hiccups you might face and how to fix them fast, without tearing your hair out.

IssueCauseFix
n8n-db not reachableDatabase container not readyWait or check container logs
SSL certificate not issuedCloudflare proxy (orange cloud) is onSwitch DNS to DNS-Only
Port already in useSomething else is using 5678Edit the port in Docker Compose
Workflow not savingPermission issue in volumeCheck volume ownership and permissions
Cannot access n8n in browsernginx-proxy not linkedEnsure both containers share a network

Still stuck? Try docker logs <container-name> , it’s your best friend.

FAQs About Running n8n on Docker + FlyWP

How to Set Up n8n Automation with Docker Compose

Got questions about running n8n with Docker on a FlyWP-managed server? You’re not alone. Here are the answers to the most common things users may ask.

Is n8n free to use?
Yes. The core version is open-source, and you can self-host it at no cost. n8n uses a Sustainable Use License and an n8n Enterprise License. The Sustainable Use License is a fair-code license, meaning it restricts commercial hosting for third parties but allows self-hosting for internal business needs and client projects. The Enterprise License is for commercial use and requires a paid subscription. 

Can I use MySQL instead of PostgreSQL?
PostgreSQL is officially recommended and supported. MySQL is not natively supported by n8n.

What port does n8n use by default?
Port 5678. You can change it in your Docker config if needed.

Does n8n support HTTPS?
Yes, when used with nginx-proxy and Let’s Encrypt or any other reverse proxy.

What specs do I need to run n8n on a server?
A small VPS (like 1 CPU, 1–2 GB RAM) is enough to get started. Scale as your workflows grow.

Time to Let n8n Do the Heavy Lifting

So? Now, your own automation playground is live.

Whether you went with the simple Docker Compose setup or the full-blown domain + SSL version, n8n is now ready to automate like a boss. You can automate tasks across services like Slack, Notion, GitHub, and more, right from your server under the FlyWP-managed infrastructure.

From syncing Google Sheets to triggering workflows from webhooks – it’s all just clicks away. No more duct-taping services together. No more limits. You’re in control now.

Happy automating!

Add your first comment to this post