Skip to content

✨ deploy: headless Twitch streamer for the Activity Monitor - #15595

Merged
clubanderson merged 2 commits into
v5from
feat/twitch-stream
Oct 30, 2026
Merged

clubanderson merged 2 commits into
v5from
feat/twitch-stream

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #15594

What

An unattended 24/7 Twitch stream of the dashboard's Activity Monitor for hive's own hosted spoke on hive-oke. Code + docs + a local dry run only: no cluster or Twitch changes — the owner creates the two Secrets and applies the overlay.

  • src/deploy/stream/ — Dockerfile (debian slim: Xvfb, Chromium, ffmpeg, xdotool, tini; Go stage builds authproxy), entrypoint.sh (Xvfb → authproxy → Chromium --kiosk with backoff → reload every RELOAD_EVERY → ffmpeg x11grab 1080p30 + anullsrc, libx264 veryfast 4500k CBR keyint 60 → rtmp://live.twitch.tv/app/$KEY; key masked in logs; STREAM_OUTPUT/STREAM_SECONDS dry-run modes), healthcheck.sh, docker-compose.yaml, authproxy/ (stdlib reverse proxy injecting Authorization: Bearer $DASHBOARD_TOKEN; the token never reaches the URL, history, logs or screen; tests included).
  • Kubernetes — Kustomize base in a dedicated hive-stream namespace (the hub provisioner owns the hosted spoke's namespace and deletes it wholesale, so nothing foreign should live there): Deployment (1 replica, non-root, drop-ALL, 512 Mi /dev/shm, 1–2 CPU / 2–3 Gi, exec probes), ConfigMap, NetworkPolicy (DNS, dashboard Service, public RTMP/HTTPS only), Secret templates; overlays/hive-hosted points at hive.hive-hosted-hosted-available-oke-11-placeholder-r05x.svc.cluster.local:3002 and uses the spoke's shared hive-secrets/dashboard-token (valid because the hive is hub_proxied).
  • Dashboard ?kiosk=1 — hides sidebar, topbar (must out-specify theme.go's body #oc-topbar.oc-topbar{display:grid!important} layout guard), avatar/settings, notices, chat FAB, Welcome and NPS dialogs, every non-tracker section; skips toast hover-pause; nothing persisted. TestKioskModeWiring guards the wiring; index.html regenerated.
  • Publishing — .github/workflows/stream-image.yml: PR builds only; push to v5 (path-filtered) pushes ghcr.io/hivecommons/hive-stream:<sha> and :v5-latest; registered [-v4] in release-lines.yml (guard passes).
  • Docs — src/docs/streaming-the-activity-monitor.md (Twitch Creator Dashboard steps, secrets, apply, verify, troubleshooting, privacy, OBS quick path), src/deploy/stream/README.md, deploy README + documentation map entries, changelog fragment.

Dry run

Image built locally with Docker (colima) and run against the live hive's-hive dashboard (via kubectl port-forward, in-cluster bearer token; a small local server served this branch's regenerated index.html for / and proxied the API, since the live spoke still runs the pre-kiosk SPA). STREAM_OUTPUT=/out/kiosk.flv STREAM_SECONDS=30 → ffmpeg encoded 30 s, healthcheck.sh → ok frames=…, reload fired. Frame at t=25 s:

Kiosk-mode frame grab of the Activity Monitor from the streamer container

No tokens or secrets render on the tracker page; it shows public-repo PR/issue titles and authors only.

Also found and fixed while dry-running: ffmpeg lacked -y (an existing FLV sink made it exit immediately and || true hid it) and the bounded run reported success regardless of ffmpeg's exit — the bounded run now fails on a non-zero exit.

Owner steps after merge

kubectl --context hive-oke create namespace hive-stream
kubectl --context hive-oke -n hive-stream create secret generic twitch-stream \
  --from-literal=TWITCH_STREAM_KEY='live_PASTE_FROM_CREATOR_DASHBOARD'
kubectl --context hive-oke -n hive-stream create secret generic dashboard-token \
  --from-literal=DASHBOARD_TOKEN="$(kubectl --context hive-oke -n hive-hosted-hosted-available-oke-11-placeholder-r05x get secret hive-secrets -o jsonpath='{.data.dashboard-token}' | base64 -d)"
kubectl --context hive-oke apply -k src/deploy/stream/overlays/hive-hosted

Adds src/deploy/stream: a Debian image (Xvfb + Chromium + ffmpeg + a
stdlib Go authproxy that injects Authorization: Bearer so the token never
reaches the URL, history, logs or screen), an entrypoint that supervises
every process with backoff, reloads the page every RELOAD_EVERY, encodes
1080p30 libx264 CBR with a silent audio track and pushes to Twitch RTMP,
a healthcheck, docker compose, a Kustomize base in a dedicated
hive-stream namespace and the hive-hosted overlay for hive's own spoke on
hive-oke. Secrets are templates only; the owner creates them.

Dashboard: `?kiosk=1` unattended display mode — hides sidebar, topbar
(out-specifying theme.go's layout guard), avatar menu, notices, chat FAB,
welcome/NPS dialogs and every section except the Activity Monitor, and
skips the toast hover-pause. Guarded by TestKioskModeWiring.

Publishing: .github/workflows/stream-image.yml pushes
ghcr.io/hivecommons/hive-stream:<sha> and :v5-latest from v5 (PR builds
only), registered as pinned [-v4] in release-lines.yml.

Docs: src/docs/streaming-the-activity-monitor.md (Twitch Creator
Dashboard steps, secrets, apply, verify, troubleshooting, privacy, OBS
quick path).

Fixes #15594

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@clubanderson
clubanderson requested a review from hanthor as a code owner October 30, 2026 00:56
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 30, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nicholasjackson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#15521 🌱 refactor: split tracker row source same files src/pkg/dashboard/static-src/manifest.txt
#15565 🌱 refactor: split tracker words source same files src/pkg/dashboard/static-src/manifest.txt
#15530 🐛 fix(dashboard): issue-row linked PR passes null when the lineage chip is empty same files src/pkg/dashboard/static/index.html
#15584 🐛 Close the hive's own empty-diff PRs as superseded instead of asking a person same files src/pkg/dashboard/static/index.html
#15308 ✨ feature: enqueue eligible PRs into GitHub native merge queues same files src/docs/documentation-map.md
#15601 ✨ dashboard: add ?kiosk=1 unattended display mode for the Activity Monitor CONFLICT src/pkg/dashboard/kiosk_mode_test.go
src/pkg/dashboard/static-src/css/kiosk.css
src/pkg/dashboard/static/index.html
#15591 🐛 adoption: superseded PRs close promptly and read as one muted tracker line same files src/pkg/dashboard/static/index.html

TestNavbarStickyThreeZoneLayout scans every `.oc-topbar {` rule and
requires its display to be grid; the kiosk override (and its comment)
matched. Use `html body.kiosk-mode #oc-topbar[id]` instead — still
(1,2,2), still beats theme.go's layout guard — and reword the comment.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 30, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor
17ad060

ℹ️ Sentinel notice — informational; author is trusted (owner), merge is not blocked

Hive flagged this PR (author @clubanderson, head 17ad060449de) because it matches behaviors that can override security controls, escalate privileges or damage the codebase. This is a heuristic, not an accusation — a maintainer should confirm the change is intended before it merges.

  • sensitive_path — changes 18 sensitive path(s) (Touches a sensitive path (OWNERS, workflows, policies, hive config, security docs, …))
    • .github/release-lines.yml
    • .github/workflows/stream-image.yml
    • src/deploy/README.md
    • src/deploy/stream/.gitignore
    • src/deploy/stream/Dockerfile
    • src/deploy/stream/README.md
    • src/deploy/stream/authproxy/main.go
    • src/deploy/stream/authproxy/main_test.go
    • src/deploy/stream/docker-compose.yaml
    • src/deploy/stream/entrypoint.sh
    • src/deploy/stream/healthcheck.sh
    • src/deploy/stream/k8s/configmap.yaml
    • src/deploy/stream/k8s/deployment.yaml
    • src/deploy/stream/k8s/kustomization.yaml
    • src/deploy/stream/k8s/namespace.yaml
    • src/deploy/stream/k8s/networkpolicy.yaml
    • src/deploy/stream/k8s/secret.yaml
    • src/deploy/stream/overlays/hive-hosted/kustomization.yaml
  • permission_escalation — widens workflow permissions or uses pull_request_target (Widens GitHub Actions permissions or switches to pull_request_target)
    • .github/workflows/stream-image.yml
  • ci_gate_weakening — CI configuration is deleted, softened or has gate checks removed (Disables or softens CI gates (continue-on-error, || true, removed checks))
    • .github/workflows/stream-image.yml
  • remote_code_execution — adds a remote-fetch-and-execute, decoded payload, reverse shell or embedded credential (Adds curl|sh, eval of encoded payloads, reverse shells or embedded private keys)
    • src/deploy/stream/Dockerfile

Hive did not add the sentinel-alert label because this author is trusted. The finding remains recorded for audit and the dashboard Security tab; set sentinel.trusted_authors_block: true to require the blocking label for trusted authors too.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicts-with-open-pr Open PR has a merge conflict with another open PR dco-signoff: yes Indicates the PR's author has signed the DCO. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stream the hive Activity Monitor to Twitch unattended (hive's hive on OKE)

1 participant