Setting Up Coolify on Hetzner Cloud: A Complete Guide

Setting Up Coolify on Hetzner Cloud: A Complete Guide

Introduction

Coolify is a self-hostable Heroku/Netlify alternative that makes deploying your applications easier than ever. In this guide, we'll walk through setting up Coolify on a Hetzner Cloud server, from initial server setup to running your first deployment. We chose Hetzner because of its cost-effectiveness and high-performance servers, which provide an excellent balance of price and performance compared to its competitors like DigitalOcean and AWS.

Prerequisites

  • A Hetzner Cloud account (use my link to get 20 € credit to test out)
  • Basic command line knowledge
  • SSH client installed on your local machine
  • Domain name (optional but recommended)

Step 1: Creating a Hetzner Server

  1. Log in to your Hetzner Cloud Console.
  2. Click "Add Server."
  3. Choose these recommended specifications:
    • Ubuntu 22.04 LTS
    • Minimum 2 CPU / 4GB RAM (CPX21)
    • Select your preferred datacenter location
    • Add your SSH key

Why Choose Hetzner?

Hetzner offers significantly more competitive pricing compared to other cloud providers like AWS and DigitalOcean. For instance, Hetzner's CPX21 plan with 2 vCPUs and 4GB RAM costs approximately €6.90 per month, while a comparable Droplet from DigitalOcean costs around $24 per month. Similarly, AWS EC2 pricing can be much higher for equivalent resources. This makes Hetzner an ideal choice for developers looking for powerful yet affordable cloud infrastructure.

Step 2: Initial Server Setup

First, connect to your server:

ssh root@your_server_ip

Update the system:

apt update && apt upgrade -y

Step 3: Installing Coolify

The installation process is straightforward using the official Coolify install script:

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

This script will:

  1. Install Docker if not present
  2. Pull necessary Coolify containers
  3. Set up the initial configuration

Step 4: Configuration

After installation completes, you'll see output with:

  1. The URL to access your Coolify dashboard
  2. Initial credentials

Security Recommendations

  1. Configure UFW firewall:
ufw allow ssh
ufw allow http
ufw allow https
ufw enable
  1. Create a non-root user (optional but recommended):
adduser coolify
usermod -aG sudo coolify

Step 5: Accessing Coolify

  1. Open your browser and navigate to:
http://your_server_ip:3000
  1. Log in using the credentials provided during installation.

Step 6: Domain Setup (Optional)

To use a custom domain:

  1. Add DNS A record:
    • Point your domain to your server IP
    • Wait for DNS propagation
  2. In Coolify dashboard:
    • Navigate to Settings
    • Update the domain settings
    • Enable SSL if desired

Common Issues and Troubleshooting

Docker Issues

If Docker isn't starting properly:

systemctl status docker
journalctl -u docker

Permission Issues

If you encounter permission errors:

chmod 666 /var/run/docker.sock

Network Issues

Check if ports are properly exposed:

netstat -tulpn | grep LISTEN

Maintenance Tips

  1. Regular Updates
coolify update
  1. Backup Important Data
cd /var/lib/coolify
tar -czf coolify-backup.tar.gz data

Conclusion

You now have a fully functional Coolify instance running on Hetzner Cloud. You can start deploying your applications, setting up databases, and managing your infrastructure through the Coolify dashboard. By choosing Hetzner, you've opted for a provider that offers excellent performance at a fraction of the cost compared to major cloud providers.

Next Steps

  • Set up your first application deployment
  • Configure automatic backups
  • Set up monitoring and alerts
  • Explore Coolify's marketplace for additional services

Remember to regularly check Coolify's official documentation for updates and new features.