Back to articles
AI & Cloud

Multi-VPS Cluster Architecture with Coolify: An Effective Self-Hosted PaaS Solution Replacing Heroku and Render

A detailed guide to building a multi-VPS cluster with Coolify for effective self-hosted application deployment, replacing Heroku and Render. Covers configuration, optimization, and...

DPTCloud Engineering5 min read
Multi-VPS Cluster Architecture with Coolify: An Effective Self-Hosted PaaS Solution Replacing Heroku and Render

Introduction to the Self-Hosted PaaS Solution with Coolify

In an era of increasing demand for self-hosted application deployment, many businesses and individuals are seeking alternatives to Heroku and Render—two popular PaaS platforms with limitations in cost, control, and flexibility. Coolify, an open-source self-hosted PaaS (Platform as a Service), offers an effective solution for building a multi-VPS cluster, enabling efficient deployment, operation, and monitoring of multiple applications across multiple virtual private servers (VPS).

Unlike Heroku and Render, Coolify gives you full control over your infrastructure, allowing cost optimization and customization to meet specific needs. With a multi-node cluster architecture, you can ensure high availability, load distribution, and easy scalability. This guide will walk you through building and operating a multi-VPS cluster with Coolify, from infrastructure setup to application deployment and system monitoring.

Infrastructure Preparation and VPS Configuration

To build an effective multi-VPS cluster with Coolify, you need at least two VPS instances (more can be added as needed). These VPS instances should be located in different physical regions to improve availability. Each VPS must meet the following basic requirements:

  • OS: Ubuntu 22.04 or Debian 11+
  • RAM: Minimum 4GB (6GB or more for environments with multiple applications)
  • Storage: SSD with 20GB or more
  • Public IPv4 address
  • Ensure necessary ports are open (80, 443, 22, 8080, 3000, etc.)

On each VPS, install Docker and Docker Compose, which are essential for Coolify to deploy applications.

Perform on each VPS:

# Update the system
sudo apt update && sudo apt upgrade -y

# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Deploying Coolify on a Multi-VPS Cluster

Coolify supports multi-node deployment through a multi-node cluster mechanism. To configure this, you need to designate one VPS as the primary node and the others as worker nodes.

On the primary node, install Coolify with the required options to manage the cluster:

# Install Coolify on the primary node
docker run -d \
  --name coolify \
  --restart unless-stopped \
  -p 3000:3000 \
  -e DATABASE_URL=postgresql://coolify:coolify@localhost:5432/coolify \
  -e REDIS_URL=redis://localhost:6379 \
  -e COOLIFY_NODE_TYPE=primary \
  -e COOLIFY_NODE_ID=primary \
  -e COOLIFY_NODE_ADDRESS=your-primary-node-ip \
  -e COOLIFY_NODE_PORT=3000 \
  -e COOLIFY_NODE_SECRET=your-secret-key \
  -e COOLIFY_NODE_TOKEN=your-token \
  coolify/coolify

On each worker node, install Coolify with worker node configuration:

# Install Coolify on the worker node
docker run -d \
  --name coolify \
  --restart unless-stopped \
  -p 3000:3000 \
  -e DATABASE_URL=postgresql://coolify:coolify@localhost:5432/coolify \
  -e REDIS_URL=redis://localhost:6379 \
  -e COOLIFY_NODE_TYPE=worker \
  -e COOLIFY_NODE_ID=worker1 \
  -e COOLIFY_NODE_ADDRESS=your-worker-node-ip \
  -e COOLIFY_NODE_PORT=3000 \
  -e COOLIFY_NODE_SECRET=your-secret-key \
  -e COOLIFY_NODE_TOKEN=your-token \
  coolify/coolify

Where:

  • COOLIFY_NODE_TYPE: Sets the node type (primary or worker)
  • COOLIFY_NODE_ID: Defines the node identifier (e.g., worker1, worker2)
  • COOLIFY_NODE_ADDRESS: The IP address of the node (used for the primary node)
  • COOLIFY_NODE_SECRET and COOLIFY_NODE_TOKEN: Secret keys generated from the primary node for worker authentication

Monitoring and System Optimization

To ensure system stability, deploy monitoring tools. An effective solution is using Uptime Kuma to monitor nodes in the cluster.

You can deploy Uptime Kuma on a separate VPS or on the primary node. The setup is straightforward:

docker run -d \
  --name uptime-kuma \
  -p 3001:3001 \
  -e TZ=Asia/Ho_Chi_Minh \
  -v uptime-kuma:/app/data \
  --restart unless-stopped \
  louislam/uptime-kuma:1

In the Uptime Kuma interface, add URLs for each Coolify node (e.g., http://primary-node-ip:3000) to monitor their operational status.

For performance optimization, consider:

  • Running low-load applications on the primary node
  • Distributing high-load applications across worker nodes
  • Setting up load balancing using Nginx or Traefik to distribute traffic across nodes
  • Implementing auto-scaling for applications with fluctuating load

Testing and Troubleshooting

To test the cluster, deploy a simple application (e.g., a Node.js web page) through Coolify's management interface.

In case of issues, check the following:

  • Ensure ports (3000, 80, 443) are open on the firewall (UFW or iptables)
  • Check Coolify container logs: docker logs coolify
  • Verify nodes can communicate with each other (ping, telnet to port 3000)
  • Confirm environment variables (NODE_TYPE, NODE_ID, NODE_SECRET) are correct
  • Ensure Redis and PostgreSQL are running and accessible

If a worker node does not appear in the Coolify interface, verify the token and secret, or check logs for authentication errors.

References

For deeper understanding of Coolify and cluster architecture, refer to:

Related infrastructure & engineering guides: High-RAM Cloud VPS for Self-Hosted LLMs & API Gateways

DPTCloud Tier III Infrastructure

High-RAM Cloud VPS Plans Optimized for AI, Databases & Cache

Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.

View 22 VPS Plans
ECO · vn-02Recommended

VPS-4E

297.000 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe
ECO · vn-02

VPS-5E

614.900 ₫ / mo

10% VAT included

  • CPU: 8 vCPU
  • RAM: 16 GB
  • SSD: 100 GB NVMe
ADVANCED · vn-03Recommended

VPS-4T

548.900 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe

Related Articles

View all
ZaloZalo SupportDiscord0384 753 478