mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 17:14:08 +02:00
proper healthy check for s3
This commit is contained in:
parent
1a4fd72da2
commit
8c191859b2
2 changed files with 15 additions and 3 deletions
|
|
@ -86,7 +86,7 @@ pub async fn exec_tty<S1: AsRef<str>, S2: Into<String>>(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn exec<S1: AsRef<str>, S2: Into<String>>(
|
pub async fn exec<S1: AsRef<str>, S2: Into<String>>(
|
||||||
docker: &mut Docker,
|
docker: &Docker,
|
||||||
container: S1,
|
container: S1,
|
||||||
user: &str,
|
user: &str,
|
||||||
cmd: Vec<S2>,
|
cmd: Vec<S2>,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
use crate::exec::exec;
|
||||||
use crate::image::pull_image;
|
use crate::image::pull_image;
|
||||||
use bollard::container::{Config, CreateContainerOptions, NetworkingConfig};
|
use bollard::container::{Config, CreateContainerOptions, NetworkingConfig};
|
||||||
use bollard::models::{EndpointSettings, HostConfig};
|
use bollard::models::{EndpointSettings, HostConfig};
|
||||||
|
|
@ -123,8 +124,19 @@ impl ObjectStore {
|
||||||
Ok(id)
|
Ok(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn is_healthy(&self, _docker: &Docker, _cloud_id: &str) -> Result<bool> {
|
async fn is_healthy(&self, docker: &Docker, cloud_id: &str) -> Result<bool> {
|
||||||
Ok(true)
|
let mut output = Vec::new();
|
||||||
|
exec(
|
||||||
|
docker,
|
||||||
|
format!("{}-object", cloud_id),
|
||||||
|
"root",
|
||||||
|
vec!["curl", "localhost:4569/"],
|
||||||
|
vec![],
|
||||||
|
Some(&mut output),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
let output = String::from_utf8(output)?;
|
||||||
|
Ok(output.contains("ListAllMyBucketsResult"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container_name(&self, cloud_id: &str) -> String {
|
fn container_name(&self, cloud_id: &str) -> String {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue