๐Ÿš€ Project Overview

This project documents the design and implementation of a lightweight edge platform built on a Raspberry Pi, inspired by modern Platform Engineering and SRE practices.

The goal is not just to run containers โ€” but to build:

  • A reliable edge platform
  • With observability baked in
  • Fully documented
  • And easy to reproduce

๐ŸŽฏ Objectives

  • Build a production-inspired edge platform on Raspberry Pi
  • Run containerized workloads using Docker
  • Implement monitoring and observability
  • Expose services securely
  • Maintain Git-driven documentation

๐Ÿง  Architecture Overview

Core components:

  • Raspberry Pi (Edge Node)
  • Docker & Docker Compose
  • Reverse Proxy (Traefik)
  • Monitoring (Prometheus + Grafana)
  • Logging (future)
  • GitHub + Hugo for documentation

Diagram will be added once the platform is stable.


๐Ÿงฐ Hardware & Software

Hardware

  • โœ… Raspberry Pi 3 Model B
  • โœ… ARMv8 / 64-bit
  • โœ… Debian 12 (Bookworm)
  • โš ๏ธ 1 GB RAM
  • โš ๏ธ 16 GB SD card
  • โš ๏ธ 100 Mbps Ethernet

Software

  • Raspberry Pi OS (64-bit)
  • Docker
  • Docker Compose
  • Traefik
  • Prometheus
  • Grafana

๐Ÿ› ๏ธ Build Phases

Phase 0 - Critical Fixes (Before Containers)

  • Increase swap from 512 MB to 2 GB (mandetory on Pi 3)
  • Reduce GPU memory (headless optimization)

Phase 1 โ€“ Base OS & Access

  • Flash Raspberry Pi OS
  • Enable SSH
  • Secure access

Phase 2 โ€“ Container Platform

  • Install Docker
  • Validate container runtime
  • Define compose structure

Phase 3 โ€“ Networking & Security

  • Reverse proxy
  • TLS (later)
  • Service exposure

Phase 4 โ€“ Observability

  • Metrics collection
  • Dashboards
  • Alerts (future)

Phase 5 โ€“ Documentation

  • Architecture diagrams
  • Runbooks
  • Lessons learned

Images and diagrams will be added as the project progresses.


๐Ÿ“˜ Lessons Learned (living section)

###๐Ÿ“ˆ Increasing Swap Space on Raspberry Pi (Edge Platform Prerequisite)

Why Swap Matters on Edge Devices

The Raspberry Pi 3 is constrained by 1 GB of RAM, which is insufficient for:

  • Docker daemon
  • Multiple containers
  • Observability tooling (Prometheus, Grafana)

Swap acts as a pressure relief valve, preventing:

  • OOM (Out-Of-Memory) kills
  • Random container crashes
  • System lockups under load

โš ๏ธ Swap is not a performance booster โ€” it is a stability mechanism.

For this edge platform, increasing swap is mandatory.

Current System State free -h

Typical output before change:

          total        used        free

Mem: 982Mi 380Mi 120Mi Swap: 512Mi 138Mi 374Mi

The default 512 MB swap is insufficient for containerized workloads.

Target Configuration Setting Value Swap size 2 GB Swap file type File-based Use case Docker + observability

###Step-by-Step: Increase Swap to 2 GB

1๏ธโƒฃ Disable current swap sudo dphys-swapfile swapoff

2๏ธโƒฃ Edit swap configuration sudo nano /etc/dphys-swapfile

Locate:

CONF_SWAPSIZE=512

Change to:

CONF_SWAPSIZE=2048

Save and exit (CTRL+O, ENTER, CTRL+X).

3๏ธโƒฃ Recreate the swap file sudo dphys-swapfile setup

This recreates the swap file with the new size.

4๏ธโƒฃ Re-enable swap sudo dphys-swapfile swapon

5๏ธโƒฃ Verify swap is active free -h

Expected output:

          total        used        free

Mem: 982Mi 380Mi 120Mi Swap: 2.0Gi 0Mi 2.0Gi

Validation Checks swapon –show

You should see:

NAME TYPE SIZE USED PRIO /var/swap file 2G 0B -2

###Operational Notes (Important)

โš ๏ธ SD Card Wear

  • Swap increases write activity
  • Acceptable for homelab / edge experiments
  • Not recommended for heavy production writes

๐Ÿง  Memory Behavior

  • Linux will prefer RAM first
  • Swap is used only under pressure
  • Prevents Docker from crashing silently

We deliberately increased swap to 2 GB to prioritize platform stability over raw performance, acknowledging edge constraints while enabling realistic container workloads.


๐Ÿ”— References

  • Docker documentation
  • Prometheus
  • Grafana
  • Platform Engineering concepts