feat: add rsync as managed resource — registered in DB + pipeline health check
This commit is contained in:
@@ -480,6 +480,8 @@ struct PipelineStatus {
|
||||
gdino_api: ServiceStatus,
|
||||
/// LLM via llama.cpp (port 8082)
|
||||
llm: ServiceStatus,
|
||||
/// rsync file sync tool
|
||||
rsync: ServiceStatus,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
@@ -589,6 +591,7 @@ async fn health_detailed(State(state): State<AppState>) -> Json<DetailedHealthRe
|
||||
embedding_server: check_http("http://127.0.0.1:11436/health").await,
|
||||
gdino_api: check_http("http://127.0.0.1:8080/health").await,
|
||||
llm: check_http("http://127.0.0.1:8082/health").await,
|
||||
rsync: check_binary("rsync").await,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -723,6 +726,22 @@ async fn check_mongodb(cache: &MongoCache) -> ServiceStatus {
|
||||
}
|
||||
}
|
||||
|
||||
async fn check_binary(name: &str) -> ServiceStatus {
|
||||
let start = Instant::now();
|
||||
match std::process::Command::new("which").arg(name).output() {
|
||||
Ok(output) if output.status.success() => ServiceStatus {
|
||||
status: "ok".to_string(),
|
||||
latency_ms: Some(start.elapsed().as_millis() as u64),
|
||||
error: None,
|
||||
},
|
||||
_ => ServiceStatus {
|
||||
status: "error".to_string(),
|
||||
latency_ms: Some(start.elapsed().as_millis() as u64),
|
||||
error: Some(format!("{} not found in PATH", name)),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
async fn check_http(url: &str) -> ServiceStatus {
|
||||
let start = Instant::now();
|
||||
match reqwest::get(url).await {
|
||||
|
||||
Reference in New Issue
Block a user