Watch
0
0
Fork
You've already forked hyperhive
0

swarm daemons: opt-in /healthz and /readyz listener, and /readyz on the controller

This commit is contained in:
atlas 2026-11-18 13:52:36 +01:00 • committed by mara
commit c21b158884

View file

@ -55,6 +55,10 @@ struct Args {
/// Unix socket to serve on.
#[arg(long)]
socket: PathBuf,
/// Address to serve `/healthz` and `/readyz` on. Nothing listens unless set;
/// the environment variable `SWARM_LOGS_AUTH_HEALTH_ADDR` is read when the flag is absent.
#[arg(long)]
health_addr: Option<std::net::SocketAddr>,
/// Cert-auth role this responder logs in to the store as.
#[arg(long, default_value = "swarm-logs-auth")]
store_cert_role: String,
@ -206,6 +210,15 @@ async fn main() -> anyhow::Result<()> {
.with_ansi(false)
.init();
let args = Args::parse();
let health = swarm_secret_client::health::Health::start(
swarm_secret_client::health::STALE_AFTER,
args.health_addr,
"SWARM_LOGS_AUTH_HEALTH_ADDR",
stop.clone(),
)
.await
.context("starting the health listener")?;
health.beat_on_runtime();
let settings = swarm_secret_client::client::Settings::from_env()
.context("reading the secret store's address and this responder's identity")?;
@ -234,6 +247,7 @@ async fn main() -> anyhow::Result<()> {
std::fs::set_permissions(&args.socket, std::fs::Permissions::from_mode(0o666))
.with_context(|| format!("chmod {}", args.socket.display()))?;
tracing::info!(socket = %args.socket.display(), "swarm-logs-auth listening");
health.ready_when(|| true);
let app = axum::Router::new().fallback(handle).with_state(responder);
serve(listener, app, stop).await