Mimir/docs/self-hosted-live-edge.md
2026-05-30 22:18:24 +01:00

72 lines
2.3 KiB
Markdown

# Self-Hosted Live Edge
Mimir's self-hosted broadcast path keeps OBS optional. Starfire owns the final
program frame and audio mix; Yggdrasil owns public byte distribution.
```mermaid
flowchart LR
A["Fensalir program texture"] --> B["Starfire NVENC encode"]
C["Faust/Mimir mix"] --> B
B --> D["SSH TCP forward"]
D --> E["Yggdrasil localhost RTMP ingest"]
E --> F["HLS segment ring"]
F --> G["streampixels.gamecult.org static HTTPS"]
G --> H["gamecult.org/livestream static viewer"]
```
## Authority Map
- Owner: `Mimir.Broadcast` owns the Starfire-side encoded push command.
- Inputs: final program media, FFmpeg/NVENC capability, and the SSH-forwarded
RTMP endpoint.
- Outputs: one CBR H.264/AAC RTMP stream to Yggdrasil.
- Derived state: Yggdrasil's HLS playlist and segments are derived from that
encoded stream. They do not own composition, timing, or transcoding.
- Forbidden writers: Yggdrasil must not transcode the program stream in the
first live edge. OBS is not the primary broadcast owner.
- Shared paths: synthetic smokes and real program pushes use the same RTMP URL:
`rtmp://127.0.0.1:11935/live/mimir`.
- Deletion line: if a later CDN or WebRTC edge appears, keep this path as the
simple origin proof or delete it. Do not keep two public stream authorities.
## First Smoke
On Starfire, with an SSH local forward active to Yggdrasil's localhost RTMP
port:
```powershell
dotnet run --project .\src\Mimir.Broadcast\Mimir.Broadcast.csproj -- --smoke
dotnet run --project .\src\Mimir.Broadcast\Mimir.Broadcast.csproj -- --print-command
```
The default push target is:
```text
rtmp://127.0.0.1:11935/live/mimir
```
The public HLS playlist is served on the existing Yggdrasil-routed
StreamPixels domain:
```text
https://streampixels.gamecult.org/mimir/live/hls/mimir.m3u8
```
The static viewer lives on the root GameCult site:
```text
https://gamecult.org/livestream
```
## Scaling Rule
Viewer capacity is approximately:
```text
available Yggdrasil egress / encoded bitrate
```
Micro-optimizations count only when they improve target-host measurements:
served Mbps, p95 segment latency, CPU, memory, syscalls, or stall rate on
Yggdrasil. The first edge uses nginx static serving and kernel file paths so
the hot path is byte distribution, not application code.