Move Idunn's unit files, docs and operator scripts out of Odin

Completes the extraction. Unit files and documentation went to the Idunn
repository, where a service's own deployment surface belongs. Operator scripts
went to gamecult-ops, which is where fleet tooling lives.

To Idunn: scripts/linux/idunn-yggdrasil{,.service,.sudoers}, docs/idunn.md,
docs/idunn-deployment-authority.md,
docs/idunn-signed-daemon-health-authority.md, src/Idunn/README.md.

To gamecult-ops/scripts/idunn/: the eight PowerShell and cmd operator tools --
deployment targets, startup install, swarm coverage health, operator alarm
notification, local start.

Staying in Odin, deliberately: crates/odin-core/src/idunn.rs, Odin's own
projection of Idunn state for aggregation; src/odin/idunn-rudp.cjs, its client
for talking to Idunn; test/idunn-signed-health.test.cjs, its own integration
test; and deployment/idunn/recipe.toml, which despite the path builds
odin-daemon and is Odin's recipe expressed in Idunn's format.

docs/transport-shortcut-inventory.md is a dated evidence ledger citing several
of the moved script paths. Its entries are left as written and a path note
added at the top -- rewriting a ledger to match a later reorganisation would
destroy the record it exists to keep.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-05 18:16:38 +02:00
commit 222fe03896
17 changed files with 8 additions and 2234 deletions

View file

@ -1,2 +0,0 @@
@echo off
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0health-idunn-swarm-deployment-coverage.ps1

View file

@ -1,79 +0,0 @@
$ErrorActionPreference = "Stop"
. (Join-Path $PSScriptRoot "idunn-deployment-targets.ps1")
$unknown = @($IdunnDeploymentTargets | Where-Object { $_.Status -notin @("enforced", "runtime-enforced", "blocked", "external-owned", "not-runtime", "archived") })
$enforcedWithoutDeploy = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "enforced" -and [string]::IsNullOrWhiteSpace($_.Deploy) })
$enforcedWithoutHealth = @($IdunnDeploymentTargets | Where-Object { $_.Status -in @("enforced", "runtime-enforced") -and $_.Id -ne "idunn" -and [string]::IsNullOrWhiteSpace($_.Health) })
$enforcedWithoutUpstream = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "enforced" -and ([string]::IsNullOrWhiteSpace($_.UpstreamRemote) -or [string]::IsNullOrWhiteSpace($_.UpstreamBranch)) })
$enforcedWithoutRollout = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "enforced" -and ([string]::IsNullOrWhiteSpace($_.RolloutStrategy) -or [string]::IsNullOrWhiteSpace($_.StateMigration) -or [string]::IsNullOrWhiteSpace($_.ZeroDowntime)) })
$blockedWithoutReason = @($IdunnDeploymentTargets | Where-Object { $_.Status -in @("blocked", "external-owned") -and [string]::IsNullOrWhiteSpace($_.Reason) })
$deployScriptsWithoutIdunnGuard = @(
$IdunnDeploymentTargets |
Where-Object { $_.Status -eq "enforced" -and -not [string]::IsNullOrWhiteSpace($_.Deploy) } |
Where-Object {
if ($_.Deploy -match '^sudo -n /usr/local/libexec/idunn-yggdrasil deploy [a-z0-9-]+$') {
return $false
}
-not (Test-Path -LiteralPath $_.Deploy) -or
-not ((Get-Content -Raw -LiteralPath $_.Deploy) -match 'IDUNN_ACTUATOR')
}
)
$knownActuatorPaths = @{}
foreach ($target in $IdunnDeploymentTargets) {
foreach ($path in @($target.Deploy, $target.Restart) + @($target.Aliases)) {
if (-not [string]::IsNullOrWhiteSpace($path) -and (Test-Path -LiteralPath $path)) {
$knownActuatorPaths[[System.IO.Path]::GetFullPath($path).ToLowerInvariant()] = $target.Id
}
}
}
foreach ($path in $IdunnDeploymentSharedActuators) {
if (-not [string]::IsNullOrWhiteSpace($path)) {
$knownActuatorPaths[[System.IO.Path]::GetFullPath($path).ToLowerInvariant()] = "shared"
}
}
$guardedActuatorsWithoutCatalog = @(
Get-ChildItem -LiteralPath $PSScriptRoot -File |
Where-Object {
$_.Name -match '^(deploy|restart)-.*\.(ps1|cmd)$' -and
(Get-Content -Raw -LiteralPath $_.FullName) -match 'IDUNN_ACTUATOR' -and
-not $knownActuatorPaths.ContainsKey([System.IO.Path]::GetFullPath($_.FullName).ToLowerInvariant())
}
)
$issues = @()
if ($unknown.Count) {
$issues += "unknown status: $($unknown.Id -join ', ')"
}
if ($enforcedWithoutDeploy.Count) {
$issues += "enforced target missing deploy command: $($enforcedWithoutDeploy.Id -join ', ')"
}
if ($enforcedWithoutHealth.Count) {
$issues += "enforced target missing health command: $($enforcedWithoutHealth.Id -join ', ')"
}
if ($enforcedWithoutUpstream.Count) {
$issues += "enforced target missing upstream remote/branch: $($enforcedWithoutUpstream.Id -join ', ')"
}
if ($enforcedWithoutRollout.Count) {
$issues += "enforced target missing rollout/migration/downtime contract: $($enforcedWithoutRollout.Id -join ', ')"
}
if ($deployScriptsWithoutIdunnGuard.Count) {
$issues += "enforced deploy script missing Idunn actuator guard: $($deployScriptsWithoutIdunnGuard.Id -join ', ')"
}
if ($guardedActuatorsWithoutCatalog.Count) {
$issues += "guarded deploy/restart actuator missing Idunn catalog entry: $($guardedActuatorsWithoutCatalog.Name -join ', ')"
}
if ($blockedWithoutReason.Count) {
$issues += "blocked/external target missing reason: $($blockedWithoutReason.Id -join ', ')"
}
if ($issues.Count) {
throw "Idunn deployment target catalog is incoherent: $($issues -join '; ')"
}
$enforced = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "enforced" })
$runtimeEnforced = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "runtime-enforced" })
$blocked = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "blocked" })
$external = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "external-owned" })
$archived = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "archived" })
Write-Host "Idunn deployment catalog coherent: $($IdunnDeploymentTargets.Count) targets, $($enforced.Count) deploy-enforced with upstream rollout contracts, $($runtimeEnforced.Count) runtime-enforced, $($blocked.Count) blocked, $($external.Count) external-owned, $($archived.Count) archived, $($knownActuatorPaths.Count) cataloged actuator paths."

