Why Docker Swarm Is Better for Home Automation User
Recently I've been investigating on setting up DIY private cloud infrastructure at home. Particularly I am looking at the following three options to start with:
My goal is pretty simple:
- To utilize my existing computing hardware: 1 intel NUC and 1 raspberry pi 3B
- High availability
- Easy migration from my current docker compose file, persistence storage and MariaDB database
My current home network topology is shown in the diagram below. It's mainly used for home automation and NAS with some light web hosting apps. The main horsepower is a Intel NUC mini pc running a bunch of docker app containers attached to a USB zwave stick. A Raspberry Pi 3B acts as a primary DNS server running Adguardhome. I also found it necessary to run a secondary DNS server on the NUC just as a backup in case the Raspberry fails.
Ubuntu 20.04 LTS are running on both the NUC and Raspberry Pi 3B. I won't elaborate the process for the NUC since it's a standard PC and has decent RAM and CPU. Here is the result of using the above three options for the Raspberry Pi 3B.
Installation on Raspberry Pi 3 B | Performance | |
---|---|---|
k3s ❌ | installation command frozen and won't proceed | N/A |
microk8s ❌ | only successfully installed with snap stable channel=1.18 | not usable due to possible insufficient memory |
docker swarm ✅ | installed with docker swarm init |
NUC as the manager node, Raspberry as a working node, both working normally |
Most online articles recommend using the Raspberry Pi 4 to try out container orchestration due to the larger RAM(>2GB). It's very obvious that nowadays even software claiming to be memory efficient like k3s and microk8s are becoming more and more memory hungry, which are not friendly at all to older SoC devices like the Raspberry Pi 3B.
As a home automation user, I tend to connect as many devices as possible preferably including those low-power devices like the raspberry to reduce the energy usage footprint. Minimal container orchestration like k3s and microk8s are feature rich yet complex to use, and have a deep learning curve for home users. Unless you already have several old PC and laptops laying around powerful enough to run them, docker swarm mode is still the better approach for container orchestration to achieve high availability for DIY purposes. Migrations from docker to docker swarm is also straightforward. They both uses the docker compose format and only require some extra syntax to deploy to a swarm infrastructure.
In conclusion, docker swarm is ideal and better than the other competitors for home users due to the following benefits:
- Simple installation and configuration
- Minimal memory usage and power consumption (perhaps the lightest container orchestration)
- Best compatibility for all types of hardware infrastructure (x86, arm etc.)
- The most friendly and native to existing docker users