From 26991ec463af6c8cfd109ce79812c9f308b02d35 Mon Sep 17 00:00:00 2001 From: Zac Gaetano Date: Sun, 3 May 2026 12:58:51 +0000 Subject: [PATCH] deploy: bundle the official Datarhei Restreamer UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the placeholder Dragon Fork landing page at / with the real React SPA — the same UI that ships in upstream's datarhei/restreamer image. Operators get the full process management dashboard, log viewer, restream config, and so on. Implementation: a new Docker stage 'ui-builder' (node:21-alpine3.20) clones datarhei/restreamer-ui at a pinned tag (v1.14.0), runs 'yarn install + yarn build' with PUBLIC_URL="./" so all asset references are relative, and the runtime stage pulls /ui/build into /core/static. The existing seed-data.sh script then copies it into /core/data on first boot. Stacking order in /core/static: 1. UI bundle from ui-builder — provides index.html, the SPA bundle and assets, _player, _playersite, etc. 2. Dragon Fork deploy/static/* — currently only whep-player.html; the placeholder index.html was removed so the UI's wins. Pinned to v1.14.0 (the most recent tagged restreamer-ui release) rather than 'main' for reproducible builds. Bumping the pin is a one-line ARG override. Image size: ~+25MB compressed (Restreamer UI bundle is ~3MB gzipped, plus the build-stage layer overhead until pruned). UI-side configuration: the SPA defaults to talking to the same-origin /api endpoints, which is exactly what we want when serving from Core. No '?address=' query string needed on the URL. Co-Authored-By: Claude Opus 4.7 --- deploy/truenas/core/Dockerfile | 33 +++++++++++-- deploy/truenas/core/static/index.html | 69 --------------------------- 2 files changed, 28 insertions(+), 74 deletions(-) delete mode 100644 deploy/truenas/core/static/index.html diff --git a/deploy/truenas/core/Dockerfile b/deploy/truenas/core/Dockerfile index 8cc7a3c..0e51269 100644 --- a/deploy/truenas/core/Dockerfile +++ b/deploy/truenas/core/Dockerfile @@ -27,6 +27,23 @@ COPY . . ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64 RUN make release && make import && make ffmigrate +# ---- ui-builder ---- +# Builds the official Datarhei Restreamer UI (React 18 + MUI). Pinned +# to a specific tag so reproducible. PUBLIC_URL=./ makes asset +# references relative — the bundle then works when served from / or +# any subdirectory under Core's static-disk filesystem. +# +# Pulling from the public github mirror keeps the Forgejo runner's +# network footprint small; no auth required for clone. +FROM node:21-alpine3.20 AS ui-builder +ARG RESTREAMER_UI_REF=v1.14.0 +RUN apk add --no-cache git +WORKDIR /ui +RUN git clone --depth=1 --branch ${RESTREAMER_UI_REF} \ + https://github.com/datarhei/restreamer-ui.git . \ + && yarn install --frozen-lockfile --network-timeout 600000 \ + && PUBLIC_URL="./" GENERATE_SOURCEMAP=false yarn build + # ---- runtime ---- # Alpine with ffmpeg (Core shells out to it for every restream process). # Scratch isn't an option here because the process manager needs ffmpeg @@ -47,11 +64,17 @@ COPY --from=builder /src/ffmigrate /core/bin/ffmigrate COPY --from=builder /src/mime.types /core/mime.types COPY --from=builder /src/run.sh /core/bin/run.sh -# Dragon Fork landing page + browser WHEP player. Seeded into -# /core/data on first boot by /core/bin/seed-data.sh below; the seed -# is a no-op when the operator has already put content in /core/data. -COPY --from=builder /src/deploy/truenas/core/static/ /core/static/ -COPY --from=builder /src/deploy/truenas/core/seed-data.sh /core/bin/seed-data.sh +# Static content for /core/data, seeded on first boot by seed-data.sh. +# Stacking order: +# 1. Restreamer UI bundle (the React SPA — gives us index.html) +# 2. Dragon Fork extras (whep-player.html, etc.) — won't overwrite +# the UI's index.html (seed-data is no-clobber). +# +# The result: GET / serves the official Restreamer dashboard, and +# /whep-player.html serves the standalone WHEP smoke player. +COPY --from=ui-builder /ui/build/ /core/static/ +COPY --from=builder /src/deploy/truenas/core/static/ /core/static/ +COPY --from=builder /src/deploy/truenas/core/seed-data.sh /core/bin/seed-data.sh RUN chmod +x /core/bin/seed-data.sh && mkdir -p /core/config /core/data diff --git a/deploy/truenas/core/static/index.html b/deploy/truenas/core/static/index.html deleted file mode 100644 index ba88bf8..0000000 --- a/deploy/truenas/core/static/index.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - -Datarhei — Dragon Fork - - - - -
-

Datarhei Dragon Fork

-
a fork of datarhei/core with native WebRTC (WHEP) egress
-
-
-

Quick links

-
- API documentation (Swagger UI) -

Full HTTP API including /api/v3/process, /api/v3/whep/{id}, RTMP / SRT / config / metrics. Most endpoints require a JWT — issue one via POST /api/login.

-
-
- Browser WHEP player -

Self-contained subscriber for any process whose config.webrtc.enabled = true. Paste the WHEP URL and a JWT; press Subscribe.

-
- -

About this build

-
Loading…
- -

How to add a WebRTC stream

-
-

Create a process with "webrtc": { "enabled": true }. Once it starts, POST /api/v3/whep/<process-id> takes an SDP offer and returns an SDP answer.

-
-
-
Datarhei — Dragon Fork · Apache License 2.0 · Built on datarhei Core + Pion WebRTC
- - -