Ortelius Blog

Topics include Supply Chain Security, Microservice Management, Neat Tricks, and Contributor insights.

How to Bake an Ortelius Pi Part 1 | The Hardware

raspberry-pi-4b

Introduction

I recently started building an entire Cloud Native environment on three Raspberry Pi 4 B’s with an old Synology DS413j (ARMv5 architecture) running the latest firmware update, DSM 6.2.4-25556 Update 7 Release Notes, and so far its been quite a journey.

To help other Ortelius open-source contributors build private development and testing environments, I would like to share how I have created a local environment in a series of blog posts. In this first blog, I will cover the Raspberry Pi hardware, NFS and setup. In subsequent post, I will move on to Canonicals MicroK8s (Kubernetes), Traefik (Cloud Native Proxy and Load Balancer) and Ortelius the ultimate evidence store. While you do not need all of these tools for running Ortelius, this stack gives you a complete DevOps environment for expanding your skills.

Why Raspberry Pi’s you ask? First of all I live in Cape Town South Africa where we are experiencing some of the worst electricity outages in years. We need to share electricity by taking turns through rotational blocks of time commonly know to locals as “Load Shedding.” We use an application like this one Load Shedding App to inform ourselves when the next bout of load shedding will be hitting our area. Raspberry Pi 4 B’s pack a punch with a Broadcom Quad Core ARMv8 processor and 8 GB ram. They are very light on electricy thus saving on cost and only require a single small UPS (uninterruptable power supply) to stay online. They are very mobile and take up extremely little space in my man cave.

My Home Setup


  • 3X 32GB Samsung Evo+ microSD Card (UHS-II: theoretical maximum transfer speeds up to 312MB/s)
  • Use this article from Toms Hardware for microSD card benchmarking
  • I can recommend Jeff Geerling for all things Raspberry Pi

or

  • 3X 32GB USB 3 flash drives but this comes with some caveats performance wise which I will discuss further on

Please note this is a South African brand of UPS but I am showing this for example purposes. The Mecer brand is extremely good and all my lead acid battery UPS’s are from Mecer. I have a combination of the 650VA, 2000VA and 3000VA to keep me going (7 in all).

NFS Storage

Raspberry Pi Imaging Utility for the Ubuntu 22.04 LTS x64 OS installation

The imaging utility will be used install Ubuntu onto your SD Card or USB flash drive.

Preparing the OS for installation

  • Install Raspi-Config on each Ubuntu server sudo apt install raspi-config -y

USB 3 flash drives

If you use USB flash drives you will need to do the following as mentioned in this post. It all comes down to the implementation of the UAS specification.

  • In the article the author says to go here /boot/cmdline.txt but on my Pi4 I had to go here /boot/firmware/cmdline.txt
  • A Pi has no BIOS so this is how you configure a Pis BIOS by editing /boot/firmware/cmdline.txt
  • Install dmesg sudo apt install dmesg -y
  • Raspi-Config allows you to configure your Pis hardware without having to fiddle with /boot/firmware/cmdline.txt
  • Run Raspi-Config like this sudo raspi-config and you will get a screen like this
raspberry-config


  • Use Raspi-Config to configure boot order, enable or disable read-only filesystem and many other tweaks
  • I found it much easier just to use the right microSD Card and skip all this but it was still a good learning curve

Example from configuring my Pi to use USB flash sticks

Lexmark 32GB USB
Product: USB Flash Drive
[    2.885515] usb 2-2: Manufacturer: Lexar
[    2.885527] usb 2-2: SerialNumber: AA0G3FCUYDI06HNV
[    3.007270] usb 1-1: new high-speed USB device number 2 using xhci_hcd
[    3.157900] usb 1-1: New USB device found, idVendor=2109, idProduct=3431, bcdDevice= 4.21
[    3.157922] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
  • Getting your USB flash drives details
