Going Mobile: Part 2
The Plan: The part that matters
Part 1: Identifying System Requirements
Based on the outlines from Part 1, the requirements for our system are as follows:
- Highly available, geographically distributed system
- Distributed replicated storage
- Ability to run argoCD, code-server, hakatime, and Nextcloud together, at a minimum
Part 2: Transforming Requirements into a Design For each requirement, I will outline the design decisions made:
Highly available, geographically distributed system:
- Kubernetes: The best option for this requirement, with various distributions designed for different applications. I will use k3s, as it is lightweight and well-suited for this purpose.
- Other options: Docker Swarm, Apache Mesos, Nomad, OpenShift
Distributed replicated storage:
- Longhorn: In Part 1, I mentioned using GlusterFS, but I decided to switch to Longhorn. This change allows us to reduce the total number of geographical locations from 3 (required by GlusterFS to avoid split-brain) to 2, although it does reduce our fault tolerance. Longhorn is a lightweight and reliable distributed block storage system for Kubernetes, making it well-suited for our purpose.
- Other options: GlusterFS (as mentioned in Part 1), Ceph, HDFS
Ability to run argoCD, code-server, hakatime, and Nextcloud together, at a minimum:
This requirement relates more to hardware specifications. My decision for hardware includes:
- 2x Dell OptiPlex 7050 SFF Intel i5 6500 3.20GHz 16GB RAM
- 2x SBC (4GB RAM) Raspberry Pi or equivalent
Part 3: Putting it Together
Below is the system diagram that I have settled on for the system:
Description of each object in the diagram:
- Internet: Everything in this system is available on the internet.
- VPN: Headscale comes in here as mentioned in Part 1. Headscale is the open-source implementation of Tailscale, allowing for self-hosted Tailscale VPNs. In this system, headscale will be hosted on a separate machine, most likely a VPS. The items within this system will communicate with each other via the headscale server.
- Location: Represents a physical geographic location.
- Control Plane Replication: Indicates how the control plane is distributed within the system.
- Node: Represents a physical machine (SBC for the k3s server, OptiPlex for the k3s agent).
- Longhorn: Represents the blocks within the Longhorn system used for distributed block storage.
- GitOps: Indicates how application delivery and deployment will be managed via ArgoCD.
- S3 Backup: Longhorn will back up data to S3 to provide disaster recovery in case both systems fail simultaneously.
Explore the series:
This post is part of the 'Going Mobile' series. Explore the series further:
- Going Mobile: Part 1 - Introduction to the series
- You are here: Going Mobile: Part 2 - The design.
- Next: Going Mobile: Part 3 - Understanding a change in the scope.
- Going Mobile: Part 4 - Going further into Networking, Monitoring and Chaos engineering
- Going Mobile: Part 5 - Covering some troubleshooting, wrapping it up, and the future.