View file

@ -1,289 +0,0 @@
$repoRoot = Split-Path -Parent $PSScriptRoot
$projectsRoot = Split-Path -Parent $repoRoot
$IdunnDeploymentSharedActuators = @(
"$repoRoot\scripts\deploy-yggdrasil-source-app.ps1"
)
$IdunnDeploymentTargets = @(
[pscustomobject]@{
Id = "odin"
Repo = "Odin"
LocalPath = "$projectsRoot\Odin"
Host = "starfire"
Service = "odin-coordinator"
Status = "runtime-enforced"
Health = "daemon-published-rudp:odin.cultnet-rudp-provider-health"
Deploy = $null
Restart = "$repoRoot\scripts\restart-odin.ps1"
Aliases = @("$repoRoot\scripts\restart-odin.cmd")
Reason = "Central Idunn keeps Odin's all-seer/rendezvous daemon alive; Odin owns Verse discovery while Idunn owns lifecycle actuation."
},
[pscustomobject]@{
Id = "idunn"
Repo = "Odin"
LocalPath = "$projectsRoot\Odin"
Host = "starfire"
Service = "idunn swarm supervisor"
Status = "runtime-enforced"
Health = $null
Deploy = $null
Restart = $null
Aliases = @()
Reason = "start-idunn-local.ps1 is the bootstrap for Idunn itself; it is not a deploy/restart actuator over another daemon."
},
[pscustomobject]@{
Id = "hermodr"
Repo = "Odin"
LocalPath = "$projectsRoot\Odin"
Host = "starfire"
Service = "Hermodr browser lowering"
Status = "runtime-enforced"
Health = "daemon-published-rudp:hermodr.cultnet-rudp-browser-lowering-health"
Deploy = $null
Restart = "$repoRoot\scripts\restart-hermodr.ps1"
Aliases = @()
Reason = "Idunn keeps Hermodr's browser lowering alive; Hermodr publishes its own RUDP health while Odin remains the CultMesh discovery authority."
},
[pscustomobject]@{
Id = "stonks"
Repo = "Stonks"
LocalPath = "$projectsRoot\Stonks"
Host = "starfire"
Service = "stonks daemon"
Status = "runtime-enforced"
Health = "daemon-published-rudp:stonks.cultnet-rudp-market-health"
Deploy = $null
Restart = "$repoRoot\scripts\restart-stonks.cmd"
Aliases = @()
Reason = "Stonks publishes market/provider state and daemon health through CultMesh/CultNet; local restart is an Idunn actuator only."
},
[pscustomobject]@{
Id = "weksa"
Repo = "weksa"
LocalPath = "$projectsRoot\weksa"
Host = "starfire"
Service = "weksa daemon"
Status = "runtime-enforced"
Health = "daemon-published-rudp:weksa.cultnet-rudp-provider-health"
Deploy = $null
Restart = "$repoRoot\scripts\restart-weksa.cmd"
Aliases = @()
Reason = "Weksa provider state and health are daemon-owned CultMesh/CultNet records; local restart is an Idunn actuator only."
},
[pscustomobject]@{
Id = "starfire-muninn"
Repo = "Odin"
LocalPath = "$projectsRoot\Odin"
Host = "starfire"
Service = "muninn serve --host starfire"
Status = "runtime-enforced"
Health = "daemon-published-rudp:muninn.cultnet-rudp-local-telemetry-and-quest-access"
Deploy = $null
Restart = "$repoRoot\scripts\restart-starfire-muninn.ps1"
Aliases = @("$repoRoot\scripts\restart-starfire-muninn.cmd")
Reason = "Central Idunn keeps Starfire-local Muninn alive for Quest access and local telemetry surfaces."
},
[pscustomobject]@{
Id = "raven-muninn"
Repo = "Odin"
LocalPath = "$projectsRoot\Odin"
Host = "raven"
Service = "muninn serve --host raven"
Status = "runtime-enforced"
Health = "daemon-published-rudp:muninn.cultnet-rudp-remote-telemetry-health"
Deploy = $null
Restart = "$repoRoot\scripts\restart-muninn.ps1"
Aliases = @("$repoRoot\scripts\restart-muninn.cmd")
Reason = "Central Idunn keeps Raven Muninn's remote telemetry posture alive without activating A/V capture as part of keepalive."
},
[pscustomobject]@{
Id = "nightwing-muninn"
Repo = "Odin"
LocalPath = "$projectsRoot\Odin"
Host = "nightwing"
Service = "muninn serve --host nightwing"
Status = "runtime-enforced"
Health = "daemon-published-rudp:muninn.cultnet-rudp-remote-telemetry-and-move-hid"
Deploy = $null
Restart = "$repoRoot\scripts\restart-nightwing-muninn.ps1"
Aliases = @("$repoRoot\scripts\restart-nightwing-muninn.cmd")
Reason = "Central Idunn reaches Nightwing over SSH and keeps the host-local Muninn Move HID daemon alive."
},
[pscustomobject]@{
Id = "vili"
Repo = "Vili"
LocalPath = "$projectsRoot\Vili"
Host = "raven"
Service = "GameCult\\Vili"
Status = "runtime-enforced"
Health = "daemon-published-rudp:vili.cultnet-rudp-animation-health"
Deploy = $null
Restart = "$repoRoot\scripts\restart-vili.cmd"
Aliases = @("$repoRoot\scripts\restart-vili.ps1")
Reason = "Central Idunn keeps Raven Vili's typed motion daemon alive; command requests and health are CultMesh/CultNet-owned."
},
[pscustomobject]@{
Id = "raven-sleipnir"
Repo = "Odin"
LocalPath = "$projectsRoot\Odin"
Host = "raven"
Service = "sleipnir --host raven"
Status = "runtime-enforced"
Health = "daemon-published-rudp:sleipnir.cultnet-rudp-input-mirror-health"
Deploy = "$repoRoot\scripts\deploy-raven-sleipnir.ps1"
Restart = "$repoRoot\scripts\restart-raven-sleipnir.ps1"
Aliases = @()
Reason = "Central Idunn reaches Raven over SSH and keeps Sleipnir's hidden scheduled task alive while Sleipnir publishes daemon-owned RUDP health."
},
[pscustomobject]@{
Id = "yggdrasil-voidbot"
Repo = "VoidBot"
LocalPath = "/srv/build/VoidBot"
Host = "yggdrasil"
Service = "voidbot.service"
Status = "enforced"
Health = "daemon-published-rudp:voidbot.cultnet-rudp-stack-health"
Deploy = "sudo -n /usr/local/libexec/idunn-yggdrasil deploy voidbot"
Restart = "sudo -n /usr/local/libexec/idunn-yggdrasil restart voidbot"
Aliases = @()
UpstreamRemote = "origin"
UpstreamBranch = "main"
RolloutStrategy = "restart-after-verified-build"
StateMigration = "daemon-owned-noop"
ZeroDowntime = "restart-required"
Reason = "Yggdrasil-local Idunn deploys upstream VoidBot releases through the narrow root-owned manifest; local checkouts have no deployment authority."
},
[pscustomobject]@{
Id = "yggdrasil-bifrost"
Repo = "Bifrost"
LocalPath = "$projectsRoot\Bifrost"
Host = "yggdrasil"
Service = "bifrost.service"
Status = "blocked"
Health = $null
Deploy = $null
Restart = $null
Aliases = @()
Reason = "Committed Bifrost HEAD currently expects UserAccounts.HeimdallAccountId, but Yggdrasil's production database lacks that column and EF reports no pending migration. Idunn must not enforce Bifrost freshness until the Bifrost schema migration path is fixed."
},
[pscustomobject]@{
Id = "yggdrasil-streampixels"
Repo = "StreamPixels"
LocalPath = "$projectsRoot\StreamPixels"
Host = "yggdrasil"
Service = "streampixels-service/streampixels-web"
Status = "enforced"
Health = "daemon-published-rudp:streampixels.cultnet-rudp-service-health"
Deploy = "$repoRoot\scripts\deploy-yggdrasil-streampixels.cmd"
Restart = $null
Aliases = @("$repoRoot\scripts\deploy-yggdrasil-streampixels.ps1")
UpstreamRemote = "origin"
UpstreamBranch = "main"
RolloutStrategy = "restart-after-verified-build"
StateMigration = "daemon-owned-noop"
ZeroDowntime = "restart-required"
Reason = "Idunn packages upstream origin/main for StreamPixels, runs the existing ops deploy/check scripts, and verifies the remote manifest."
},
[pscustomobject]@{
Id = "yggdrasil-heimdall"
Repo = "Heimdall"
LocalPath = "$projectsRoot\Heimdall"
Host = "yggdrasil"
Service = "heimdall.service"
Status = "enforced"
Health = "daemon-published-rudp:heimdall.cultnet-rudp-provider-health"
Deploy = "$repoRoot\scripts\deploy-yggdrasil-heimdall.cmd"
Restart = $null
Aliases = @("$repoRoot\scripts\deploy-yggdrasil-heimdall.ps1")
UpstreamRemote = "origin"
UpstreamBranch = "main"
RolloutStrategy = "restart-after-verified-build"
StateMigration = "daemon-owned-noop"
ZeroDowntime = "restart-required"
Reason = "Idunn packages upstream origin/main for Heimdall, runs the existing ops deploy/check scripts, and verifies the remote manifest."
},
[pscustomobject]@{
Id = "yggdrasil-repixelizer"
Repo = "repixelizer"
LocalPath = "$projectsRoot\repixelizer"
Host = "yggdrasil"
Service = "repixelizer-gui.service"
Status = "enforced"
Health = "daemon-published-rudp:repixelizer.cultnet-rudp-service-health"
Deploy = "$repoRoot\scripts\deploy-yggdrasil-repixelizer.cmd"
Restart = $null
Aliases = @("$repoRoot\scripts\deploy-yggdrasil-repixelizer.ps1")
UpstreamRemote = "origin"
UpstreamBranch = "main"
RolloutStrategy = "restart-after-verified-build"
StateMigration = "daemon-owned-noop"
ZeroDowntime = "restart-required"
Reason = "Idunn packages upstream origin/main for repixelizer, runs the existing ops deploy/check scripts, and verifies the remote manifest."
},
[pscustomobject]@{
Id = "github-pages-gamecult-site"
Repo = "gamecult-site"
LocalPath = "$projectsRoot\gamecult-site"
Host = "github-pages"
Service = "gamecult.org/www"
Status = "external-owned"
Health = $null
Deploy = $null
Restart = $null
Aliases = @()
Reason = "GitHub Actions/Pages owns deployment freshness; Idunn should ingest workflow/deployment status before claiming automatic deploy authority."
},
[pscustomobject]@{
Id = "eve-ipad-evecanvas"
Repo = "Eve"
LocalPath = "$projectsRoot\Eve"
Host = "eve-ipad"
Service = "org.gamecult.evecanvas"
Status = "blocked"
Health = $null
Deploy = $null
Restart = $null
Aliases = @()
Reason = "Jailbroken iPad native app deployment exists only as an operator runbook; no safe noninteractive Idunn deploy command yet."
},
[pscustomobject]@{
Id = "periwinkle-eve-android"
Repo = "Eve"
LocalPath = "$projectsRoot\Eve"
Host = "periwinkle"
Service = "Eve Android proof APK"
Status = "blocked"
Health = $null
Deploy = $null
Restart = $null
Aliases = @()
Reason = "Android USB install requires on-device approval; Idunn must not claim automatic deploy authority until that boundary is solved."
},
[pscustomobject]@{
Id = "nightwing-eve-dashboard"
Repo = "Mimir"
LocalPath = "$projectsRoot\Mimir"
Host = "nightwing"
Service = "nightwing-eve-dashboard.service"
Status = "archived"
Health = $null
Deploy = $null
Restart = $null
Aliases = @("$repoRoot\scripts\restart-nightwing-eve-dashboard.cmd")
Reason = "Nightwing Eve dashboard's old HTTP/WebSocket broker is archived. Rebuild it only as typed CultMesh/Odin state publication plus renderer lowering before restoring Idunn lifecycle authority."
},
[pscustomobject]@{
Id = "nightwing-eve-browser-reference"
Repo = "Eve"
LocalPath = "$projectsRoot\Eve"
Host = "nightwing"
Service = "nightwing-eve-browser-reference.service"
Status = "runtime-enforced"
Health = "daemon-published-rudp:nightwing.cultnet-rudp-browser-reference-health"
Deploy = $null
Restart = "$repoRoot\scripts\restart-nightwing-eve-browser-reference.ps1"
Aliases = @("$repoRoot\scripts\restart-nightwing-eve-browser-reference.cmd")
Reason = "Nightwing Eve browser reference publishes daemon-owned boundary witnesses and RUDP health; systemd restart is an Idunn actuator only."
}
)

