Setting up my Home Server

July 28, 2024 (1mo ago)

I have an old Asus ROG G14 laptop that I am not using anymore and wanted to use it as a server to replace using cloud services like Azure, Railway, and Vercel.

I want to eventually use this to replace my entire cloud infrastructure for my personal projects.

Specs

Asus ROG G14

CPU

Architecture:           x86_64
  CPU op-mode(s):       32-bit, 64-bit
  Address sizes:        44 bits physical, 48 bits virtual
  Byte Order:           Little Endian
Model name:             AMD Ryzen 9 4900HS with Radeon Graphics
  CPU family:           23
  Model:                96
  Thread(s) per core:   2
  Core(s) per socket:   8
  Socket(s):            1
  Architecture:        x64

GPU

CUDA supported GPU, who wouldn't want that?

Older NVIDIA GeForce RTX 2060 Super (6GB). Not the fanciest, but will do the job for a lot of my personal projects.

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.183.01             Driver Version: 535.183.01   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 2060 ...    Off | 00000000:01:00.0 Off |                  N/A |
| N/A   34C    P8               2W /  65W |      6MiB /  6144MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      2376      G   /usr/lib/xorg/Xorg                            4MiB |
+---------------------------------------------------------------------------------------+

Setup

Prepare Windows for Dual Boot

  • Cleared up over 250GB of space on my C: drive.
  • Spent 5+ hours trying to figure out how to defrag and resize my partitions.
  • Default defrag tool was not working for some reason. It would defrag, but "Shrink my Volume" would only allow me to shrink the volume by at most 25GB.
  • Downloaded PerfectDisk which initially seemed to work better, but the then "Shrink my Volume" would allow me to shrink it even less thatn 7GB now.
  • I updated my computer, cleared out the trash and restore points, and tried everything.
  • I just decided to proceed without shrinking the volume, and instead just attempt to install Ubuntu on it.
  • Downloaded Ubuntu 24.04 LTS on a USB flash drive by following the official installation guide.

Install Ubuntu

I honestly just plugged in the USB drive, booted up, and followed the on-screen instructions to install Ubuntu.

It luckily allowed me to allocate a portion of my hard drive for Ubuntu, and I was able to install it without any issues.

Install software

Update/Upgrade the system:

sudo apt update && sudo apt upgrade -y
  • Git (sudo apt install git)
  • GitHub CLI
  • Connected to my GitHub account using gh auth login and generating a personal access token
  • Docker (sudo apt install docker.io)
  • Set up the docker group: sudo groupadd docker
  • Add the current user to the docker group: sudo usermod -aG docker $USER
  • Start the docker service: sudo systemctl start docker
  • Enable the docker service: sudo systemctl enable docker
  • Allow non-root users to run Docker commands: sudo chmod 666 /var/run/docker.sock
  • Verify that you can run docker run hello-world

That was all I needed before installing Coolify.

Set up Cloudflare Tunnel

What is a Tunnel?

A tunnel is a secure connection between your local machine and Cloudflare's network. It allows you to expose your local machine's services to the internet.

This is necessary to access services hosted on my home server from outside my local network.

Cloudflare Tunnel Docs

Install Cloudflare Tunnel

sudo apt install cloudflared

Cloudflare Tunnel Setup gives you the code to run on your local machine to set up the tunnel.

Setup Tunnels

I created a simple tunnel to host the Coolify Next.js Example.

I will be hosting this on port 3000 so I will create a tunnel from localhost:3000 to test.punitarani.com.

You can use a similar setup to add more tunnels for different services.

Install Coolify

Installed and set up Coolify using official docs

This was relatively straightforward, with very minor issues.

Setup Coolify

First, I register for an account on the hosted Coolify dashboard, I will set up Multi-Factor Authentication (MFA).

Then, I will set the Coolify instance domain to coolify.punitarani.com.

Lastly, I will first create a DNS Tunnel for localhost:8000 to coolify.punitarani.com. This will allow me to access the Coolify dashboard from anywhere.

Connect GitHub

I connected my GitHub account to Coolify using the Integration Docs.

Host a test app

I will host the Next.js example app on my home server using Coolify.

I followed the Official Next.js Deployment Guide.

The only addition, was I updated the Domain to test.punitarani.com and the port mapping to 3000:3000.

Conclusion

This was a fun project to set up my home server and host my web apps and services.

I don't have to worry about the costs of cloud services and can access my services from anywhere.

I will continue to add more services and apps to my home server and eventually replace all my cloud services with this.