mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-04 01:24:09 +02:00
presets wip
This commit is contained in:
parent
029ff53aad
commit
fdcb8de4f2
17 changed files with 192 additions and 120 deletions
|
|
@ -32,11 +32,11 @@ impl ServiceTrait for ClamIcap {
|
|||
cloud_id: &str,
|
||||
network: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<String> {
|
||||
) -> Result<Option<String>> {
|
||||
let image = "deepdiver/icap-clamav-service";
|
||||
pull_image(docker, image).await?;
|
||||
let options = Some(CreateContainerOptions {
|
||||
name: self.container_name(cloud_id),
|
||||
name: self.container_name(cloud_id).unwrap(),
|
||||
..CreateContainerOptions::default()
|
||||
});
|
||||
let config = Config {
|
||||
|
|
@ -68,11 +68,11 @@ impl ServiceTrait for ClamIcap {
|
|||
.start_container::<String>(&id, None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
Ok(id)
|
||||
Ok(Some(id))
|
||||
}
|
||||
|
||||
fn container_name(&self, cloud_id: &str) -> String {
|
||||
format!("{}-clamav-icap", cloud_id)
|
||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||
Some(format!("{}-clamav-icap", cloud_id))
|
||||
}
|
||||
|
||||
fn apps(&self) -> &'static [&'static str] {
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ impl ServiceTrait for Dav {
|
|||
cloud_id: &str,
|
||||
network: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<String> {
|
||||
) -> Result<Option<String>> {
|
||||
let image = "ugeek/webdav:amd64";
|
||||
pull_image(docker, image).await?;
|
||||
let options = Some(CreateContainerOptions {
|
||||
name: self.container_name(cloud_id),
|
||||
name: self.container_name(cloud_id).unwrap(),
|
||||
..CreateContainerOptions::default()
|
||||
});
|
||||
let config = Config {
|
||||
|
|
@ -60,11 +60,11 @@ impl ServiceTrait for Dav {
|
|||
.start_container::<String>(&id, None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
Ok(id)
|
||||
Ok(Some(id))
|
||||
}
|
||||
|
||||
fn container_name(&self, cloud_id: &str) -> String {
|
||||
format!("{}-dav", cloud_id)
|
||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||
Some(format!("{}-dav", cloud_id))
|
||||
}
|
||||
|
||||
fn apps(&self) -> &'static [&'static str] {
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ impl ServiceTrait for Kaspersky {
|
|||
cloud_id: &str,
|
||||
network: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<String> {
|
||||
) -> Result<Option<String>> {
|
||||
let image = "kaspersky";
|
||||
if !image_exists(docker, image).await {
|
||||
bail!("You need to manually create the 'kaspersky' image");
|
||||
}
|
||||
pull_image(docker, image).await?;
|
||||
let options = Some(CreateContainerOptions {
|
||||
name: self.container_name(cloud_id),
|
||||
name: self.container_name(cloud_id).unwrap(),
|
||||
..CreateContainerOptions::default()
|
||||
});
|
||||
let config = Config {
|
||||
|
|
@ -68,13 +68,13 @@ impl ServiceTrait for Kaspersky {
|
|||
.start_container::<String>(&id, None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
Ok(id)
|
||||
Ok(Some(id))
|
||||
}
|
||||
|
||||
async fn is_healthy(&self, docker: &Docker, cloud_id: &str) -> Result<bool> {
|
||||
let exit = exec(
|
||||
docker,
|
||||
self.container_name(cloud_id),
|
||||
self.container_name(cloud_id).unwrap(),
|
||||
"root",
|
||||
vec!["curl", "localhost/licenseinfo"],
|
||||
Vec::<String>::default(),
|
||||
|
|
@ -84,8 +84,8 @@ impl ServiceTrait for Kaspersky {
|
|||
Ok(exit.to_result().is_ok())
|
||||
}
|
||||
|
||||
fn container_name(&self, cloud_id: &str) -> String {
|
||||
format!("{}-kaspersky", cloud_id)
|
||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||
Some(format!("{}-kaspersky", cloud_id))
|
||||
}
|
||||
|
||||
fn apps(&self) -> &'static [&'static str] {
|
||||
|
|
@ -130,14 +130,14 @@ impl ServiceTrait for KasperskyIcap {
|
|||
cloud_id: &str,
|
||||
network: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<String> {
|
||||
) -> Result<Option<String>> {
|
||||
let image = "kaspersky-icap";
|
||||
if !image_exists(docker, image).await {
|
||||
bail!("You need to manually create the 'kaspersky-icap' image");
|
||||
}
|
||||
pull_image(docker, image).await?;
|
||||
let options = Some(CreateContainerOptions {
|
||||
name: self.container_name(cloud_id),
|
||||
name: self.container_name(cloud_id).unwrap(),
|
||||
..CreateContainerOptions::default()
|
||||
});
|
||||
let config = Config {
|
||||
|
|
@ -169,7 +169,7 @@ impl ServiceTrait for KasperskyIcap {
|
|||
.start_container::<String>(&id, None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
Ok(id)
|
||||
Ok(Some(id))
|
||||
}
|
||||
|
||||
// async fn is_healthy(&self, docker: &Docker, cloud_id: &str) -> Result<bool> {
|
||||
|
|
@ -185,8 +185,8 @@ impl ServiceTrait for KasperskyIcap {
|
|||
// Ok(exit.to_result().is_ok())
|
||||
// }
|
||||
|
||||
fn container_name(&self, cloud_id: &str) -> String {
|
||||
format!("{}-kaspersky-icap", cloud_id)
|
||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||
Some(format!("{}-kaspersky-icap", cloud_id))
|
||||
}
|
||||
|
||||
fn apps(&self) -> &'static [&'static str] {
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ impl ServiceTrait for Ldap {
|
|||
cloud_id: &str,
|
||||
network: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<String> {
|
||||
) -> Result<Option<String>> {
|
||||
let image = "icewind1991/haze-ldap";
|
||||
pull_image(docker, image).await?;
|
||||
let options = Some(CreateContainerOptions {
|
||||
name: self.container_name(cloud_id),
|
||||
name: self.container_name(cloud_id).unwrap(),
|
||||
..CreateContainerOptions::default()
|
||||
});
|
||||
let config = Config {
|
||||
|
|
@ -65,11 +65,11 @@ impl ServiceTrait for Ldap {
|
|||
.start_container::<String>(&id, None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
Ok(id)
|
||||
Ok(Some(id))
|
||||
}
|
||||
|
||||
fn container_name(&self, cloud_id: &str) -> String {
|
||||
format!("{}-ldap", cloud_id)
|
||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||
Some(format!("{}-ldap", cloud_id))
|
||||
}
|
||||
|
||||
fn apps(&self) -> &'static [&'static str] {
|
||||
|
|
@ -96,11 +96,11 @@ impl ServiceTrait for LdapAdmin {
|
|||
cloud_id: &str,
|
||||
network: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<String> {
|
||||
) -> Result<Option<String>> {
|
||||
let image = "osixia/phpldapadmin";
|
||||
pull_image(docker, image).await?;
|
||||
let options = Some(CreateContainerOptions {
|
||||
name: self.container_name(cloud_id),
|
||||
name: self.container_name(cloud_id).unwrap(),
|
||||
..CreateContainerOptions::default()
|
||||
});
|
||||
let config = Config {
|
||||
|
|
@ -134,16 +134,16 @@ impl ServiceTrait for LdapAdmin {
|
|||
.start_container::<String>(&id, None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
Ok(id)
|
||||
Ok(Some(id))
|
||||
}
|
||||
|
||||
fn container_name(&self, cloud_id: &str) -> String {
|
||||
format!("{}-ldap-admin", cloud_id)
|
||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||
Some(format!("{}-ldap-admin", cloud_id))
|
||||
}
|
||||
|
||||
async fn start_message(&self, docker: &Docker, cloud_id: &str) -> Result<Option<String>> {
|
||||
let info = docker
|
||||
.inspect_container(&self.container_name(cloud_id), None)
|
||||
.inspect_container(&self.container_name(cloud_id).unwrap(), None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
let ip = if matches!(
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ impl ServiceTrait for ObjectStore {
|
|||
cloud_id: &str,
|
||||
network: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<String> {
|
||||
) -> Result<Option<String>> {
|
||||
pull_image(docker, self.image()).await?;
|
||||
let options = Some(CreateContainerOptions {
|
||||
name: format!("{}-object", cloud_id),
|
||||
|
|
@ -114,7 +114,7 @@ impl ServiceTrait for ObjectStore {
|
|||
.start_container::<String>(&id, None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
Ok(id)
|
||||
Ok(Some(id))
|
||||
}
|
||||
|
||||
async fn is_healthy(&self, docker: &Docker, cloud_id: &str) -> Result<bool> {
|
||||
|
|
@ -134,7 +134,7 @@ impl ServiceTrait for ObjectStore {
|
|||
}
|
||||
_ => {
|
||||
let info = docker
|
||||
.inspect_container(&self.container_name(cloud_id), None)
|
||||
.inspect_container(&self.container_name(cloud_id).unwrap(), None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
Ok(matches!(
|
||||
|
|
@ -148,8 +148,8 @@ impl ServiceTrait for ObjectStore {
|
|||
}
|
||||
}
|
||||
|
||||
fn container_name(&self, cloud_id: &str) -> String {
|
||||
format!("{}-object", cloud_id)
|
||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||
Some(format!("{}-object", cloud_id))
|
||||
}
|
||||
|
||||
fn apps(&self) -> &'static [&'static str] {
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ impl ServiceTrait for Office {
|
|||
cloud_id: &str,
|
||||
network: &str,
|
||||
config: &HazeConfig,
|
||||
) -> Result<String> {
|
||||
) -> Result<Option<String>> {
|
||||
let image = "collabora/code";
|
||||
pull_image(docker, image).await?;
|
||||
let container_id = self.container_name(cloud_id);
|
||||
let container_id = self.container_name(cloud_id).unwrap();
|
||||
let options = Some(CreateContainerOptions {
|
||||
name: container_id.clone(),
|
||||
..CreateContainerOptions::default()
|
||||
|
|
@ -82,11 +82,11 @@ impl ServiceTrait for Office {
|
|||
.start_container::<String>(&id, None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
Ok(id)
|
||||
Ok(Some(id))
|
||||
}
|
||||
|
||||
fn container_name(&self, cloud_id: &str) -> String {
|
||||
format!("{}-office", cloud_id)
|
||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||
Some(format!("{}-office", cloud_id))
|
||||
}
|
||||
|
||||
fn apps(&self) -> &'static [&'static str] {
|
||||
|
|
@ -99,7 +99,7 @@ impl ServiceTrait for Office {
|
|||
cloud_id: &str,
|
||||
config: &HazeConfig,
|
||||
) -> Result<Vec<String>> {
|
||||
let container = &self.container_name(cloud_id);
|
||||
let container = &self.container_name(cloud_id).unwrap();
|
||||
let info = docker
|
||||
.inspect_container(container, None)
|
||||
.await
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ impl ServiceTrait for OnlyOffice {
|
|||
cloud_id: &str,
|
||||
network: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<String> {
|
||||
) -> Result<Option<String>> {
|
||||
let image = "onlyoffice/documentserver";
|
||||
pull_image(docker, image).await?;
|
||||
let options = Some(CreateContainerOptions {
|
||||
name: self.container_name(cloud_id),
|
||||
name: self.container_name(cloud_id).unwrap(),
|
||||
..CreateContainerOptions::default()
|
||||
});
|
||||
let config = Config {
|
||||
|
|
@ -63,11 +63,11 @@ impl ServiceTrait for OnlyOffice {
|
|||
.start_container::<String>(&id, None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
Ok(id)
|
||||
Ok(Some(id))
|
||||
}
|
||||
|
||||
fn container_name(&self, cloud_id: &str) -> String {
|
||||
format!("{}-onlyoffice", cloud_id)
|
||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||
Some(format!("{}-onlyoffice", cloud_id))
|
||||
}
|
||||
|
||||
fn apps(&self) -> &'static [&'static str] {
|
||||
|
|
@ -81,7 +81,7 @@ impl ServiceTrait for OnlyOffice {
|
|||
_config: &HazeConfig,
|
||||
) -> Result<Vec<String>> {
|
||||
let info = docker
|
||||
.inspect_container(&self.container_name(cloud_id), None)
|
||||
.inspect_container(&self.container_name(cloud_id).unwrap(), None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
let ip = if matches!(
|
||||
|
|
|
|||
|
|
@ -26,11 +26,11 @@ impl ServiceTrait for NotifyPush {
|
|||
cloud_id: &str,
|
||||
network: &str,
|
||||
config: &HazeConfig,
|
||||
) -> Result<String> {
|
||||
) -> Result<Option<String>> {
|
||||
let image = "icewind1991/notify_push";
|
||||
pull_image(docker, image).await?;
|
||||
let options = Some(CreateContainerOptions {
|
||||
name: self.container_name(cloud_id),
|
||||
name: self.container_name(cloud_id).unwrap(),
|
||||
..CreateContainerOptions::default()
|
||||
});
|
||||
let config = Config {
|
||||
|
|
@ -68,11 +68,11 @@ impl ServiceTrait for NotifyPush {
|
|||
.await
|
||||
.into_diagnostic()?
|
||||
.id;
|
||||
Ok(id)
|
||||
Ok(Some(id))
|
||||
}
|
||||
|
||||
fn container_name(&self, cloud_id: &str) -> String {
|
||||
format!("{}-push", cloud_id)
|
||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||
Some(format!("{}-push", cloud_id))
|
||||
}
|
||||
|
||||
fn apps(&self) -> &'static [&'static str] {
|
||||
|
|
@ -89,10 +89,10 @@ impl ServiceTrait for NotifyPush {
|
|||
cloud_id: &str,
|
||||
config: &HazeConfig,
|
||||
) -> Result<Vec<String>> {
|
||||
let ip = self.get_ip(docker, cloud_id).await?;
|
||||
let ip = self.get_ip(docker, cloud_id).await?.unwrap();
|
||||
let addr = config
|
||||
.proxy
|
||||
.addr_with_port(&self.container_name(cloud_id), ip, 7867);
|
||||
.addr_with_port(&self.container_name(cloud_id).unwrap(), ip, 7867);
|
||||
Ok(vec![
|
||||
format!("occ config:system:set trusted_proxies 1 --value {}", ip),
|
||||
format!("occ notify_push:setup {}", addr),
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ impl ServiceTrait for Sftp {
|
|||
cloud_id: &str,
|
||||
network: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<String> {
|
||||
) -> Result<Option<String>> {
|
||||
let image = "atmoz/sftp:alpine";
|
||||
pull_image(docker, image).await?;
|
||||
let options = Some(CreateContainerOptions {
|
||||
name: self.container_name(cloud_id),
|
||||
name: self.container_name(cloud_id).unwrap(),
|
||||
..CreateContainerOptions::default()
|
||||
});
|
||||
let config = Config {
|
||||
|
|
@ -60,11 +60,11 @@ impl ServiceTrait for Sftp {
|
|||
.start_container::<String>(&id, None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
Ok(id)
|
||||
Ok(Some(id))
|
||||
}
|
||||
|
||||
fn container_name(&self, cloud_id: &str) -> String {
|
||||
format!("{}-sftp", cloud_id)
|
||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||
Some(format!("{}-sftp", cloud_id))
|
||||
}
|
||||
|
||||
fn apps(&self) -> &'static [&'static str] {
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ impl ServiceTrait for Smb {
|
|||
cloud_id: &str,
|
||||
network: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<String> {
|
||||
) -> Result<Option<String>> {
|
||||
let image = "servercontainers/samba";
|
||||
pull_image(docker, image).await?;
|
||||
let options = Some(CreateContainerOptions {
|
||||
name: self.container_name(cloud_id),
|
||||
name: self.container_name(cloud_id).unwrap(),
|
||||
..CreateContainerOptions::default()
|
||||
});
|
||||
let config = Config {
|
||||
|
|
@ -64,11 +64,11 @@ impl ServiceTrait for Smb {
|
|||
.start_container::<String>(&id, None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
Ok(id)
|
||||
Ok(Some(id))
|
||||
}
|
||||
|
||||
fn container_name(&self, cloud_id: &str) -> String {
|
||||
format!("{}-smb", cloud_id)
|
||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||
Some(format!("{}-smb", cloud_id))
|
||||
}
|
||||
|
||||
fn apps(&self) -> &'static [&'static str] {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue