DEV Community

Cover image for Add new server to Coolify instance
DanielBetterDevelopers
DanielBetterDevelopers

Posted on

4

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!

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (1)

Collapse
 
kozmotronik profile image
Kozmotronik

It is well described, thank you Daniel!

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay