Homeserver, container edition
Home server adventures in the container's world.
After migrating my Microserver to Freenas/TrueNAS I missed having a server at home for my side projects. At the same time I was tired of messing with WLS2 and Docker on my Win 10 PC - migration to Ubuntu already planned.
I was running an Unifi controller on Hetzner cloud to manage the network equipment in the house and considering some options, from running an actual server to a Raspberry Pi 4 to TrueNAS jails.
My NAS is not powered on 24/7 and its old hardware is not a good choice for most workloads.
So I went back to the whiteboard and started with the requirements:
- a CPU good enough (i3 or more, no Atom/Pentium)
- support of 32GB of RAM
- small size
- preference to fanless or very quite machines
- power budget
How it ended: another NUC joined the family!
Hardware details:
- Intel NUC8i3BEK2
- RAM SO-DIMM DDR4 16GB Crucial 2666 CT16G4SFD8266
- SSD 240GB Western Digital Green Sata3 M.2 WDS240G2G0B
The NUC supports up to 32G or RAM so there's room for another module if I ever need it.
OS and virtualization
I considered running ESXi on the NUC but it's 2020, VMs are the old way. As a personal challenge I decided to run all the software I need in containers.
After testing Docker and Podman for a few days I decided to start with Docker because it has a wider adoption and it's easy to find ready to use docker-compose files.
Install Docker
Installing Docker on Ubuntu 20.04 requires just a few commands describe in the Docker documetation
Enable Docker remote API
To work on the remote machine enable Docker remote API and create an alias like
1alias doc='docker -H=10.1.0.20:2375'
Now run
1 doc ps
to get a list of the containers running on the server.
Note: protect the Daemon.
If you preferer a GUI look at Portainer.
Containers
The containers I currently run are:
- Heimdall: a nice dashboard to access the web interfaces
- Unifi controller: to manage the Ubiquiti equipment of my home network
- Portainer: a GUI to manage containers
- NetBox: IPAM on steroids
- Jellyfin: media server, mounting the volumes on FreeNAS cia cifs
- Home Assistant: to start some home automation projects
- Cockpit: server web interface
- Grafana with InfluxDB for collecting telemetry
- Pi-hole: DNS server for blocking ads
Planned:
- Telegraf to collect data on InfluxDB
- Icinga2 for network monitoring
- a Git repository like Gitea or Gogs
- Bitwarden
- some way to backup the server, Duplicati or restic
- a registry to host my own containers
- Ferdi to combine messaging services into one application
- Jitsi, BBB or some other video conferencing software
- traefik proxy
New ideas coming from awesome-selfhosted and reddit.
Container images are available on linuxserver.io. I recommed the blog that has some guides.
Upgrade a container
After a few days form the deployment I've had a chance to apply the first upgrade to the Unifi container.
How do we upgrade in the container's works? We don't.
The upgrade procedure is:
- pull a new image
- stop the current container
- remove the current container
- start a new container from the new image
The configuration is in a Docker volume so no data will be lost in the process:
volumes:
- /etc/unifi-controller/config:/config
The commands:
docker pull ghcr.io/linuxserver/unifi-controller
docker stop unifi-controller
docker rm unifi-controller
docker-compose up -d
and this is the docker-compose.yaml used to create the container
---
version: "2.1"
services:
unifi-controller:
image: ghcr.io/linuxserver/unifi-controller
container_name: unifi-controller
environment:
- PUID=1000
- PGID=1000
- MEM_LIMIT=2048M #optional
volumes:
- /etc/unifi-controller/config:/config
ports:
- 3478:3478/udp
- 10001:10001/udp
- 8080:8080
- 8443:8443
- 1900:1900/udp #optional
- 8843:8843 #optional
- 8880:8880 #optional
- 6789:6789 #optional
- 5514:5514 #optional
restart: unless-stopped
The whole process was very fast and without an impact on the network.
Wrap-up
I'm quite happy with the setup so far. I already use a NUC8i7BEH as my main machine so I knew what to expect for the hardware.
I plan to start building my own containers soon as an exercise and just in case I ever need it in the future. Developing inside containers is something I'll try.
Links
linuxserver.io a curated repository of containers ready to use