From 60f5c970597c51e79038f4a706c00b11b9d01a36 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 15 Jul 2026 03:17:04 +0100 Subject: [PATCH] Add Yggdrasil-local Idunn authority --- crates/idunn-daemon/src/main.rs | 64 ++++++++++++++++++++++++++++++++- docs/idunn.md | 7 ++++ scripts/linux/idunn-yggdrasil | 35 ++++++++++++++++++ 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 scripts/linux/idunn-yggdrasil diff --git a/crates/idunn-daemon/src/main.rs b/crates/idunn-daemon/src/main.rs index 4aad4a4..d966eef 100644 --- a/crates/idunn-daemon/src/main.rs +++ b/crates/idunn-daemon/src/main.rs @@ -2072,9 +2072,71 @@ fn daemon_surgery_plan(target: &DaemonTarget, updated_at: &str) -> IdunnDaemonSu fn swarm_targets(options: &SwarmOptions) -> Result> { let repo_root = options.repo_root.display().to_string(); let script = |name: &str| format!(r"{}\scripts\{}", repo_root, name); + let yggdrasil_actuator = |action: &str, target: &str| { + format!("sudo -n /usr/local/libexec/idunn-yggdrasil {action} {target}") + }; let project = |name: &str| PathBuf::from(format!(r"E:\Projects\{name}")); match options.profile.as_str() { + "yggdrasil-local" => Ok(vec![ + DaemonTarget { + daemon_id: "yggdrasil-heimdall".to_string(), + verse_id: "yggdrasil.local".to_string(), + name: "Yggdrasil Heimdall".to_string(), + health_contract: health_contract("heimdall.cultnet-rudp-provider-health", "failed"), + deploy_command: Some(yggdrasil_actuator("deploy", "heimdall")), + restart_command: Some(yggdrasil_actuator("restart", "heimdall")), + release: Some(release_target( + "Heimdall", + PathBuf::from("/srv/build/Heimdall"), + "restart-after-verified-build", + None, + "restart-required", + )), + enabled: true, + interval_seconds: 300, + }, + DaemonTarget { + daemon_id: "yggdrasil-repixelizer".to_string(), + verse_id: "yggdrasil.local".to_string(), + name: "Yggdrasil Repixelizer".to_string(), + health_contract: health_contract( + "repixelizer.cultnet-rudp-service-health", + "failed", + ), + deploy_command: Some(yggdrasil_actuator("deploy", "repixelizer")), + restart_command: Some(yggdrasil_actuator("restart", "repixelizer")), + release: Some(release_target( + "repixelizer", + PathBuf::from("/srv/build/repixelizer"), + "restart-after-verified-build", + None, + "restart-required", + )), + enabled: true, + interval_seconds: 300, + }, + DaemonTarget { + daemon_id: "yggdrasil-streampixels".to_string(), + verse_id: "yggdrasil.local".to_string(), + name: "Yggdrasil StreamPixels".to_string(), + health_contract: health_contract( + "streampixels.cultnet-rudp-service-health", + "failed", + ), + deploy_command: Some(yggdrasil_actuator("deploy", "streampixels")), + restart_command: Some(yggdrasil_actuator("restart", "streampixels")), + release: Some(release_target( + "StreamPixels", + PathBuf::from("/srv/build/StreamPixels"), + "restart-after-verified-build", + None, + "restart-required", + )), + enabled: true, + interval_seconds: 300, + }, + ]), "starfire-local" => Ok(vec![ DaemonTarget { daemon_id: "odin".to_string(), @@ -2992,7 +3054,7 @@ fn unix_epoch_millis() -> Result { } fn help_text() -> &'static str { - "Usage: idunn --daemon [--name ] [--verse ] [--store ] [--deploy-command ] [--restart-command ] [--operator-alarm-command ] [--rudp-health-bind ] [--execute] [--interval-seconds ] [--command-timeout-seconds ] [--repo-root ] [--swarm-profile ]\n idunn restart --daemon [--store ] [--requested-by ] [--detail ]\n idunn redeploy --daemon [--store ] [--requested-by ] [--detail ]\n\nIdunn supervises daemon-published CultNet/RUDP health with --daemon, or a built-in swarm supervisor with --swarm-profile starfire-local. RUDP health ingress is disabled unless --rudp-health-bind is supplied. The restart/redeploy verbs publish typed idunn.lifecycle_command.v1 records; the running supervisor claims them and executes only through its configured command boundary." + "Usage: idunn --daemon [--name ] [--verse ] [--store ] [--deploy-command ] [--restart-command ] [--operator-alarm-command ] [--rudp-health-bind ] [--execute] [--interval-seconds ] [--command-timeout-seconds ] [--repo-root ] [--swarm-profile ]\n idunn restart --daemon [--store ] [--requested-by ] [--detail ]\n idunn redeploy --daemon [--store ] [--requested-by ] [--detail ]\n\nIdunn supervises daemon-published CultNet/RUDP health with --daemon, or a built-in swarm supervisor with --swarm-profile starfire-local or yggdrasil-local. RUDP health ingress is disabled unless --rudp-health-bind is supplied. The restart/redeploy verbs publish typed idunn.lifecycle_command.v1 records; the running supervisor claims them and executes only through its configured command boundary." } #[cfg(test)] diff --git a/docs/idunn.md b/docs/idunn.md index fc38312..62ac224 100644 --- a/docs/idunn.md +++ b/docs/idunn.md @@ -80,6 +80,13 @@ Idunn now shares Odin's Rust body: supplied. - `npm run idunn:start -- --swarm-profile starfire-local --repo-root E:\Projects\Odin --execute` runs the singular local swarm supervisor. +- `--swarm-profile yggdrasil-local` is the Linux host-local supervisor for + Heimdall, Repixelizer, and StreamPixels. Its only command boundary is the + root-owned `/usr/local/libexec/idunn-yggdrasil` actuator. Restart commands + target the local Compose stack; deployment fails closed unless a root-owned + executable manifest exists for that service under + `/srv/odin/deploy-manifests`. It does not inherit Starfire paths, SSH keys, + ADB authority, or Windows process ownership. The current typed records are: diff --git a/scripts/linux/idunn-yggdrasil b/scripts/linux/idunn-yggdrasil new file mode 100644 index 0000000..136185e --- /dev/null +++ b/scripts/linux/idunn-yggdrasil @@ -0,0 +1,35 @@ +#!/bin/sh +set -eu + +if [ "$(id -u)" -ne 0 ]; then + echo "idunn-yggdrasil must run through its narrow sudo boundary" >&2 + exit 1 +fi + +action="${1:-}" +target="${2:-}" +compose=/srv/compose/yggdrasil-apps.yaml + +case "$action:$target" in + restart:heimdall) + exec docker compose -f "$compose" restart heimdall + ;; + restart:repixelizer) + exec docker compose -f "$compose" restart repixelizer + ;; + restart:streampixels) + docker compose -f "$compose" restart streampixels-service streampixels-web + ;; + deploy:heimdall|deploy:repixelizer|deploy:streampixels) + manifest="/srv/odin/deploy-manifests/$target" + if [ ! -x "$manifest" ] || [ ! -O "$manifest" ]; then + echo "root-owned executable deploy manifest is not installed: $manifest" >&2 + exit 1 + fi + exec "$manifest" + ;; + *) + echo "unsupported Idunn Yggdrasil actuator request: $action $target" >&2 + exit 2 + ;; +esac