
ខ្ញុំលែងប្រើ Cloud ហើយធ្វើ HomeLab Server មួយខ្លួនឯង | Moving from Cloud to Home Lab | TFDevs
TFDevs
Overview
This video details a personal journey of transitioning from cloud-based services to a self-hosted home lab server. The creator explains the motivations, including cost savings and greater control, and outlines the hardware and software choices made. The process involves setting up a mini-PC as a hypervisor, configuring virtual machines for various roles like gateway, monitoring, CI/CD, and database, and implementing infrastructure as code using Terraform for management. The video also touches upon network security with Cloudflare Tunnel for secure remote access and zero-trust principles. Finally, it discusses the cost-benefit analysis and future expectations for the home lab.
Save this permanently with flashcards, quizzes, and AI chat
Chapters
- The creator was spending a significant amount ($30-40/month) on cloud services for databases and other infrastructure.
- A desire for greater control and ownership over their digital infrastructure led to the decision to build a home lab.
- Previous attempts were hindered by lack of time and resources, but a firm decision was made to proceed.
- The goal is to host all projects and migrate infrastructure from the cloud to the home lab.
- A mini-PC from brand GM (a Chinese company) was purchased for $260.
- The PC includes a Ryzen 7 3700 CPU (2.0 GHz base, 4.5 GHz boost) with 16MB L3 cache and 4MB L2 cache.
- The CPU has a low TDP of 15W, consuming only 45W under load, making it power-efficient.
- Additional components purchased include 64GB of RAM and an SSD.
- An Uninterruptible Power Supply (UPS) was also acquired to handle power outages, providing several hours of backup for the low-power system.
- The creator chose a Type 2 hypervisor approach, installing Proxmox VE as the operating system.
- Proxmox VE is an open-source platform that manages virtual machines and containers.
- The home lab machine is divided into 8 virtual machines (VMs), each with a specific role.
- A 'gateway' VM acts as the single entry point for all network requests, enhancing security.
- Remote access is managed via SSH and a web interface.
- VM 1: Gateway (1 CPU, 2GB RAM) - Handles all incoming requests.
- VMs 2-3: Cluster (2 CPUs, 4GB RAM each) - For general workloads.
- VM 4: Monitoring (2 CPUs, 6GB RAM) - For tools like Grafana and Prometheus.
- VM 5: Database (2 CPUs, 6GB RAM) - For hosting databases like Hbase, with considerations for performance vs. containerization.
- VM 6: CI/CD (2 CPUs, 5GB RAM) - For build and deployment pipelines.
- VM 7: Database (4 CPUs, 6GB RAM) - A separate, more powerful VM for databases.
- The total allocated vCPUs (21) slightly exceed the physical CPU cores (8), indicating a mild overcommit strategy that is acceptable due to non-constant VM load.
- Manual configuration of each VM is tedious and error-prone.
- Terraform is used for Infrastructure as Code (IaC), allowing the definition of the desired infrastructure state in code.
- This approach enables reproducible deployments and easy management of changes.
- Code allows for version control, making it possible to track changes, revert to previous states, and easily rebuild the infrastructure if hardware fails.
- Changes like adding RAM or new VMs can be managed by updating the Terraform code and applying the changes.
- To securely access the home lab from outside the network, Cloudflare Tunnel is implemented.
- This creates a secure, outbound-only connection from the home lab to Cloudflare's network.
- Only traffic routed through Cloudflare is allowed, enhancing security by not exposing direct ports.
- A Cloudflare agent runs on the gateway VM, and another is set up on the Proxmox host.
- This setup supports zero-trust principles, ensuring that only authenticated and authorized traffic can access services.
- The total initial cost for the home lab build was approximately $675.
- This includes the PC, RAM, SSD, and UPS.
- Compared to the $30-40 monthly cloud spend, the home lab breaks even financially within about 1.5 to 2 years.
- The creator anticipates significant cost savings in subsequent years.
- The creator plans to provide future updates on new configurations and learnings.
Key takeaways
- Transitioning to a home lab can offer significant cost savings and greater control over infrastructure compared to cloud services.
- Careful selection of hardware, balancing performance, cost, and power efficiency, is key for a home lab.
- Virtualization platforms like Proxmox VE are essential for efficiently running multiple services on a single machine.
- Infrastructure as Code (IaC) tools like Terraform are critical for managing and automating the setup and maintenance of complex server environments.
- Implementing robust security measures, such as Cloudflare Tunnel, is vital for protecting a home lab from external threats.
- The initial investment in a home lab can be recouped over time through reduced operational expenses compared to cloud providers.
- A well-planned home lab can serve as a powerful learning platform for exploring server administration, networking, and DevOps practices.
Key terms
Test your understanding
- What were the primary motivations for the creator to move from cloud services to a home lab?
- How does the choice of hardware, such as the CPU's TDP, impact the overall efficiency and cost of a home lab?
- What is the difference between Type 1 and Type 2 hypervisors, and which did the creator choose and why?
- How does using Infrastructure as Code (IaC) with tools like Terraform benefit the management and maintenance of a home lab?
- What security advantages does Cloudflare Tunnel provide for a home lab server, and how does it relate to zero-trust principles?