View file

@ -1,26 +0,0 @@
param(
[string] $TaskName = "Idunn Local Keepalive",
[int] $IntervalSeconds = 30
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$scriptPath = Join-Path $repoRoot "scripts\start-idunn-local.ps1"
$powershell = Join-Path $env:SystemRoot "System32\WindowsPowerShell\v1.0\powershell.exe"
$taskCommand = "`"$powershell`" -NoProfile -NonInteractive -ExecutionPolicy Bypass -File `"$scriptPath`" -IntervalSeconds $IntervalSeconds"
& schtasks.exe /Create /TN $TaskName /SC ONLOGON /TR $taskCommand /F | Out-Null
if ($LASTEXITCODE -ne 0) {
$startupDir = [Environment]::GetFolderPath("Startup")
$startupScript = Join-Path $startupDir "$TaskName.cmd"
$cmd = "@echo off`r`ncd /d `"$repoRoot`"`r`n$taskCommand`r`n"
[System.IO.File]::WriteAllText($startupScript, $cmd, [System.Text.UTF8Encoding]::new($false))
Write-Host "Scheduled task install was denied; installed Startup folder launcher instead:"
Write-Host " $startupScript"
} else {
Write-Host "Installed scheduled task: $TaskName"
}
Write-Host "Starting Idunn watchdogs now..."
& $scriptPath -IntervalSeconds $IntervalSeconds

View file

@ -1,383 +0,0 @@
#!/bin/sh
set -eu
PATH=/usr/sbin:/usr/bin:/sbin:/bin
export PATH
LC_ALL=C
export LC_ALL
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
brake_store=/var/lib/gamecult/idunn-authority/deployment-brake.cc
brake_lock=/var/lib/gamecult/idunn-authority/deployment-brake.cc.lock
brake_anchor=/etc/gamecult/idunn/deployment-brake-operator-anchor.cc
generation_lock=/var/lib/gamecult/idunn-authority/idunn-generation.lock
idunn_provision=/usr/local/bin/idunn-provision
require_root_owned_nonwritable_component() {
component="$1"
kind="$2"
if [ -L "$component" ]; then
echo "privileged actuator path component must not be a symlink: $component" >&2
exit 1
fi
case "$kind" in
file) [ -f "$component" ] || { echo "privileged actuator path component is not a regular file: $component" >&2; exit 1; } ;;
directory) [ -d "$component" ] || { echo "privileged actuator path component is not a directory: $component" >&2; exit 1; } ;;
*) echo "internal privileged actuator path-kind error" >&2; exit 1 ;;
esac
owner="$(stat -c '%u' -- "$component")"
mode="$(stat -c '%a' -- "$component")"
[ "$owner" = 0 ] || { echo "privileged actuator path component is not root-owned: $component" >&2; exit 1; }
case "$mode" in
''|*[!0-7]*) echo "privileged actuator path component has an unreadable mode: $component" >&2; exit 1 ;;
esac
group_mode=$(( (mode / 10) % 10 ))
other_mode=$(( mode % 10 ))
if [ $((group_mode & 2)) -ne 0 ] || [ $((other_mode & 2)) -ne 0 ]; then
echo "privileged actuator path component is group/world-writable: $component" >&2
exit 1
fi
}
require_root_owned_regular_path() {
path="$1"
case "$path" in
/*) ;;
*) echo "privileged actuator path must be absolute: $path" >&2; exit 1 ;;
esac
ancestor="$(dirname -- "$path")"
while :; do
require_root_owned_nonwritable_component "$ancestor" directory
[ "$ancestor" = / ] && break
ancestor="$(dirname -- "$ancestor")"
done
require_root_owned_nonwritable_component "$path" file
}
require_root_owned_resolved_executable() {
entrypoint="$1"
ancestor="$(dirname -- "$entrypoint")"
while :; do
require_root_owned_nonwritable_component "$ancestor" directory
[ "$ancestor" = / ] && break
ancestor="$(dirname -- "$ancestor")"
done
[ -e "$entrypoint" ] || { echo "privileged executable entrypoint is missing: $entrypoint" >&2; exit 1; }
[ "$(stat -c '%u' -- "$entrypoint")" = 0 ] || { echo "privileged executable entrypoint is not root-owned: $entrypoint" >&2; exit 1; }
resolved="$(readlink -f -- "$entrypoint")"
[ -n "$resolved" ] || { echo "privileged executable entrypoint cannot be resolved: $entrypoint" >&2; exit 1; }
require_root_owned_regular_path "$resolved"
[ -x "$resolved" ] || { echo "privileged executable is not executable: $resolved" >&2; exit 1; }
}
acquire_idunn_generation_lock() {
# Every target consequence observes one installed Idunn generation. The
# self-bootstrap owns the exclusive side of this lock while replacing and
# accepting that generation; target manifests hold the shared side from
# admission through completion. This lock does not decide brake posture,
# target lifecycle, or release authority.
require_root_owned_regular_path "$generation_lock"
exec 8<"$generation_lock"
/usr/bin/flock --shared 8
}
deployment_target_policy() {
manifest_takes_action=false
minimum_source_revision_required=false
case "$target" in
odin)
daemon_id=yggdrasil-odin
repository_full_name=GameCult/Odin
upstream_ref=refs/heads/codex/ygg-idunn-independent-bootstrap
requires_bifrost_authority=false
manifest_takes_action=true
;;
codex-connector)
daemon_id=yggdrasil-codex-connector
repository_full_name=GameCult/CodexConnector
upstream_ref=refs/heads/codex/ghostlight-release-binding
requires_bifrost_authority=false
minimum_source_revision_required=true
manifest_takes_action=true
;;
ghostlight)
daemon_id=yggdrasil-ghostlight
repository_full_name=GameCult/Ghostlight
upstream_ref=refs/heads/codex/ghostlight-dungeon-mvp
requires_bifrost_authority=false
minimum_source_revision_required=true
manifest_takes_action=true
;;
voidbot)
daemon_id=yggdrasil-voidbot
repository_full_name=GameCult/VoidBot
upstream_ref=refs/heads/main
requires_bifrost_authority=false
manifest_takes_action=true
;;
heimdall)
daemon_id=yggdrasil-heimdall
repository_full_name=GameCult/Heimdall
upstream_ref=refs/heads/main
requires_bifrost_authority=false
;;
epiphany-capstone-17)
daemon_id=yggdrasil-epiphany-capstone-17
repository_full_name=GameCult/Epiphany
upstream_ref=refs/heads/codex/epiphany-shakedown-live
requires_bifrost_authority=false
manifest_takes_action=true
;;
epiphany)
daemon_id=yggdrasil-epiphany
repository_full_name=GameCult/Epiphany
upstream_ref=refs/heads/codex/epiphany-shakedown-live
requires_bifrost_authority=false
manifest_takes_action=true
;;
bifrost-persona-feedback)
daemon_id=yggdrasil-bifrost-persona-feedback
repository_full_name=GameCult/Bifrost
upstream_ref=refs/heads/main
requires_bifrost_authority=true
;;
repixelizer)
daemon_id=yggdrasil-repixelizer
repository_full_name=GameCult/repixelizer
upstream_ref=refs/heads/main
requires_bifrost_authority=false
;;
streampixels)
daemon_id=yggdrasil-streampixels
repository_full_name=GameCult/StreamPixels
upstream_ref=refs/heads/main
requires_bifrost_authority=false
;;
gjallar)
daemon_id=yggdrasil-gjallar
repository_full_name=GameCult/Gjallar
upstream_ref=refs/heads/codex/yggdrasil-aggregate-daemon
requires_bifrost_authority=false
;;
*) echo "deployment target has no root actuator policy: $target" >&2; exit 1 ;;
esac
}
require_signed_deployment_grant() {
source_commit="$3"
deployment_request_id="$4"
release_authority_id="$5"
release_authority_sha256="$6"
deployment_target_policy
case "$source_commit" in
*[!0-9a-f]*|'') echo "invalid or missing source commit" >&2; exit 1 ;;
esac
[ "${#source_commit}" -eq 40 ] || { echo "source commit must be 40 lowercase hex characters" >&2; exit 1; }
case "$deployment_request_id" in
*[!A-Za-z0-9._:/+-]*|'') echo "invalid or missing Idunn deployment request id" >&2; exit 1 ;;
esac
[ "${#deployment_request_id}" -le 256 ] || { echo "Idunn deployment request id is oversized" >&2; exit 1; }
case "$deployment_request_id" in
"deploy:$daemon_id:"?*|"manual:redeploy:$daemon_id:"?*) ;;
*) echo "signed deployment request is not for root target $target" >&2; exit 1 ;;
esac
case "$requires_bifrost_authority" in
true)
[ -n "$release_authority_id" ] || { echo "missing Bifrost release authority id" >&2; exit 1; }
case "$release_authority_sha256" in
*[!0-9a-f]*|'') echo "invalid or missing Bifrost release authority digest" >&2; exit 1 ;;
esac
[ "${#release_authority_sha256}" -eq 64 ] || { echo "Bifrost release authority digest must be 64 lowercase hex characters" >&2; exit 1; }
;;
false)
[ -z "$release_authority_id" ] || { echo "source-observed release cannot claim Bifrost authority id" >&2; exit 1; }
[ -z "$release_authority_sha256" ] || { echo "source-observed release cannot claim Bifrost authority digest" >&2; exit 1; }
;;
esac
require_root_owned_resolved_executable "$idunn_provision"
require_root_owned_regular_path "$brake_store"
require_root_owned_regular_path "$brake_lock"
require_root_owned_regular_path "$brake_anchor"
# This validation is the deployment-admission point. The signed expiry is a
# start-before deadline: it denies a later transaction, but does not become a
# timer-shaped veto over one already admitted. The root actuator remains the
# sole shared-lock holder through the synchronous consequence, so an explicit
# engage/release transition cannot race or rewrite that transaction.
exec 9<"$brake_lock"
/usr/bin/flock --shared 9
now_unix_millis="$(/usr/bin/date +%s%3N)"
case "$now_unix_millis" in
''|*[!0-9]*) echo "root actuator clock did not produce Unix milliseconds" >&2; exit 1 ;;
esac
"$idunn_provision" deployment-brake-status \
--store "$brake_store" \
--operator-anchor "$brake_anchor" \
--runtime-id yggdrasil \
--release-id "$source_commit" \
--deployment-id "$deployment_request_id" \
--now-unix-millis "$now_unix_millis"
if [ "$minimum_source_revision_required" = true ]; then
require_root_owned_resolved_executable /usr/local/bin/idunn
/usr/local/bin/idunn validate-minimum-source-revision \
--daemon "$daemon_id" \
--source-revision "$source_commit"
fi
if [ "$requires_bifrost_authority" = true ]; then
require_root_owned_resolved_executable /usr/local/bin/idunn
/usr/local/bin/idunn validate-release-authority \
--store /var/lib/gamecult/idunn/yggdrasil.keepalive.cc \
--release-authority-store /srv/bifrost/state/repository-release-authority.cc \
--repository-full-name "$repository_full_name" \
--upstream-ref "$upstream_ref" \
--source-revision "$source_commit" \
--release-authority-id "$release_authority_id" \
--release-authority-sha256 "$release_authority_sha256"
fi
}
manifest_group_exists() {
kill -s 0 "-$manifest_pid" 2>/dev/null
}
signal_manifest_group() {
kill -s "$1" "-$manifest_pid" 2>/dev/null || true
}
forward_manifest_signal() {
manifest_wait_interrupted=true
signal_manifest_group "$1"
}
run_manifest_while_holding_authority_locks() {
# Stay alive as the sole lock owner. The child must not inherit descriptors
# 8 or 9: flock locks attach to shared open-file descriptions, so an
# inherited descriptor could retain or unlock the parent's generation or
# deployment transaction. The owned process group also prevents ordinary
# descendants from outliving interruption.
require_root_owned_resolved_executable /usr/bin/setsid
/usr/bin/setsid "$@" 8<&- 9<&- &
manifest_pid=$!
manifest_wait_interrupted=false
trap 'forward_manifest_signal HUP' HUP
trap 'forward_manifest_signal INT' INT
trap 'forward_manifest_signal TERM' TERM
while :; do
manifest_wait_interrupted=false
if wait "$manifest_pid"; then
manifest_status=0
else
manifest_status=$?
fi
if [ "$manifest_wait_interrupted" = true ] && manifest_group_exists; then
continue
fi
break
done
trap - HUP INT TERM
manifest_descendants_leaked=false
if manifest_group_exists; then
manifest_descendants_leaked=true
signal_manifest_group TERM
for _ in 1 2 3 4 5; do
manifest_group_exists || break
sleep 1
done
fi
if manifest_group_exists; then
signal_manifest_group KILL
for _ in 1 2 3 4 5; do
manifest_group_exists || break
sleep 1
done
fi
if manifest_group_exists; then
echo "deployment manifest process group survived SIGKILL" >&2
return 1
fi
if [ "$manifest_descendants_leaked" = true ] && [ "$manifest_status" -eq 0 ]; then
echo "deployment manifest left a descendant process behind" >&2
return 1
fi
return "$manifest_status"
}
case "$action" in
deploy)
[ "$#" -eq 6 ] || { echo "deploy requires exact target, source, request, and release-authority arguments" >&2; exit 2; }
;;
restart)
[ "$#" -eq 2 ] || { echo "restart accepts only one exact target" >&2; exit 2; }
;;
*)
echo "unsupported Idunn Yggdrasil actuator action: $action" >&2
exit 2
;;
esac
acquire_idunn_generation_lock
case "$action:$target" in
restart:heimdall)
require_root_owned_regular_path "$compose"
exec docker compose -f "$compose" restart heimdall
;;
restart:repixelizer)
require_root_owned_regular_path "$compose"
exec docker compose -f "$compose" restart repixelizer
;;
restart:streampixels)
require_root_owned_regular_path "$compose"
docker compose -f "$compose" restart streampixels-service streampixels-web
;;
restart:gjallar)
exec systemctl restart gjallar-yggdrasil.service
;;
restart:voidbot|restart:epiphany|restart:odin|restart:codex-connector|restart:ghostlight)
manifest="/srv/odin/deploy-manifests/$target"
require_root_owned_regular_path "$manifest"
[ -x "$manifest" ] || { echo "root actuator manifest is not executable: $manifest" >&2; exit 1; }
export IDUNN_ACTUATOR=1
export IDUNN_COMMAND_AUTHORITY=idunn-daemon
run_manifest_while_holding_authority_locks "$manifest" restart
exit $?
;;
deploy:voidbot|deploy:epiphany|deploy:epiphany-capstone-17|deploy:odin|deploy:codex-connector|deploy:ghostlight|deploy:heimdall|deploy:repixelizer|deploy:streampixels|deploy:bifrost-persona-feedback|deploy:gjallar)
manifest="/srv/odin/deploy-manifests/$target"
require_root_owned_regular_path "$manifest"
[ -x "$manifest" ] || { echo "root actuator manifest is not executable: $manifest" >&2; exit 1; }
require_signed_deployment_grant "$@"
export IDUNN_ACTUATOR=1
export IDUNN_COMMAND_AUTHORITY=idunn-daemon
export IDUNN_SOURCE_COMMIT="$source_commit"
export IDUNN_REPOSITORY_FULL_NAME="$repository_full_name"
export IDUNN_UPSTREAM_REF="$upstream_ref"
export BIFROST_RELEASE_AUTHORITY_ID="$release_authority_id"
export BIFROST_RELEASE_AUTHORITY_SHA256="$release_authority_sha256"
export IDUNN_DEPLOYMENT_REQUEST_ID="$deployment_request_id"
export IDUNN_REQUIRES_BIFROST_AUTHORITY="$requires_bifrost_authority"
if [ "$manifest_takes_action" = true ]; then
run_manifest_while_holding_authority_locks "$manifest" "$action"
exit $?
fi
run_manifest_while_holding_authority_locks "$manifest"
exit $?
;;
*)
echo "unsupported Idunn Yggdrasil actuator request: $action $target" >&2
exit 2
;;
esac

View file

@ -1,26 +0,0 @@
[Unit]
Description=Idunn Yggdrasil-local lifecycle coordinator
After=network-online.target docker.service
Wants=network-online.target
Requires=docker.service
[Service]
Type=simple
User=idunn
Group=idunn
# Operational cancellation ceiling only. Target daemons own readiness through
# typed health; this duration must never be interpreted as deployment success.
ExecStart=/usr/local/bin/idunn --swarm-profile yggdrasil-local --repo-root /var/lib/gamecult/idunn --store /var/lib/gamecult/idunn/yggdrasil.keepalive.cc --release-authority-store /srv/bifrost/state/repository-release-authority.cc --deployment-brake-store /var/lib/gamecult/idunn-authority/deployment-brake.cc --deployment-brake-operator-anchor /etc/gamecult/idunn/deployment-brake-operator-anchor.cc --daemon-health-trust-store /etc/gamecult/idunn/daemon-health-trust.cc --rudp-health-bind 10.77.0.1:17870 --service-identity-store /var/lib/gamecult/idunn/idunn-service-identity.cc --public-health-store /var/lib/gamecult/idunn/authenticated-provider-health.cc --public-health-query-bind 127.0.0.1:17871 --command-timeout-seconds 21600 --execute
Restart=always
RestartSec=5
TimeoutStopSec=20
KillSignal=SIGINT
UMask=027
PrivateTmp=yes
ProtectHome=yes
ProtectSystem=full
ReadWritePaths=/etc/gamecult/idunn /etc/gamecult/codex-connector /etc/gamecult/ghostlight-dungeon /etc/systemd/system/codex-connector.service /etc/systemd/system/epiphany-swarm.service /etc/systemd/system/ghostlight-dungeon.service /var/lib/gamecult/idunn /srv/build /srv/voidbot
ReadOnlyPaths=/var/lib/gamecult/idunn-authority
[Install]
WantedBy=multi-user.target

View file

@ -1,24 +0,0 @@
Cmnd_Alias IDUNN_YGGDRASIL_DEPLOY = \
/usr/local/libexec/idunn-yggdrasil deploy odin *, \
/usr/local/libexec/idunn-yggdrasil deploy codex-connector *, \
/usr/local/libexec/idunn-yggdrasil deploy ghostlight *, \
/usr/local/libexec/idunn-yggdrasil deploy voidbot *, \
/usr/local/libexec/idunn-yggdrasil deploy heimdall *, \
/usr/local/libexec/idunn-yggdrasil deploy epiphany-capstone-17 *, \
/usr/local/libexec/idunn-yggdrasil deploy epiphany *, \
/usr/local/libexec/idunn-yggdrasil deploy bifrost-persona-feedback *, \
/usr/local/libexec/idunn-yggdrasil deploy repixelizer *, \
/usr/local/libexec/idunn-yggdrasil deploy streampixels *, \
/usr/local/libexec/idunn-yggdrasil deploy gjallar *
Cmnd_Alias IDUNN_YGGDRASIL_RESTART = \
/usr/local/libexec/idunn-yggdrasil restart odin, \
/usr/local/libexec/idunn-yggdrasil restart codex-connector, \
/usr/local/libexec/idunn-yggdrasil restart ghostlight, \
/usr/local/libexec/idunn-yggdrasil restart voidbot, \
/usr/local/libexec/idunn-yggdrasil restart heimdall, \
/usr/local/libexec/idunn-yggdrasil restart epiphany, \
/usr/local/libexec/idunn-yggdrasil restart repixelizer, \
/usr/local/libexec/idunn-yggdrasil restart streampixels, \
/usr/local/libexec/idunn-yggdrasil restart gjallar
idunn ALL=(root) NOPASSWD: IDUNN_YGGDRASIL_DEPLOY, IDUNN_YGGDRASIL_RESTART

View file

@ -1,2 +0,0 @@
@echo off
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0notify-idunn-operator-alarm.ps1"

View file

@ -1,25 +0,0 @@
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$projectsRoot = Split-Path -Parent $repoRoot
$bifrostRoot = Join-Path $projectsRoot "Bifrost"
$publisherScript = Join-Path $bifrostRoot "tools\operator-notification.mjs"
if (-not (Test-Path -LiteralPath $publisherScript)) {
throw "Bifrost operator-notification publisher is missing at $publisherScript."
}
Push-Location -LiteralPath $bifrostRoot
try {
$arguments = @($publisherScript, "publish-idunn-alarm")
if ($env:IDUNN_OPERATOR_ALARM_DRY_RUN -in @("1", "true", "yes", "on")) {
$arguments += "--dry-run"
}
& node @arguments
if ($LASTEXITCODE -ne 0) {
throw "Bifrost operator-notification publisher exited with code $LASTEXITCODE."
}
} finally {
Pop-Location
}

View file

@ -1,8 +0,0 @@
$ErrorActionPreference = "Stop"
. (Join-Path $PSScriptRoot "idunn-deployment-targets.ps1")
$IdunnDeploymentTargets |
Sort-Object Status, Id |
Select-Object Id, Repo, Host, Service, Status, Reason |
Format-Table -AutoSize -Wrap

View file

@ -1,179 +0,0 @@
param(
[int] $StaleAfterSeconds = 120,
[string] $StateDir = (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\idunn")
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$idunnExe = Join-Path $repoRoot "target\debug\idunn.exe"
$operatorAlarmCommand = Join-Path $repoRoot "scripts\notify-idunn-operator-alarm.cmd"
$pidPath = Join-Path $StateDir "idunn.pid"
$storePath = Join-Path $StateDir "idunn.keepalive.cc"
$outLog = Join-Path $StateDir "idunn.out.log"
$errLog = Join-Path $StateDir "idunn.err.log"
New-Item -ItemType Directory -Force -Path $StateDir | Out-Null
function Get-IdunnStartupDetail {
$detail = ""
if (Test-Path -LiteralPath $outLog) { $detail += Get-Content -Raw -LiteralPath $outLog }
if (Test-Path -LiteralPath $errLog) { $detail += Get-Content -Raw -LiteralPath $errLog }
return $detail
}
function Move-CorruptIdunnStoreAside {
param(
[string] $StorePath
)
if (-not (Test-Path -LiteralPath $StorePath)) {
return $null
}
$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
$corruptPath = Join-Path $StateDir "idunn.keepalive.corrupt-$timestamp.cc"
Move-Item -LiteralPath $StorePath -Destination $corruptPath -Force
Remove-Item -LiteralPath "$StorePath.lock" -Force -ErrorAction SilentlyContinue
Write-Host "Archived corrupt Idunn store to $corruptPath"
return $corruptPath
}
function Start-IdunnProcess {
param(
[string] $IdunnExe,
[object[]] $Arguments,
[string] $RepoRoot,
[string] $OutLog,
[string] $ErrLog,
[string] $PidPath
)
$process = Start-Process -FilePath $IdunnExe `
-ArgumentList $Arguments `
-WorkingDirectory $RepoRoot `
-WindowStyle Hidden `
-PassThru `
-RedirectStandardOutput $OutLog `
-RedirectStandardError $ErrLog
$process.Id | Set-Content -Encoding ASCII -LiteralPath $PidPath
Start-Sleep -Seconds 2
return $process
}
if (-not (Test-Path -LiteralPath $idunnExe)) {
Push-Location -LiteralPath $repoRoot
try {
& cargo build -p idunn-daemon
if ($LASTEXITCODE -ne 0) {
throw "cargo build -p idunn-daemon failed with exit code $LASTEXITCODE"
}
} finally {
Pop-Location
}
}
function Test-IdunnSupervisorHealthy {
param(
[string] $PidPath,
[string] $StorePath,
[int] $StaleAfterSeconds
)
if (-not (Test-Path -LiteralPath $PidPath)) {
return $false
}
$pidText = (Get-Content -LiteralPath $PidPath -Raw).Trim()
if ($pidText -notmatch "^\d+$") {
Remove-Item -LiteralPath $PidPath -Force -ErrorAction SilentlyContinue
return $false
}
$process = Get-Process -Id ([int] $pidText) -ErrorAction SilentlyContinue
if ($null -eq $process) {
Remove-Item -LiteralPath $PidPath -Force -ErrorAction SilentlyContinue
return $false
}
if (Test-Path -LiteralPath $StorePath) {
$storeAgeSeconds = ([DateTime]::UtcNow - (Get-Item -LiteralPath $StorePath).LastWriteTimeUtc).TotalSeconds
if ($storeAgeSeconds -le $StaleAfterSeconds) {
return $true
}
Write-Host "Idunn swarm store is stale ($([math]::Round($storeAgeSeconds))s old). Restarting supervisor."
} else {
$processAgeSeconds = ([DateTime]::UtcNow - $process.StartTime.ToUniversalTime()).TotalSeconds
if ($processAgeSeconds -le $StaleAfterSeconds) {
return $true
}
Write-Host "Idunn supervisor never wrote $StorePath within $StaleAfterSeconds seconds. Restarting supervisor."
}
Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
Remove-Item -LiteralPath $PidPath -Force -ErrorAction SilentlyContinue
return $false
}
if (Test-IdunnSupervisorHealthy -PidPath $pidPath -StorePath $storePath -StaleAfterSeconds $StaleAfterSeconds) {
Write-Host "Idunn swarm supervisor already running."
return
}
$arguments = @(
"--swarm-profile", "starfire-local",
"--repo-root", $repoRoot,
"--store", $storePath,
"--rudp-health-bind", "0.0.0.0:17870",
"--command-timeout-seconds", "600",
"--execute"
)
if (Test-Path -LiteralPath $operatorAlarmCommand) {
$arguments += @("--operator-alarm-command", $operatorAlarmCommand)
}
$process = Start-IdunnProcess `
-IdunnExe $idunnExe `
-Arguments $arguments `
-RepoRoot $repoRoot `
-OutLog $outLog `
-ErrLog $errLog `
-PidPath $pidPath
if ($process.HasExited) {
$detail = Get-IdunnStartupDetail
if ($detail -like "*failed to decode MessagePack*" -and (Test-Path -LiteralPath $storePath)) {
Move-CorruptIdunnStoreAside -StorePath $storePath | Out-Null
$process = Start-IdunnProcess `
-IdunnExe $idunnExe `
-Arguments $arguments `
-RepoRoot $repoRoot `
-OutLog $outLog `
-ErrLog $errLog `
-PidPath $pidPath
}
}
if ($process.HasExited) {
$detail = Get-IdunnStartupDetail
throw "Idunn swarm supervisor exited immediately with code $($process.ExitCode).`n$detail"
}
Write-Host "Started Idunn swarm supervisor as PID $($process.Id)."
Write-Host " store: $storePath"
function ConvertTo-WindowsArgument {
param([string] $Value)
if ($Value -notmatch '[\s"]') {
return $Value
}
return '"' + ($Value -replace '(\\*)"', '$1$1\"' -replace '(\\+)$', '$1$1') + '"'
}
function Join-WindowsArguments {
param([object[]] $Arguments)
return (($Arguments | ForEach-Object { ConvertTo-WindowsArgument -Value ([string] $_) }) -join " ")
}