It is time for a new project! For some time, I have been playing with the idea to automate my array of Linux servers and Raspberry Pi boards. In this article, I provide the motivation, explain my infrastructure and formulate the requirements. See this post as my project kick-off!
This article appeared originally on my personal blog.
At my work, we manage a private cloud with Kubernetes, external VMs with Docker containers, and internal VMs with docker containers or hosted apps. We do not want our day-to-day tasks to be executing shell commands on individual machines. Instead, we want to reuse and automate common tasks like installing/updating software packages, starting and restarting services, or other system administration tasks.
Infrastructure automation is the idea of using specifications to configure, deploy and maintain servers, services and applications. These specifications include commands (read CPU and IO stats), application installation, application configuration (template configuration files, install plugins), application & service management (start, restart, stop), and system administration tasks (add users, update OS packages or Kernel).
Infrastructure specifications are files. By executing the specifications, the servers, applications and services are brought towards the desired state. When we treat these specifications as code inside a version control system such as Git, it becomes Infrastructure as Code (IAC).
My goal is to have the same level of automation at my home. I want to use tools that help me with system administration, application configuration and application management on my infrastructure.
My infrastructure consists of:
- Linux Server: 4x1.5GHz , 6 GB Ram, 64GB Disk
- RPi Zero W: 1x1GHz ARM11, 512MB Ram, 32GB Disk
- 2x RPi 3 B+: 4x1.4GHz Cortex-A72, 1GB Ram, 32GB Disk
- 2x RPi 4: 4x1.5GHz Cortex-A72, 4GB Ram, 32GB Disk
I assembled the Raspberry Pi in a neat stack:
Infrastructure@Home: A new Project
The Linux server runs with Manjaro, an Arch Linux derivate. The system is installed with the graphical tool, so I have a named user, a dedicated hostname and SSH.
For the raspberry Pi, SDD cards are flashed with a fresh copy of Raspbian Buster. I boot each system to enable SSH and to set a custom hostname for each machine (raspi-0, raspi-3-1, raspi-3-2, raspi-4-1, raspi-4-2). All systems are connected to the same switch.
Now we can start to automate the infrastructure!
Before I start something new, I like to think about the requirements. This helps me to better understand and scope what I want to do. Also, having a small checklist, where I can see how much of the project is achieved, motivates me.
First, let’s define infrastructure: a cluster of individual servers on which applications are running. Second, lets group all tasks into different groups:
- Infrastructure Management
- IM1: A task to update the operating systems
- IM2: A generic task to install additional software
- IM3: A task to install and update SSH keys
- IM4: An interface in which I see the status of all nodes (online/offline, CPU, RAM)
- Application Management
- AM1: Applications can be deployed as binaries or docker container
- AM2: Applications can be deployed on specific nodes
- AM3: Applications can be deployed somewhere inside the cluster
- AM4: An interface in which I see the status of each application (health, exposed endpoints)
- Application Discovery
- SD1: Applications can be accessed with a domain name independent of where they are running
Now, we can start with the project!
With this article, I started a new article series about automating computer infrastructure at home. My motivation is to use tools that help me with system administration, application configuration and application management to be as efficient as possible. The requirements for this project are grouped, and now we can start exploring which tools are best for the different tasks.