Homelab Provisioning
July 20, 2025 ยท View on GitHub
Use Docker Swarm (and less ideally, Docker Compose) to manage deployments.
Steps to perform when installing a new server
- On a clean Ubuntu server
apt updateapt upgrade- Setup SSH keys (if going to commit)
git clone https://github.com/dalehumby/homelab.gitcd homelab
Directory layout
Containers assume that all files are available on a mount /media/cluster. Each service has its own sub-directory in the cluster directory. (TODO describe network mount / glusterfs)
Docker Swarm
I am running 2x Raspberry Pi 4B with 4 GB RAM and 32 GB Micro SD card in Docker Swarm mode, and a Dell x86 server with 24 GB RAM.
There are several Stacks that define various services:
home-stack.yaml: IoT and home automation servicesproxy-stack.yaml: Run Traefik proxy server, including SSL termination, so can access services from the internetcron-stack.yaml: Launch periodic jobs like updating dynamic DNS and removing old containers
Deploy a stack
For example, the IoT "home" services: docker stack deploy -c home-stack.yaml home
This creates a home_default network and each service is prefixed with home_ eg home_homeassistant.
docker service ls to see which services are running.
Use secrets and configs so I don't have to commit sensitive info to repo.
Docker Compose
Swarm cannot pass through devices (like Zigbee USB or USB SDR dongles), and anyway the container needs to run on the host where the device is.
compose.yaml: Containers that run on the primary host (Dell)
To deploy the services: docker compose up -d
Using .env for secrets, not commmited to repo.