In the previous article we discussed the hardware choices for building a home data center, and in this article we will mainly discuss the choice of software environment.
Choice of deployment method
Currently, we have two mainstream methods for deploying applications: LNMP (LAMP) or Docker.
Using LNMP (LAMP)
This is what we commonly refer to as source code deployment, suitable for direct deployment on bare-metal servers. This method incurs no performance loss for the server, and mutual calls and access between applications are very convenient. The disadvantage is that the early deployment preparation is complex, requiring various compilations, and migration later on is very inconvenient.
Docker
This method greatly increases deployment flexibility and portability, and can be used in conjunction with container cluster management systems like K8s to achieve automated deployment, auto-scaling, and maintenance of container clusters. The disadvantage is a minor performance loss.
In terms of application deployment methods for the home data center, the Docker method clearly blows the LN(A)MP method out of the water. Therefore, when deploying home data center applications in the future, we will mainly use the Docker method (with exceptions that we will mention later, such as load balancing deployment, which is not suitable for Docker).
Virtualization technology
As for the choice of virtualization technology, I will adopt a combination of virtual machines and LXC. LXC is the most recommended method under normal circumstances. After all, it achieves application isolation without the performance overhead of simulating underlying hardware like virtual machines do, which perfectly meets my needs (on the other hand, the disadvantage of LXC is that the isolation is not thorough, both at the application level and the hardware resource level. For real enterprise production environments, saving that little bit of hardware overhead doesn't make much sense since hardware is dirt cheap nowadays, so it can only be said to suit the needs of a home data center). Virtual machines (Linux) are used to provide for some special applications that require complete resource isolation (which we will discuss later). Additionally, I need a 24-hour online Windows system to act as a remote O&M device (Windows RDP is indeed the best experience among all remote access methods, VNC is really hard to describe... Of course, the Mac Mini is also fine, and using Jump Desktop with the Mac Mini offers a great remote experience too. Windows is considered for times when I don't have a terminal with me, so I can just find any machine in an internet cafe and connect via Remote Desktop). Therefore, I ultimately chose PVE as the virtualization platform.
Why not choose Esxi for the virtualization platform? First, it is paid software, and one of my principles for building a home data center is that it must be free, so this is definitely out. Second, Esxi has no playability, whereas PVE itself is Debian 11, allowing you to install various software, making it highly playable. Third, PVE directly supports LXC. Fourth, PVE provides free clustering and backup functions...
Actual environment showcase
Let me show you my current actual environment:
Main container runtime environment, Mac Mini:

Among them, the stopped Elasticsearch is used for full-text search in Nextcloud. It was disabled by me because it consumes too much memory, and I plan to migrate it to the backup platform in the future.
Backup container runtime environment:

PVE virtual machine:

"bt-only" is an LXC I specifically use to run a Baota panel. This LXC carries the reverse proxy work for the 3 entry points of the home data center, responsible for forwarding requests coming from the 3 WAN ports to the backend WAF. The backend WAF uses the SafeLine Community Edition (free and easy to use), which is responsible for filtering requests and then forwarding them to the backend load balancing device. The load balancing uses Zevenet Community Edition (free and easy to use), responsible for forwarding requests to the appropriate Docker containers. The above is the request forwarding workflow inside the home data center.