← All projects
Case Study · Home Lab

DorinaServer: a media server that reports on itself

A TrueNAS SCALE server that streams my media library to every device in the house, plus a small pipeline that publishes its live stats to this portfolio every day, without exposing my home network.

TrueNAS SCALEZFSPlexPythonGitHub API
Role
Sole builder and admin
Timeline
2022 – Present
Hardware
Intel Core i5-4460 · 15.5 GiB
Software
TrueNAS SCALE 25.10 · Plex
01.

The goal

I wanted one place for the household's movies, TV, and music that streams to every device, survives a disk failure, and that I fully understand from the hardware up. Running it every day became my main way of learning storage, networking, and monitoring.

816movies
8,474TV episodes
1,388songs
42days uptime
Snapshot numbers
02.

The setup

24 TB

Primary pool

A single large drive that holds the main media library.

RAIDZ1

Redundant pool

Four drives that can lose any one disk without losing data.

Plex

Streaming

Serves movies, TV, and music to every device in the house.

The same server also runs Home Assistant, which powers my home automation hub, “Jarvis.”

03.

The problem

My portfolio showed a hand-typed snapshot of the server, and it went stale almost immediately. The CPU, the TrueNAS version, the uptime, and the library counts were all out of date.

The obvious fix, letting the website query the server, meant opening my home network to the internet. That wasn't worth it for a stats card.

04.

The solution: push, don't pull

Instead of the website reaching in, the server reaches out once a day:

TrueNASA scheduled job starts the script.
CollectPython reads pool, Plex, and Home Assistant stats.
PublishThe script commits dorina.json to GitHub.
DisplayGitHub Pages serves it, and the cards render it.
Why it matters Visitors never touch my network, and the GitHub token can only edit this one repo.
05.

Hurdles along the way

  • The TrueNAS web API rejected the script's HTTPS connections with a TLS “unrecognized name” error, whether I used localhost, 127.0.0.1, or the LAN IP. Since the script runs on TrueNAS itself, I switched to midclt, TrueNAS's local command-line client. It needs no HTTPS and no API key, which also removed a credential I'd have had to protect.
update_stats.py
def midclt(method, *args):
    # Ask TrueNAS directly via its local CLI (no HTTPS, no API key needed)
    out = subprocess.check_output(["midclt", "call", method, *[json.dumps(a) for a in args]])
    return json.loads(out)
  • TrueNAS's system folders are read-only. The script lives on a ZFS dataset instead, so it survives reboots and updates. It's scheduled through the TrueNAS UI rather than crontab, which updates can wipe.
  • Raw size isn't usable space. A RAIDZ1 pool's raw size includes parity, so my first version overstated capacity. Reading each pool's root dataset gives the space you can actually use.
06.

Designed to fail gracefully

Stats file missing

Each card keeps its last snapshot instead of breaking.

Home Assistant down

Server stats still publish, and the Jarvis card shows the hub as unreachable.

Stale data

Every card shows when it last updated, so old numbers are obvious.

07.

What I learned

  • Choose the architecture that avoids the risk. Pushing data out removed the need to expose anything.
  • Use the platform's native tools. midclt was simpler and more reliable than fighting the web API.
  • Live data keeps you honest. Automating the card showed me how far my hand-written numbers had drifted.
Next case study → Biopsy Log Automation