Use Docker Swarm (and less ideally, Docker Compose) to manage deployments.
- On a clean Ubuntu server
apt update
apt upgrade
- Setup SSH keys (if going to commit)
git clone https://github.com/dalehumby/homelab.git
cd homelab
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)
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 DNS (dynamic DNS)
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_grafana
.
docker service ls
to see which services are running.
Use secrets and configs so I don't have to commit sensitive info to repo.
Swarm cannot pass through devices (like GPU 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)media-compose.yaml
: Media server and download management
To deploy the services: docker compose up -d
or docker compose -f media-compose.yaml up -d