Antenna Tower can run on Linux, managed from a web page
status: proposed #
Antenna Tower can run on Linux, managed from a web page
Antenna Tower, the station's server (ADR 0002), runs only on a Mac: it's built
by Xcode from Sources/Shared and the Manager's server files, it keeps its
keys in the Keychain and advertises with Bonjour, and the station can only be
changed from a Mac Manager or the phone. We want it to be able to run on a
Linux box in the homelab as well, and to be managed there from a browser.
Settings no longer need iCloud: they come from the server and its R2 mirror (ADR 0001). That was the one thing only an Apple device could do, so nothing Apple-only stands in the way any more. The plan and its stages are in docs/linux-server.md.
Decisions #
-
One server, two builds. The same Swift sources build Antenna Tower for the Mac (as now, in the Manager) and for Linux (a SwiftPM executable, in a container). There's no separate Linux rewrite.
-
The server's code moves into a package (
StationServerinPackages/RetroRelay). This amends ADR 0002 decision 2: Linux can't build an Xcode target, soRemoteServer,StationMirror,VODLibrary,OnDemandCatalog,OnDemandTagger,EventScanand the event jobs move out ofSources/, as each one is touched. The Mac's Antenna Tower links the package and works as before. -
Platform services sit behind small protocols, with a Mac and a Linux version of each:
- secrets: the Keychain on the Mac, a
0600file (or environment) on Linux; - advertising:
NetServiceon the Mac,avahi-publishstarted as a child process on Linux. Avahi speaks the same mDNS/DNS-SD as Bonjour, so the screens'NWBrowserfinds it unchanged; - logging:
os.Loggeron the Mac, stderr on Linux; - the run loop and "start at login": launchd on the Mac, the container's restart policy on Linux.
- secrets: the Keychain on the Mac, a
-
The web Manager is a client like any other. The browser joins with a pairing code, like a Mac Manager, and gets a device key with a manager profile. It's kept in an
HttpOnlycookie. Every change goes through the same/v1/adminAPI, ledger and merge. There's no second way in. -
Pages are rendered by the server (Hummingbird with Mustache templates, and htmx for small updates). There's no JavaScript build in a Swift repo, and the pages share the server's types.
-
No stream preview on the web. The Mac Manager keeps previews and
test_stream's picture. The web shows whether a stream answered, not what it shows. -
The assistant (MCP) and the jobs move to a control room on Linux (revised 2026-10-30; first "into Antenna Tower"). This still reverses ADR 0002 decision 6: with the server on Linux there may be no Manager running. But they go into a second headless service beside the tower, a paired Manager client, not into the tower itself: the tower stays the broadcast, which rarely changes, and the control room can be redeployed on its own. The assistant's tools are rewritten against the settings rather than the live
StationModel, and the Manager's copy goes once that's done (docs/linux-server.md, stage 6). -
The Mac Managers keep working. They're already clients of the server, so the move to Linux doesn't wait for the web Manager.
-
Away from home, through Cloudflare Access (2026-10-19). The tower is reached through a Cloudflare Tunnel, behind Access (Google login or an email code), on a port of its own that never trusts loopback. The apps log in through Access in a browser sheet, and our server hands the token back to the app (
rabbitears://access). The server checks the Access token as well as the device key. Funnel was ruled out: it has no login in front. Tailscale stays an option for our own devices. Details are in docs/linux-server.md.
Alternatives #
- A web UI on the Mac mini's Manager only. It's simpler, but it doesn't get the server off the Mac.
- Rewrite the server in Go for Linux. ADR 0002 decision 1 already turned this down: the wire formats, Xtream, the sport rules, the ledger and the R2 sealing would need a second copy.
- A single-page app (React or similar) on a JSON API. It looks richer, but it needs a JS toolchain and a second set of types, for forms and lists that htmx handles well.
Consequences #
- Two builds to keep green: CI (or
just linux-check) builds and tests the packages on Linux. - The package split is real work. It touches the singletons that today
reach into UserDefaults and
@MainActorapp state. - A Linux server needs host networking (or the host's Avahi) for mDNS. Screens that can't see it fall back to the synced address, as now.
- Secrets on Linux are a file on disk, protected by its permissions and the host, not the Keychain.
Phin Tech docs
Rabbit Ears Manager in the store →