DEV Community

Cover image for Homelab - Lego for tech enthusiasts
Michal Šimon
Michal Šimon

Posted on

Homelab - Lego for tech enthusiasts

I’m a cloud enthusiast who loves tinkering with different technologies and learning new things. That’s why I have decided to invest quite some time in setting up my own homelab, a computing environment where I can run my applications and services, experiment with different configurations and scenarios, and have fun with my gadgets. In this article, I want to share what a homelab is, how I built mine, and why you should consider building one too.

What is a Homelab

A homelab is your personal computing playground. A small on-premise solution for anything you want to test, experiment and learn on. It’s a great way how to build a piece of infrastructure to serve some non-critical workload, let it break, and fix it again to reveal opportunities for improvement in your architecture design. It’s also great for gaining hands-on experience and deepening your understanding of infrastructure concepts.

HP ProLiant MicroServer Gen10 Plus

Among all the fun, homelab also comes with several challenges. Mainly it’s time, money, and energy to set up and maintain some extra hardware. Trust me, it’s a great commitment so make sure you manage your expectations accordingly. It can generate noise and heat, or pose a security risk if not properly configured. However, it’s a great way to have fun with technology without being afraid of breaking something serious (like production at work) and can be a rewarding experience.

The “hard” Lego pieces

The main server of my homelab is an HP ProLiant MicroServer Gen10 Plus with an Intel Xeon E-2224 CPU, 16 GB of memory, 512GB NVMe SSD, and three 2TB 3.5 NAS hard drives.

For networking, I use several Mikrotik routers and switches, including the Mikrotik RB4011iGS+5HacQ2HnD-IN, which is a powerful router with a quad-core CPU, 1 GB of RAM, 10 Gigabit ports, and dual-band 4x4 802.11ac wireless. This router acts as the gateway and firewall for my homelab network as well as providing wireless connectivity.

I also have two Reolink IP cameras which we will explore deeper in the following computer vision articles. These cameras have 4K resolution, night vision, and motion detection, and can stream video to my server or cloud storage.

Finally, I have a Raspberry Pi 4 model B with 8GB RAM that I use for running additional applications that do not require much computing power. Some parts of this infrastructure are backed up by a UPS unit connected to a 12V car battery.

Homelab Network Topology

The “soft” Lego pieces

I have various applications and services running on my homelab, each with its own purpose. I use Proxmox as my main hypervisor, which allows me to create and manage multiple virtual machines on my HP server. All VMs leverage the NVMe SSD, which offers high performance and low latency. One of the virtual machines I run is TrueNAS Scale, which covers all my storage needs, such as file sharing, backups, media streaming, and more for my whole homelab. It has direct access to the 3x 2TB hard drives in my server, which are configured as direct pass-through devices. This way, I can use the full capacity and performance of the hard drives without any overhead from the hypervisor.

Physical Server Schema

One of the advantages of using TrueNAS Scale is that it supports ZFS, a modern filesystem that offers many features such as snapshots, compression, and encryption. For my 6TB total hard drive storage capacity, I chose to use RAIDZ1, which is ZFS’s equivalent of RAID5. RAIDZ1 uses a parity block to store redundant information that can be used to recover data if one of the hard drives fails. This way, I achieve a balance between durability and performance, as I get 4TB of usable storage and protection against single-drive failure. As a side effect, it also gives me double the HDD read speed, as it can read parts of the same file from two drives at once.

RAIDZ1 Overview in TrueNAS Scale

ZFS is not only a filesystem, but also a volume manager that allows me to partition the storage into multiple datasets based on the use case. Datasets are like sub-filesystems that can have their own properties, such as compression, encryption, quotas, and permissions. For example, for large video files, it is better to configure a dataset differently than for many small text files to achieve the best performance. Additionally, TrueNAS allows me to connect to the storage through many different protocols. For instance, in my case, I use SMB, FTP, and S3 thanks to MinIO.

MinIO Overview

TrueNAS Scale runs among other services its own instance of K3s, which is a lightweight Kubernetes distribution that allows extensibility on top of the ZFS storage solution. In my case, I run a MariaDB database in a container with a persistency layer in its own ZFS dataset. Finetuning the dataset for a relational database type of workload with regular snapshots and encryption was quite a challenge but I learned a lot.

Gotta talk about the cloud

Having a homelab makes me a better cloud architect

I am probably not giving away any spoilers by saying that almost everything in the cloud runs on top of bare metal servers. The cloud provider may abstract us from the complexity of managing the hardware, network, and security aspects of the infrastructure, but I do believe that this knowledge can be essential. By having some hands-on experience and seeing what is happening under the hood, I can gain a deeper understanding of how different components interact, how to troubleshoot issues, and how to optimize performance and scalability.

Just to be clear, in no way am I saying that managed cloud services are bad. Quite the opposite, I am a huge fan of AWS Lambda, AppSync, and many other services that make development easier and faster. However, I have felt that my lack of understanding of the underlying systems prevented me from designing the best architecture possible. But that’s just me, trying to be a perfectionist.

Homelab and cloud?

As a cloud enthusiast, I could not stop my mind from drawing parallels between my homelab and the cloud. To the extent that I could directly link my on-premise solution to some cloud concepts. Yes, it sounds a little bit ridiculous but bear with me, please.

My HP Server with Proxmox is like an AWS Availability Zone with a single server rack unit. Unfortunately, I can not plan for high availability just yet due to this limitation. Proxmox interface is comparable to an AWS Console where I can spin up new resources and monitor their utilization.

Proxmox Resources

The cloud is usually on a very high level categorized as Network, Storage, and Compute. Almost all services require all three to operate, however, we can simply think about them so.

In my case, the Networking is done through my Mikrotik routers where I can manage my firewall, routing tables, subnets, and IP ranges. This is similar to AWS VPC and Security Groups.

Compute is covered by Proxmox which provides a building block of a Virtual Machine. This is similar to the AWS EC2 service.

The Storage part is handled by TrueNAS which provides services like MinIO S3, FTP, SMB, and MySQL which is comparable to AWS S3, RDS, and so on.

Comparison between AWS and Homelab

It would be nice to have support for serverless functions and other higher-level services, however, that’s one of the main reasons why it makes more sense to run your workload in the cloud instead of on-premise. The cloud offers more flexibility, scalability, reliability, and features than a homelab can ever provide. However, a homelab also has its advantages, such as lower cost (depending on the usage), more control over the hardware and software, and more fun for crazy people like me. 🙂

(Let me know if you would be interested in seeing Knative in my homelab.)

Conclusion

Homelab is the ideal place for me to experiment, make mistakes and learn from them. It has given me a lot of insight into the cloud and the amazing work that cloud providers do behind the scenes.

By running my own servers, I have gained hands-on experience with different technologies and systems administration skills. I have also learned to appreciate the convenience, flexibility, scalability, and reliability of cloud services that abstract away many of the complexities and challenges of running your own infrastructure.

At the end of the day, there are servers under the serverless functions and managed services, and as Werner Vogels, the CTO of AWS says: “Everything fails all the time”. It’s good to then know how the magic of the cloud works and how to fix it in case of a need.

I have thoroughly enjoyed building my own “personal cloud” and will be using it for various purposes, such as media streaming, file sharing, backups, and more. Homelab is a rewarding experience that I would recommend to anyone who is interested in technology and wants to grow their skills and knowledge.

Big thanks goes to TechnoTim, Lawrence Systems, and all the open-source software this project could not have happened without.

Top comments (0)