rebuild re-registers agent; preserve /run/hyperhive across restarts
This commit is contained in:
parent
746132d41e
commit
af464e27f4
3 changed files with 5 additions and 1 deletions
|
|
@ -26,6 +26,9 @@ impl Coordinator {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn register_agent(&self, name: &str) -> Result<PathBuf> {
|
pub async fn register_agent(&self, name: &str) -> Result<PathBuf> {
|
||||||
|
// Idempotent: drop any existing listener so re-registration (e.g. on rebuild,
|
||||||
|
// or after a hive-c0re restart cleared /run/hyperhive) gets a fresh socket.
|
||||||
|
self.unregister_agent(name);
|
||||||
let agent_dir = Self::agent_dir(name);
|
let agent_dir = Self::agent_dir(name);
|
||||||
std::fs::create_dir_all(&agent_dir)
|
std::fs::create_dir_all(&agent_dir)
|
||||||
.with_context(|| format!("create agent dir {}", agent_dir.display()))?;
|
.with_context(|| format!("create agent dir {}", agent_dir.display()))?;
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ async fn dispatch(req: &HostRequest, agent_flake: &str, coord: &Coordinator) ->
|
||||||
}
|
}
|
||||||
HostRequest::Rebuild { name } => {
|
HostRequest::Rebuild { name } => {
|
||||||
tracing::info!(%name, "rebuild");
|
tracing::info!(%name, "rebuild");
|
||||||
let agent_dir = Coordinator::agent_dir(name);
|
let agent_dir = coord.register_agent(name).await?;
|
||||||
lifecycle::rebuild(name, agent_flake, &agent_dir).await?;
|
lifecycle::rebuild(name, agent_flake, &agent_dir).await?;
|
||||||
HostResponse::success()
|
HostResponse::success()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ in
|
||||||
RestartSec = 2;
|
RestartSec = 2;
|
||||||
RuntimeDirectory = "hyperhive";
|
RuntimeDirectory = "hyperhive";
|
||||||
RuntimeDirectoryMode = "0750";
|
RuntimeDirectoryMode = "0750";
|
||||||
|
RuntimeDirectoryPreserve = "yes";
|
||||||
StateDirectory = "hyperhive";
|
StateDirectory = "hyperhive";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue