feat(service_livekit): per-user livekit ports via hero_cfg.toml [livekit] #176
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_skills!176
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/livekit-per-user-ports-auto"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #175. Supersedes #174 (which is now closed — the forward-compat 1-liner from that PR is folded into this single commit).
Companion to hero_livekit#34.
Summary
Single file changed (
tools/modules/services/service_livekit.nu). Two coordinated edits:svx_lk_read_hero_cfg_livekit— reads[livekit]section from~/hero/cfg/hero_cfg.toml, returns{}if missing.svx_lk_install_and_configurereads the section once and passes the values (with0fallback for missing fields) intocfg_params'slivekit_port/rtc_tcp_port/backend_port.Makes service_livekit.nu both (a) forward-compatible with hero_livekit#34's required
rtc_tcp_portparam, and (b) per-user-aware via cfg.toml.Architecture
hero_cfg.tomlis the durable per-user source. Already carries[mycelium]; adding[livekit]follows the existing pattern (service_router.nu/service_collab.nuread sections from the same file).runtime.jsonis correctly modeled as a derived cache. The wipe insvx_lk_wipe_stale_configsstays untouched — it correctly forces a clean slate on inconsistency. Per-user values survive wipes because the nextservice_livekit startre-readshero_cfg.tomland re-derives runtime.json from there.An earlier draft (#174) considered preserving runtime.json across wipes — that was the wrong layer to fix it and was dropped.
Behavior
[livekit][livekit][livekit]per userOperator workflow on a multi-user box
Then
service_livekit startand never touch it again.Compatibility matrix with hero_livekit binary versions
Land this PR at-or-before the hero_livekit binary is upgraded on operator boxes.
What's intentionally NOT in this PR
An allocator that auto-writes the
[livekit]section. The section is operator-managed today; if a tool to allocate non-overlapping triples becomes useful, it can be added as a separate small helper (e.g.hero_user_livekit_alloc <user>) — kept OUT ofmulti_user_add, which is mycelium-focused and shouldn't carry livekit-specific allocation logic.Test plan
service_livekit startwith no[livekit]section: defaults apply, single-user setup unchangedservice_livekit startwith[livekit]section: values flow into configure RPC → runtime.json → yaml → livekit-server bindservice_livekit start --reset(which wipes runtime.json): next start re-reads cfg.toml[livekit], values reconstructedCompanion to hero_livekit#34 + hero_skills#174. Closes the loop on multi-user livekit by sourcing per-user port values from a durable location (hero_cfg.toml) instead of relying on runtime.json being preserved across wipes. What changes: - New helper svx_lk_read_hero_cfg_livekit reads [livekit] section from ~/hero/cfg/hero_cfg.toml. Returns {} if the file or section is missing — callers default each field to 0 ("keep current"). - svx_lk_install_and_configure reads the section once and passes the values into cfg_params. Hardcoded 0 placeholders are replaced with the read values. Architecture: hero_cfg.toml is the durable per-user source (alongside [mycelium]). runtime.json is a derived cache that gets regenerated by the next configure RPC after every --reset / wipe. So per-user values survive wipes by being re-read from cfg.toml here, not by preserving the cache. The wipe in svx_lk_wipe_stale_configs stays untouched. Backwards-compatible: - Single-user setups (no [livekit] section): each field falls back to 0 → wrapper uses defaults (7880/7881/8081). Existing single- user installs untouched. - Multi-user setups: operator (or external allocator) writes the [livekit] section once per user; service_livekit start picks it up automatically every restart. No bypass needed. Pattern matches how service_router.nu / service_collab.nu read [mycelium] from the same file. Per-user port allocation policy is intentionally kept OUT of this PR. The [livekit] section is operator-managed today (or by a future hero_skills helper command). multi_user_add stays focused on mycelium; bolting on a livekit-specific allocator there would be out of pattern. If a tool to auto-allocate triples becomes useful, it can be added separately as e.g. `hero_user_livekit_alloc <user>` without touching multi_user_add. Test plan: - service_livekit start with no [livekit] section: defaults apply (7880/7881/8081), single-user setup unchanged. - service_livekit start with [livekit] section: values flow into configure RPC -> runtime.json -> rendered yaml -> livekit-server binds the configured ports. - service_livekit start --reset (which wipes runtime.json): next start re-reads cfg.toml [livekit], values reconstructed.5500b7b10eto489b49d584feat(service_livekit): read [livekit] section from hero_cfg.toml for per-user portsto feat(service_livekit): per-user livekit ports via hero_cfg.toml [livekit]