- "What could go wrong?"
He said to himself, unknowingly.
Hi everyone. Long time no see!
I'll have to excuse myself for disappearing for so long. It has been difficult to keep up with university admission tests and my final year of high school so I did not have much time to work on this blog. However my tech journey did not stop during this time frame.
You may remeber that last time we met we worked on writing and hosting a simple website without spending more than a couple euros. This time instead I will show you a "proper" homelab that I was able to build thanks to our sponsor using the money I got from INPS (the Italian national institute for social security).
One last thing, if you want to learn more about networking, hosting and get that nerd high I cannot stress enough how fun self-hosting can be. You do not need expensive hardware to start but beware you might end up losing track of time working on your server and go to sleep at 3AM on a weekday.
Let's start our journey from the hardware.
Picking the right pieces to build your dream homelab is all but easy and there are a number of factor you have to take into account. Personally I wanted it to be powerful enough to run a minecraft server for me and my friends and a streaming service for my family (therefore I needed a CPU with an integrated graphic card) without it being too power hungry given the current condition of electricity prices in Italy.
After some research I stubled upon this video by 'Wolfgang's Channel' which suggested a Motherboard + CPU mini ITX which had enough SATA ports for all the disks I wanted to add and more.
The aforementioned CPU is an Intel Pentium N6005 with a low TDP of about 10W to which I connected three used 6TB hard disks (buy them new if you can), one 250GB NVME ssd (the cheapest stick since it will only contain the OS and a couple of containers) and 16GB of DDR4 SO-DIMM RAM which I intend on upgrading to 32GB as soon as possible.
To power it all I initally intended on using a PicoPSU but I soon realized that I had made some mistakes when calculating the total power draw of the system and I had to buy a proper PSU from Amazon.
If you want to replicate my setup I will give you a couple of tips to pick what best suits you:
As for the hypervisor to run on the server I chose proxmox because it is an open source solution with a free tier (which is more than enough for an home project) and makes it easy to create virtual machines and container with ease.
As I was quite overwhelmed by the amount of services I had to setup (and struggled to understand the difference between a container and a virtual machine) I loosely followed this tutorial. However, as I mentioned earlier, the sketchy "power supply" I was using could not handle the energy consumption of three hard drives spinning up and -because all the electronics are exposed- it would power off if it came into contact with anything.
While I ordered my new PSU I finished setting up Proxmox (despite it not liking my peripherals if I connect them to the USB 3.0 ports) which took more time than I expected as I typed the wrong subnet mask during the setup and could not figure out why it was impossible to find the web UI.
As the new PSU arrived I finished setting up truenas inside a vm and created my first pool. To have more control over the hard disks I passed them through the virtual machine and set up an SMB share and a routine to backup my google drive (I currently use my school's google account to have virtually infinite space to store files on but I am afraid that they will cut me off as soon as I finish my fifth year). Unfortunately, due to network limitations, the transfer speed I can currently achieve is around 10.5-11 Mb/s which is mediocre at best.
After creating the SMB share i had some issues attaching to it from my linux machine. For anyone struggling to do it (just like I did) you can simply create a folder where you want to mount the share and the add to /etc/fstab something along the lines of:
//192.168.X.X/path_to_folder_on_server /path_on_local_machine -o username=add_your_username,password=add_your_password,vers=2.0,file_mode=0777,dir_mode=0777
#!/bin/bash
# Start a new tmux session named "ngrok"
tmux new-session -d -s ngrok
# Send the ngrok command to the tmux session
tmux send-keys -t ngrok 'ngrok tcp 25565' C-m
# Wait for ngrok to initialize (adjust the sleep duration as needed)
sleep 5
# Get the public URL from ngrok
public_url=$(curl localhost:4040/api/tunnels | jq -r '.tunnels[0].public_url' | sed 's/^.\{6\}//')
# Send the public URL to Discord webhook
curl -X POST -H "Content-Type: application/json" -d '{"content":"'"$public_url"'"}' webook link