sudo dmesg | grep usb-storage
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=1600 bcm2708_fb.fbheight=900 bcm2708_fb.fbswap=1 smsc95xx.macaddr=DC:A6:32:B1:5D:DF vc_mem.mem_base=0x3eb00000 vc_mem.mem_size=0x3ff00000  usb-storage.quirks=05dc:a838:u cgroup_enable=memory cgroup_memory=1 console=ttyS0,115200 dwc_otg.lpm_enable=0 console=tty1 root=LABEL=writable rootfstype=ext4 rootwait fixrtc quiet splash
[    2.958568] usb-storage 2-2:1.0: USB Mass Storage device detected
[    2.958964] usb-storage 2-2:1.0: Quirks match for vid 05dc pid a838: 800000
[    2.959059] scsi host0: usb-storage 2-2:1.0
[    2.959390] usbcore: registered new interface driver usb-storage
usb-storage.quirks=05dc:a838:u
  • Pi01’s BIOS config at /boot/firware/cmdline.txt aka Pi 4 BIOS file
usb-storage.quirks=05dc:a838:u cgroup_enable=memory cgroup_memory=1 console=serial0,115200 dwc_otg.lpm_enable=0 console=tty1 root=LABEL=writable rootfstype=ext4 rootwait fixrtc quiet splash

Using the Raspberry Pi Imager

  • Repeat these steps for each SD Card or USB flash stick
  • The opening screen will present you with CHOOSE DEVICE | CHOOSE OS | CHOOSE STORAGE
  • Chose CHOOSE DEVICE
raspberry-pi-4b


Choose Device

Choose: Raspberry Pi4 models B, 400 and Compute Modules 4, 4s

raspberry-pi-4b


Choose OS

Choose: Other general-purpose OS

raspberry-pi-4b


Choose: Ubuntu

raspberry-pi-4b


Choose: Ubuntu Server 22.04.4 LTS (64-bit)

raspberry-pi-4b


Choose Storage

Note: This will look different on your machine especially if you are using either SD Card or USB flash drive

raspberry-pi-4b
- Click Next


Use OS Customization by clicking: EDIT SETTINGS

raspberry-pi-4b


Fill in the required info according to your specifications. Remember to change the: HOSTNAMES pi01 | pi02 | pi03 (You can use whatever hostnames make sense to you)


raspberry-pi-4b


raspberry-pi-4b

  • If you decide to use Allow public-key authentication only which I would recommend you need to do some extra steps
  • Generate the keys in the home folder at this location /Users/<your username>/.ssh if you are using a Mac or Linux
  • Generate the keys in the home folder at this location C:\Users\username\.ssh if you are using Windows
ssh-keygen -t ed25519 -C "you-email@domain.com" -f <public key name>`
ssh-keygen -t ed25519 -C "i-love-aliens@ortelius.com" -f pi8s
  • Then you will end up with two files, one being the private key which you never ever share and the other will be the public key
  • Copy and paste all the scrambled numbers and text from the public key each time on the line under Allow public-key authentication only for each Pi
  • This will allow SSH without a password onto each Pi like this ssh -i ~/.ssh/<your private key name> <your pi username@<your private ip or domain name> | ssh -i ~/.ssh/pi8s ortelius@pi01.pangarabbit.com
  • Then add this config to .ssh/config
Host pi01.yourdomain.com
	HostName pi01.yourdomain.com
    AddKeysToAgent yes
	IdentityFile ~/.ssh/<private key name>
	User <your user>

Host pi02.yourdomain.com
	HostName pi02.yourdomain.com
    AddKeysToAgent yes
	IdentityFile ~/.ssh/<private key name>
	User <your user>

Host pi03.yourdomain.com
	HostName pi03.yourdomain.com
    AddKeysToAgent yes
    IdentityFile ~/.ssh/<private key name>
	User <your user>
  • You can also reference this document from GitHub for an alternative explanation

Check: all boxes specific to your needs.

raspberry-pi-4b


Click: YES to apply the OS customisation settings

raspberry-pi-4b


Rinse and repeat for each SD Card or USB flash stick.


Conclusion

By this stage you should have three Pi 4 B’s running with Ubuntu 22.04.4 LTS each configured for SSH with a password or preferably a SSH private key and public key. Stay tuned for part 2 where we will dive into DHCP, NextDNS, NFS and install MicroK8s.

Next Steps

How to Bake on Ortelius Pi - Part 2 The Preparation

How to Bake an Ortelius Pi - Part 3 The Configuration

Disclaimer: Any brands I mention in this blog post series are not monetized. This is my home setup!

Meet the Author


Learn More About:

Sachawharton