DEV Community

Cover image for Add new server to Coolify instance
DanielBetterDevelopers
DanielBetterDevelopers

Posted on

Add new server to Coolify instance

When managing multiple servers and deploying applications, it’s crucial to have a streamlined system that simplifies server management and deployment workflows. Coolify is a powerful, self-hosted platform that allows you to deploy applications with minimal setup. In this guide, we’ll walk through the steps to connect a new server to your Coolify instance and set it up for seamless application deployment. Whether you're using a VPS provider like Hetzner or DigitalOcean, this guide will help you configure secure SSH access, set up key authentication, and validate the server with Coolify for future deployments.

By the end of this tutorial, you’ll have everything in place to deploy your solutions to a newly connected server with ease.

Prerequisites

  • Server A: Running a Coolify instance for managing deployments.
  • Server B: A VPS with SSH access via port 22 (e.g., from Hetzner).

Step 1: Purchase and Set Up Server B

  1. Purchase Server B from your preferred VPS provider (e.g., Hetzner, DigitalOcean).

  2. Make sure Server B is up and running. You can access it using SSH:

ssh root@your-server-ip
Enter fullscreen mode Exit fullscreen mode

   Note: Ensure port 22 is open to enable SSH access.

  1. [Optional]: Update and secure Server B by running:
sudo apt update && sudo apt upgrade -y
Enter fullscreen mode Exit fullscreen mode

Step 2: Generate RSA SSH Key in Coolify

  1. On Server A, open Coolify and navigate to Keys and Tokens in the side menu.

  2. Click Add to create a new SSH key.

  3. Select Generate new RSA SSH Key. Coolify will create the key for you.

  4. Copy the Public Key that was generated, and then click Continue.

Step 3: Add the Public Key to Server B

  1. On Server B, navigate to the .ssh directory:
cd ~/.ssh/
Enter fullscreen mode Exit fullscreen mode
  1. Open the authorized_keys file with a text editor (e.g., nano):
sudo nano authorized_keys
Enter fullscreen mode Exit fullscreen mode
  1. Paste the Public Key you copied earlier at the bottom of the file.

  2. Save the file with Ctrl + O, press Enter, and exit with Ctrl + X.

Verification: After adding the key, try logging into Server B again using SSH:

ssh root@your-server-ip
Enter fullscreen mode Exit fullscreen mode

If you log in without being prompted for a password, the key was added successfully.

Step 4: Add Server B to Coolify

  1. Return to Coolify on Server A, and navigate to Servers.

  2. Click Add, and provide the following information:

   - Name: A descriptive name for Server B.

   - IP Address/Domain: The public IP or domain of Server B.

   - Private Key: Select the RSA key generated earlier.

   - Username: Set to root, unless you’ve changed the default username.

  1. After filling in the details, click Continue.

  2. On the next screen, click Validate Server & Install Docker Engine to complete the setup.

Next Steps

Now that you’ve added Server B to Coolify, you can start deploying applications or Docker containers. Enjoy!

Top comments (0)