Null-DRM-Official/apps/streamd/README.md
404errordeveloper 8fc7e4c0b8 streamd: serve start/stop/update, streamd.yaml, egress, module panel fixes
- Add streamd serve start|stop|restart|status|update with auto-written streamd.yaml
- Panel modules: STREAMD_MODULES_DIR for describe, YAML channel fallback, textarea value fix
- Per-stream WireGuard/SOCKS egress profiles + Settings UI
- Drop drm-* from release builds; track streamd-bg.sh / streamd-update.sh wrappers
- Docs: streamd-server-setup lifecycle and update flow
2026-10-10 18:05:51 +02:00

75 lines
2.7 KiB
Markdown

# streamd
Control plane: REST API, SQLite, dashboard and media supervisor. Hosted by the
single binary as `streamd serve`.
```text
apps/streamd/
servecmd/ the command body, imported by apps/cli
internal/api HTTP handlers
internal/auth sessions, API keys, roles
internal/db SQLite store
internal/ui dashboard
internal/supervisor downloader + ffmpeg supervision
internal/ws agent + dashboard websockets
```
## Run
```bash
./bin/streamd serve --bind 127.0.0.1:8083
# --data is optional: reuses existing .cache/streamd (cwd or next to the binary)
# or set STREAMD_DATA / pass --data explicitly
```
`--bind` defaults to **`127.0.0.1:8083`** (loopback). Binding `0.0.0.0` (or any
non-loopback address) logs a startup warning — put TLS in front, or keep loopback
and reverse-proxy. Port 8083 stays clear of anything already on 8080/8081.
On start, missing media tools are downloaded into `bin/` (ffmpeg, N_m3u8DL-RE,
mp4decrypt) unless you pass `--skip-deps`.
### Auth
The old shared bearer token is optional and discouraged. Prefer:
1. First-run setup creates an **admin** account (or `--admin-user` / `--admin-pass`).
2. Sign in at the dashboard (session cookie + CSRF).
3. Create **API keys** (Settings → API keys) for agents and scripts — roles
`admin` / `operator` / `viewer`.
Legacy `--token` / `STREAMD_TOKEN` still works as an admin API key and logs a
warning so you can migrate.
`GET /api/health` stays readable without a principal (liveness only). Stream list,
credentials, and mutations need a session or API key.
## API (short)
| Method | Path | Notes |
|---|---|---|
| GET | `/api/health` | liveness (+ deps when authenticated) |
| GET | `/api/apps` | modules, channels, rewriters |
| GET | `/api/streams` | list + runtime (agent polls this) |
| POST | `/api/streams` | create (`enabled` defaults false unless set; use the form checkbox) |
| GET/PATCH/DELETE | `/api/streams/:id` | detail / edit / delete |
| POST | `/api/streams/:id/start\|stop\|restart` | desired state |
| POST | `/api/streams/:id/capture` | ask connected agents to refresh credentials now |
| POST | `/api/streams/:id/credentials` | `{mpd,key?,…}` — restarts if enabled |
| POST | `/api/streams/:id/claim` | agent lease |
HLS output is served from `--data/www` at `/hls/<name>/index.m3u8`.
Installation-wide settings (`idle_timeout_s`, `default_on_demand`,
`default_outputs`, packager knobs) apply when creating a stream that omits those
fields, or at the next media start for packager knobs.
## No provider knowledge
App/channel pickers come from `/api/apps`. Downloader settings resolve at start:
```text
stored row -> app module (StreamDefaults) -> installation settings -> neutral defaults
```
**Full guide: [docs/streamd.md](../../docs/streamd.md)**