Showing posts with label docker-compose. Show all posts
Showing posts with label docker-compose. Show all posts

Saturday, 31 October 2026

Home-lab design part 5 - The perfect Serviio console

Continuing my [2026 homelab uplift series](https://blog.themillhousegroup.com/search/label/homelab), when I found my RPi 3B was no-longer cutting it with H265 videos, it was a no-brainer to try a [dockerised Serviio](https://hub.docker.com/r/soerentsch/serviio) on my Nuc/Proxmox/Alpine/Docker stack. Some quick tests showed it to be extremely smooth. But - for devices on your home network to see the DLNA advertisements from this Serviio instance, you need to do some tricky Docker networking so that your container is running in your network (e.g. for me, 10.240.0.0/16, maybe 192.168.0.0/24 for you, but probably NOT the 172.19.0.0/16 that a Docker container will typically be running in if not specifically configured) While Arcane does support defining these networks within its GUI, it's got a bit of an impedance mismatch, so I head to the Proxmox console for my Docker VM. The command that worked for me was: ``` # docker network create \ -d macvlan \ --subnet=10.240.0.0/16 \ --gateway=10.240.0.1 \ --ip-range=10.240.1.96/30 \ -o parent=eth0 \ macvlan-on-home-network ``` This [Visual Subnet Calculator](https://www.davidc.net/sites/default/subnets/subnets.html) may prove handy if you're trying to find a safe IP range for your Serviio container to slot into! This will now get DLNA advertisements out onto your home network, and devices will start showing Serviio(whatever) in their server lists. Note: it's highly likely that the `whatever` part of the server name will be random hex due to Docker, so you might want to edit your `profiles.xml` and replace `Serviio({hostname})` with a fixed string like just `Serviio`. You'll also be able to access the Serviio console at `http://10.240.1.96:23423/console` or whatever, but that's both insecure and has an ugly and hard-to-remember port number, which we're able to eliminate with Nginx Proxy Manager, so let's get that working. Sadly, simply adding a straightforward Proxy Host to make `https://serviio.lab.example.com` point to ``http://10.240.1.96:23423` won't work, because, by Docker design, the NGinx Docker container **cannot see into that MacVLAN network**; you'll get a _No Route To Host_ error, which manifests as a 502 in your browser. #### Containers can't talk to each other ```mermaid architecture-beta group lab(affinity:house)[Home Lab] group docker(affinity:grid)[Docker] in lab service serviio(affinity:camera)[Serviio] in docker service firewall(affinity:firewall) in docker service npm(affinity:loadbalancer)[NPM] in docker npm:R <-- L:firewall firewall:R --> L:serviio align row npm serviio ``` Now you *could* get extremely tricky with your Docker (and Alpine, and Proxmox) networking stack to get around this, and I'm sure it's possible following guides like [this MacVLAN document](https://blog.oddbit.com/post/2018-03-12-using-docker-macvlan-networks/) and maybe asking a friendly chatbot, but I've never really felt comfortable with advanced networking (routing, firewalls, IPtables etc etc) on Linux and would rather throw some existing specialised hardware at it. The right tool for the job I think. So instead, I'm punching through this limitation with my old friends [the Mikrotik hairpin triplets](https://blog.themillhousegroup.com/2025/07/mikrotik-automation.html), aka what a consumer-grade router calls "port forwarding". ### Mikrotik saves the day again Going from the outside-in, here's how the Nginx Proxy Manager setup looks:
The trick here is that the host `mikrotik` has *nothing at all to do with Docker*, so packets can happily make their way from NPM to the router and then on to _the actual service_. Time for a diagram. #### After ```mermaid architecture-beta group lab(affinity:house)[Home Lab] group docker(affinity:grid)[Docker] in lab service serviio(affinity:camera)[Serviio] in docker service npm(affinity:loadbalancer)[NPM] in docker service mikrotik(affinity:router)[Mikrotik] in lab npm:L <--> B:mikrotik mikrotik:R <--> T:serviio align row npm serviio ``` ##### Filter rules: See [the aforementioned Mikrotik post](https://blog.themillhousegroup.com/2025/07/mikrotik-automation.html) for the details, but here's how it looks for the Serviio rules.
Allow Serviio packets (destined for port 23423) to cross the routing fabric. ##### NAT Rules: The "outbound" DST-Nat rule:
Packets (destined for port 23423 of "me") get their destination IP rewritten to that of the Serviio container. The "hairpin" SRC-Nat rule:
Packets (destined for port 23423 of "me") _also_ get their source IP rewritten to the Mikrotik's IP so that the container will respond to the right place.

Sunday, 26 April 2026

Home-lab design (2026 edition) part 3 - Inside the Docker VM

This is the next part of my progressively-deeper look at my "home lab" setup in 2026 - now we're peering into the Docker VM itself. There are a million "here are the 19 Docker apps you ABSOLUTELY MUST run in 2026" listicles out there, that's fine. I don't run that many, and many of them are of a highly-personalised, only-on-my-network-thankyou nature that I'm not even going to mention. The key two (yes, just two) are [Nginx Proxy Manager](https://nginxproxymanager.com/) and [Arcane](https://getarcane.app/). The first because it means I can forget about individual internal network addresses, port numbers, and "this website is not secure" non-HTTPS browser warnings, the latter because it's a dead simple dashboard to see what's going on at the Docker level. I'm not even going to talk any more about Arcane because it's just so simple; it's exactly what you'd expect a Docker web UI to look like:
## Nginx Proxy Manager ALL THE THINGS NPM is just a really nice and simple frontend for an Nginx instance, and I must admit I may have got a little carried away re-front-ending almost every local-network-based web app I regularly use, viz: - Arcane - HAOS - My Synology NAS - My Mikrotik router - Octoprint - My Raspberry Pi - The Proxmox UI - My DLNA streamer, Serviio - My ISP router (a TP-Link) - All my personal scratch-my-own-itch apps; and - Nginx Proxy Manager itself(!) ### Setting up Now *most* of these webapps and Dockerized apps work *great* with Nginx Proxy Manager providing a wildcard HTTPS certificate and proxying for them. If it's a simple app like `http://nas:5000` it's the work of seconds to give it a better address. For a new Dockerized webapp, my process is: - Get it going and find out what port it's on, i.e. `webport` - Check I can hit it at `http://docker:webport` - Go into NPM and add a proxy host for `coolapp.lab.themillhousegroup.com` that points to `http://docker:webport`, and add force SSL on the SSL tab using my `*.lab.themillhousegroup.com` wildcard certificate - I've already got a corresponding "wildcard" DNS `CNAME` entry in the Mikrotik router that ensures `*.lab.themillhousegroup.com` will resolve to `docker`:
NPM automagically manages this certificate for me thanks to the wonders of the `DnsMulti` DNS-based certificate management system, which does the whole Lets Encrypt automated-renewal dance via any one of a [huge number of DNS providers](https://go-acme.github.io/lego/dns/#dns-providers) (I use Netlify which is as simple as configuring a Personal Use Token and giving it to the `dnsmulti` plugin as an environment variable) There are a couple of "difficult" apps that needed a little more configuration though. ### Home Assistant Doesn't take kindly to being proxied by NPM and has to have a couple of (very simple) stanzas added to its `configuration.yaml`: ``` # Allow NGinx Proxy Manager to proxy for homeassistant: # https://community.home-assistant.io/t/using-nginx-proxy-manager-with-homeassistant-all-via-docker/725019/6 # https://www.reddit.com/r/homeassistant/comments/1dp4nwf/hass_behind_nginx_proxy_manager/ http: use_x_forwarded_for: true trusted_proxies: - 10.240.0.105 # IP of docker - 10.240.0.0/24 # the Docker subnet - 127.0.0.1 # Add the localhost IPv4 address - ::1 # Add the localhost IPv6 address # ... and further to that: # https://community.home-assistant.io/t/using-nginx-proxy-manager-with-homeassistant-all-via-docker/725019/13 homeassistant: external_url: "https://haos.lab.themillhousegroup.com" ``` As you can probably tell, I like pasting the relevant web link into configuration docs; those links are to various fora - [Reddit `/r/homeassistant`](https://www.reddit.com/r/homeassistant/comments/1dp4nwf/hass_behind_nginx_proxy_manager/) for the `trusted_proxies` IP addresses and the [Home Assistant Community](https://community.home-assistant.io/t/using-nginx-proxy-manager-with-homeassistant-all-via-docker/725019/13) for the `external_url` setting. ### Proxmox Proxmox *really* wants you to use HTTPS everywhere, so you need to turn on ALL the SSL options in NPM, and ALSO use https *in the address of the proxied instance as well* - which is unusual, but makes sense, as it does create a self-signed certificate when you first set up your system. I basically followed [this guide on Reddit](https://www.reddit.com/r/Proxmox/comments/1jsgto6/accessing_proxmox_via_nginx_proxy_manager/) so my NPM setup for `proxmox.lab.themillhousegroup.com` looks like this (note the `https` in the Scheme - different to every other host!):