mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 17:14:08 +02:00
allow services to spawn more than one container
This commit is contained in:
parent
60e797545e
commit
e13f53e0e5
14 changed files with 34 additions and 34 deletions
|
|
@ -17,7 +17,7 @@ use petname::petname;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::{stdout, Cursor, Read, Write, Stdout};
|
use std::io::{stdout, Cursor, Read, Stdout, Write};
|
||||||
use std::iter::Peekable;
|
use std::iter::Peekable;
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
use std::os::unix::fs::MetadataExt;
|
use std::os::unix::fs::MetadataExt;
|
||||||
|
|
@ -311,7 +311,7 @@ impl Cloud {
|
||||||
env.push(format!("BLACKFIRE_CLIENT_TOKEN={}", blackfire.client_token));
|
env.push(format!("BLACKFIRE_CLIENT_TOKEN={}", blackfire.client_token));
|
||||||
}
|
}
|
||||||
|
|
||||||
let service_containers: Vec<Option<String>> = try_join_all(
|
let service_containers: Vec<Vec<String>> = try_join_all(
|
||||||
options
|
options
|
||||||
.services
|
.services
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ impl ServiceTrait for ClamIcap {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
_config: &HazeConfig,
|
_config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "ghcr.io/icewind1991/icap-clamav-service-tls";
|
let image = "ghcr.io/icewind1991/icap-clamav-service-tls";
|
||||||
pull_image(docker, image).await?;
|
pull_image(docker, image).await?;
|
||||||
let options = Some(CreateContainerOptions {
|
let options = Some(CreateContainerOptions {
|
||||||
|
|
@ -70,7 +70,7 @@ impl ServiceTrait for ClamIcap {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![id])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||||
|
|
@ -122,7 +122,7 @@ impl ServiceTrait for ClamIcapTls {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
_config: &HazeConfig,
|
_config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "ghcr.io/icewind1991/icap-clamav-service-tls";
|
let image = "ghcr.io/icewind1991/icap-clamav-service-tls";
|
||||||
pull_image(docker, image).await?;
|
pull_image(docker, image).await?;
|
||||||
let options = Some(CreateContainerOptions {
|
let options = Some(CreateContainerOptions {
|
||||||
|
|
@ -158,7 +158,7 @@ impl ServiceTrait for ClamIcapTls {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![id])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ impl ServiceTrait for Dav {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
_config: &HazeConfig,
|
_config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "ugeek/webdav:amd64";
|
let image = "ugeek/webdav:amd64";
|
||||||
pull_image(docker, image).await?;
|
pull_image(docker, image).await?;
|
||||||
let options = Some(CreateContainerOptions {
|
let options = Some(CreateContainerOptions {
|
||||||
|
|
@ -60,7 +60,7 @@ impl ServiceTrait for Dav {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![id])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ impl ServiceTrait for Imaginary {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
_config: &HazeConfig,
|
_config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "nextcloud/aio-imaginary:latest";
|
let image = "nextcloud/aio-imaginary:latest";
|
||||||
pull_image(docker, image).await?;
|
pull_image(docker, image).await?;
|
||||||
let options = Some(CreateContainerOptions {
|
let options = Some(CreateContainerOptions {
|
||||||
|
|
@ -59,7 +59,7 @@ impl ServiceTrait for Imaginary {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![id])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ impl ServiceTrait for Kaspersky {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
_config: &HazeConfig,
|
_config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "kaspersky";
|
let image = "kaspersky";
|
||||||
if !image_exists(docker, image).await {
|
if !image_exists(docker, image).await {
|
||||||
bail!("You need to manually create the 'kaspersky' image");
|
bail!("You need to manually create the 'kaspersky' image");
|
||||||
|
|
@ -68,7 +68,7 @@ impl ServiceTrait for Kaspersky {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![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> {
|
||||||
|
|
@ -130,7 +130,7 @@ impl ServiceTrait for KasperskyIcap {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
_config: &HazeConfig,
|
_config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "kaspersky-icap";
|
let image = "kaspersky-icap";
|
||||||
if !image_exists(docker, image).await {
|
if !image_exists(docker, image).await {
|
||||||
bail!("You need to manually create the 'kaspersky-icap' image");
|
bail!("You need to manually create the 'kaspersky-icap' image");
|
||||||
|
|
@ -169,7 +169,7 @@ impl ServiceTrait for KasperskyIcap {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![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> {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ impl ServiceTrait for Ldap {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
_config: &HazeConfig,
|
_config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "icewind1991/haze-ldap";
|
let image = "icewind1991/haze-ldap";
|
||||||
pull_image(docker, image).await?;
|
pull_image(docker, image).await?;
|
||||||
let options = Some(CreateContainerOptions {
|
let options = Some(CreateContainerOptions {
|
||||||
|
|
@ -65,7 +65,7 @@ impl ServiceTrait for Ldap {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![id])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||||
|
|
@ -96,7 +96,7 @@ impl ServiceTrait for LdapAdmin {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
_config: &HazeConfig,
|
_config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "osixia/phpldapadmin";
|
let image = "osixia/phpldapadmin";
|
||||||
pull_image(docker, image).await?;
|
pull_image(docker, image).await?;
|
||||||
let options = Some(CreateContainerOptions {
|
let options = Some(CreateContainerOptions {
|
||||||
|
|
@ -134,7 +134,7 @@ impl ServiceTrait for LdapAdmin {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![id])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ impl ServiceTrait for Mail {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
_config: &HazeConfig,
|
_config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "rnwood/smtp4dev";
|
let image = "rnwood/smtp4dev";
|
||||||
pull_image(docker, image).await?;
|
pull_image(docker, image).await?;
|
||||||
let options = Some(CreateContainerOptions {
|
let options = Some(CreateContainerOptions {
|
||||||
|
|
@ -59,7 +59,7 @@ impl ServiceTrait for Mail {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![id])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ impl ServiceTrait for ObjectStore {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
_config: &HazeConfig,
|
_config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
pull_image(docker, self.image()).await?;
|
pull_image(docker, self.image()).await?;
|
||||||
let options = Some(CreateContainerOptions {
|
let options = Some(CreateContainerOptions {
|
||||||
name: format!("{}-object", cloud_id),
|
name: format!("{}-object", cloud_id),
|
||||||
|
|
@ -114,7 +114,7 @@ impl ServiceTrait for ObjectStore {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![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> {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ impl ServiceTrait for Oc {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
config: &HazeConfig,
|
config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "owncloud/server:10.12.2";
|
let image = "owncloud/server:10.12.2";
|
||||||
pull_image(docker, image).await?;
|
pull_image(docker, image).await?;
|
||||||
let options = Some(CreateContainerOptions {
|
let options = Some(CreateContainerOptions {
|
||||||
|
|
@ -71,7 +71,7 @@ impl ServiceTrait for Oc {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![id])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ impl ServiceTrait for Office {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
config: &HazeConfig,
|
config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "collabora/code";
|
let image = "collabora/code";
|
||||||
pull_image(docker, image).await?;
|
pull_image(docker, image).await?;
|
||||||
let container_id = self.container_name(cloud_id).unwrap();
|
let container_id = self.container_name(cloud_id).unwrap();
|
||||||
|
|
@ -82,7 +82,7 @@ impl ServiceTrait for Office {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![id])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ impl ServiceTrait for OnlyOffice {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
_config: &HazeConfig,
|
_config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "onlyoffice/documentserver";
|
let image = "onlyoffice/documentserver";
|
||||||
pull_image(docker, image).await?;
|
pull_image(docker, image).await?;
|
||||||
let options = Some(CreateContainerOptions {
|
let options = Some(CreateContainerOptions {
|
||||||
|
|
@ -63,7 +63,7 @@ impl ServiceTrait for OnlyOffice {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![id])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ impl ServiceTrait for NotifyPush {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
config: &HazeConfig,
|
config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "icewind1991/notify_push";
|
let image = "icewind1991/notify_push";
|
||||||
pull_image(docker, image).await?;
|
pull_image(docker, image).await?;
|
||||||
let options = Some(CreateContainerOptions {
|
let options = Some(CreateContainerOptions {
|
||||||
|
|
@ -68,7 +68,7 @@ impl ServiceTrait for NotifyPush {
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?
|
.into_diagnostic()?
|
||||||
.id;
|
.id;
|
||||||
Ok(Some(id))
|
Ok(vec![id])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ impl ServiceTrait for Sftp {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
_config: &HazeConfig,
|
_config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "atmoz/sftp:alpine";
|
let image = "atmoz/sftp:alpine";
|
||||||
pull_image(docker, image).await?;
|
pull_image(docker, image).await?;
|
||||||
let options = Some(CreateContainerOptions {
|
let options = Some(CreateContainerOptions {
|
||||||
|
|
@ -60,7 +60,7 @@ impl ServiceTrait for Sftp {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![id])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ impl ServiceTrait for Smb {
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
network: &str,
|
network: &str,
|
||||||
_config: &HazeConfig,
|
_config: &HazeConfig,
|
||||||
) -> Result<Option<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let image = "ghcr.io/servercontainers/samba:smbd-only-a3.18.0-s4.18.2-r0";
|
let image = "ghcr.io/servercontainers/samba:smbd-only-a3.18.0-s4.18.2-r0";
|
||||||
pull_image(docker, image).await?;
|
pull_image(docker, image).await?;
|
||||||
let options = Some(CreateContainerOptions {
|
let options = Some(CreateContainerOptions {
|
||||||
|
|
@ -64,7 +64,7 @@ impl ServiceTrait for Smb {
|
||||||
.start_container::<String>(&id, None)
|
.start_container::<String>(&id, None)
|
||||||
.await
|
.await
|
||||||
.into_diagnostic()?;
|
.into_diagnostic()?;
|
||||||
Ok(Some(id))
|
Ok(vec![id])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
fn container_name(&self, cloud_id: &str) -> Option<String> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue