Logo Cinquin Andy Signature

VPS installation and configuration guide for Coolify

Développeur Freelance - Logo

The sites and the associated resources.

VPS installation and configuration guide for Coolify

Posted on  - February 8, 2025 by Andy Cinquin

VPSCoolifyCloudflare

Complete Guide: VPS Setup and Coolify Installation

Introduction

This guide will walk you through the step-by-step process of setting up a VPS to host Coolify, including purchasing a domain name from Cloudflare. We'll cover all the necessary steps to achieve a secure and functional environment.

Table of Contents

  1. VPS Purchase and Initial Configuration
  2. Domain Name Configuration with Cloudflare
  3. Server Security Setup
  4. Coolify Installation

1. VPS Purchase and Initial Configuration

Choosing a Host

There are several reputable VPS providers:
  • Hetzner
  • Netcup (recommended)
  • OVH
  • Scaleway
  • Contabo
For this tutorial, we recommend Hetzner or Netcup for their excellent value for money.

Recommended Minimum Configuration

To run Coolify comfortably, choose at minimum:
  • 2 CPU cores
  • 4 GB RAM
  • 40 GB SSD storage

First Connection

After purchasing your VPS, you'll receive by email:
  • Your server's IP address
  • The initial root password
Connect via SSH:
ssh root@your_ip

Initial System Update

apt update && apt upgrade -y
Installing essential packages:
apt install sudo ufw curl wget git jq openssl vim tmux fish -y

2. Domain Name Configuration with Cloudflare

  1. Create an account on Cloudflare.com
  2. Add your domain to Cloudflare
  3. In the DNS section, add two A records:
    First record (main domain):
    • Type: A
    • Name: coolify (or your chosen subdomain, or your main domain)
    • Content: Your_VPS_IP
    • Proxy status: Disabled (gray icon)
    Second record (wildcard for subdomains):
    • Type: A
    • Name: * (asterisk)
    • Content: Your_VPS_IP
    • Proxy status: Disabled (gray icon)
This wildcard configuration (*.your-domain.com) will allow Coolify to automatically create subdomains for each of your deployed applications. For example:
  • app1.your-domain.com
  • api.your-domain.com
  • staging.your-domain.com
  • etc.
All these subdomains will automatically point to your VPS server, and Coolify will handle routing traffic to the correct application based on the subdomain used.

3. Server Security Setup

Creating a Non-Root User

# Create user
useradd -m -s /bin/fish your_user
usermod -aG sudo your_user
passwd your_user

# Logout
exit

SSH Keys Configuration

On your local machine:
# Generate key
ssh-keygen -t ed25519 -C "your_email@domain.com"

# Copy public key to server
ssh-copy-id -i ~/.ssh/id_ed25519.pub your_user@your_ip

Secure SSH Configuration

On the server:
sudo vim /etc/ssh/sshd_config
Modify/add the following lines:
PubkeyAuthentication yes
PasswordAuthentication no
PermitRootLogin no
Restart SSH service:
sudo systemctl restart sshd

Firewall Configuration

# Enable essential ports
sudo ufw allow 22
sudo ufw allow 80
sudo ufw allow 443

# Enable firewall
sudo ufw enable

4. Coolify Installation

System Prerequisites

Coolify requires Docker to be installed on the system. The automatic installer will handle this for us.

Automatic Installation

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

Initial Setup

  1. Access your Coolify instance at: http://your_ip:8000
  2. Create your admin account
  3. Configure the following settings:
    • Custom domain name
    • SSL activation with Let's Encrypt
    • Backup configuration

Security Best Practices

  1. Enable two-factor authentication
  2. Configure regular backups
  3. Monitor logs regularly
  4. Keep the system updated

Maintenance

Updates

To update Coolify:
cd /data/coolify/source
sudo bash upgrade.sh

Backups

Configure automatic backups in the Coolify interface:
  1. Settings > Backups
  2. Configure frequency and retention
  3. Test restoration regularly

Conclusion

You now have a secure VPS server running Coolify, accessible via your custom domain name. Remember to:
  • Regularly monitor security updates
  • Maintain up-to-date backups
  • Document your custom configurations
  • Monitor resource usage

Additional Resources




🚀 Thanks for reading!
If you enjoyed this article, feel free to share it around.

💡 Got an idea? Let's talk !

DEVELOP YOUR PROJECTS TOGETHER

An idea, a project? I'm here to answer your questions and help you.
I'd be delighted to discuss your project with you!