feat: add data download list to ComponentConfig and implement file downloading
- Added `data_download_list` field to `ComponentConfig` struct in `component.rs`. - Implemented processing of `data_download_list` in the `PackageManager` to download files asynchronously in `facade.rs`. - Updated `installer.rs` to initialize `data_download_list` for various components. - Refactored `download_file` function in `utils.rs` to return `anyhow::Error` for better error handling.
This commit is contained in:
parent
6ad29634ea
commit
8bcaadd970
5 changed files with 416 additions and 359 deletions
|
|
@ -235,7 +235,7 @@ impl AppConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_env() -> Self {
|
pub fn from_env() -> Self {
|
||||||
warn!("Loading configuration from environment variables");
|
info!("Loading configuration from environment variables");
|
||||||
|
|
||||||
let stack_path =
|
let stack_path =
|
||||||
std::env::var("STACK_PATH").unwrap_or_else(|_| "./botserver-stack".to_string());
|
std::env::var("STACK_PATH").unwrap_or_else(|_| "./botserver-stack".to_string());
|
||||||
|
|
|
||||||
|
|
@ -18,5 +18,6 @@ pub struct ComponentConfig {
|
||||||
pub pre_install_cmds_windows: Vec<String>,
|
pub pre_install_cmds_windows: Vec<String>,
|
||||||
pub post_install_cmds_windows: Vec<String>,
|
pub post_install_cmds_windows: Vec<String>,
|
||||||
pub env_vars: HashMap<String, String>,
|
pub env_vars: HashMap<String, String>,
|
||||||
|
pub data_download_list: Vec<String>,
|
||||||
pub exec_cmd: String,
|
pub exec_cmd: String,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,15 @@ impl PackageManager {
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Process additional data downloads with progress bar
|
||||||
|
if !component.data_download_list.is_empty() {
|
||||||
|
for url in &component.data_download_list {
|
||||||
|
let filename = url.split('/').last().unwrap_or("download.tmp");
|
||||||
|
let output_path = self.base_path.join("data").join(&component.name).join(filename);
|
||||||
|
utils::download_file(url, output_path.to_str().unwrap()).await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.run_commands(post_cmds, "local", &component.name)?;
|
self.run_commands(post_cmds, "local", &component.name)?;
|
||||||
trace!(
|
trace!(
|
||||||
"Component '{}' installation completed successfully",
|
"Component '{}' installation completed successfully",
|
||||||
|
|
|
||||||
|
|
@ -61,53 +61,55 @@ impl PackageManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_drive(&mut self) {
|
fn register_drive(&mut self) {
|
||||||
// Generate a random password for the drive user
|
|
||||||
let drive_password = self.generate_secure_password(16);
|
let drive_password = self.generate_secure_password(16);
|
||||||
let drive_user = "gbdriveuser".to_string();
|
let drive_user = "gbdriveuser".to_string();
|
||||||
// FARM_PASSWORD may already exist; otherwise generate a new one
|
let farm_password = std::env::var("FARM_PASSWORD")
|
||||||
let farm_password =
|
.unwrap_or_else(|_| self.generate_secure_password(32));
|
||||||
std::env::var("FARM_PASSWORD").unwrap_or_else(|_| self.generate_secure_password(32));
|
|
||||||
// Encrypt the drive password for optional storage in the DB
|
|
||||||
let encrypted_drive_password = self.encrypt_password(&drive_password, &farm_password);
|
let encrypted_drive_password = self.encrypt_password(&drive_password, &farm_password);
|
||||||
|
|
||||||
// Write credentials to a .env file at the base path
|
|
||||||
let env_path = self.base_path.join(".env");
|
let env_path = self.base_path.join(".env");
|
||||||
let env_content = format!(
|
let env_content = format!(
|
||||||
"DRIVE_USER={}\nDRIVE_PASSWORD={}\nFARM_PASSWORD={}\nDRIVE_ROOT_USER={}\nDRIVE_ROOT_PASSWORD={}\n",
|
"DRIVE_USER={}\nDRIVE_PASSWORD={}\nFARM_PASSWORD={}\nDRIVE_ROOT_USER={}\nDRIVE_ROOT_PASSWORD={}\n",
|
||||||
drive_user, drive_password, farm_password, drive_user, drive_password
|
drive_user, drive_password, farm_password, drive_user, drive_password
|
||||||
);
|
);
|
||||||
let _ = std::fs::write(&env_path, env_content);
|
let _ = std::fs::write(&env_path, env_content);
|
||||||
|
|
||||||
self.components.insert("drive".to_string(), ComponentConfig {
|
self.components.insert(
|
||||||
name: "drive".to_string(),
|
"drive".to_string(),
|
||||||
required: true,
|
ComponentConfig {
|
||||||
ports: vec![9000, 9001],
|
name: "drive".to_string(),
|
||||||
dependencies: vec![],
|
required: true,
|
||||||
linux_packages: vec![],
|
ports: vec![9000, 9001],
|
||||||
macos_packages: vec![],
|
dependencies: vec![],
|
||||||
windows_packages: vec![],
|
linux_packages: vec![],
|
||||||
download_url: Some("https://dl.min.io/server/minio/release/linux-amd64/minio".to_string()),
|
macos_packages: vec![],
|
||||||
binary_name: Some("minio".to_string()),
|
windows_packages: vec![],
|
||||||
pre_install_cmds_linux: vec![],
|
download_url: Some(
|
||||||
post_install_cmds_linux: vec![
|
"https://dl.min.io/server/minio/release/linux-amd64/minio".to_string(),
|
||||||
"wget https://dl.min.io/client/mc/release/linux-amd64/mc -O {{BIN_PATH}}/mc".to_string(),
|
),
|
||||||
"chmod +x {{BIN_PATH}}/mc".to_string(),
|
binary_name: Some("minio".to_string()),
|
||||||
],
|
pre_install_cmds_linux: vec![],
|
||||||
pre_install_cmds_macos: vec![],
|
post_install_cmds_linux: vec![
|
||||||
post_install_cmds_macos: vec![
|
"wget https://dl.min.io/client/mc/release/linux-amd64/mc -O {{BIN_PATH}}/mc"
|
||||||
"wget https://dl.min.io/client/mc/release/darwin-amd64/mc -O {{BIN_PATH}}/mc".to_string(),
|
.to_string(),
|
||||||
"chmod +x {{BIN_PATH}}/mc".to_string()
|
"chmod +x {{BIN_PATH}}/mc".to_string(),
|
||||||
],
|
],
|
||||||
pre_install_cmds_windows: vec![],
|
pre_install_cmds_macos: vec![],
|
||||||
post_install_cmds_windows: vec![],
|
post_install_cmds_macos: vec![
|
||||||
// No env vars here; credentials are read from .env at runtime
|
"wget https://dl.min.io/client/mc/release/darwin-amd64/mc -O {{BIN_PATH}}/mc"
|
||||||
// Provide drive root credentials via environment variables
|
.to_string(),
|
||||||
env_vars: HashMap::from([
|
"chmod +x {{BIN_PATH}}/mc".to_string(),
|
||||||
("DRIVE_ROOT_USER".to_string(), drive_user.clone()),
|
],
|
||||||
("DRIVE_ROOT_PASSWORD".to_string(), drive_password.clone())
|
pre_install_cmds_windows: vec![],
|
||||||
]),
|
post_install_cmds_windows: vec![],
|
||||||
exec_cmd: "nohup {{BIN_PATH}}/minio server {{DATA_PATH}} --address :9000 --console-address :9001 > {{LOGS_PATH}}/minio.log 2>&1 & sleep 5 && {{BIN_PATH}}/mc alias set drive http://localhost:9000 $DRIVE_ROOT_USER $DRIVE_ROOT_PASSWORD && {{BIN_PATH}}/mc mb drive/default.gbai || true".to_string(),
|
env_vars: HashMap::from([
|
||||||
});
|
("DRIVE_ROOT_USER".to_string(), drive_user.clone()),
|
||||||
|
("DRIVE_ROOT_PASSWORD".to_string(), drive_password.clone()),
|
||||||
|
]),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
|
exec_cmd: "nohup {{BIN_PATH}}/minio server {{DATA_PATH}} --address :9000 --console-address :9001 > {{LOGS_PATH}}/minio.log 2>&1 & sleep 5 && {{BIN_PATH}}/mc alias set drive http://localhost:9000 $DRIVE_ROOT_USER $DRIVE_ROOT_PASSWORD && {{BIN_PATH}}/mc mb drive/default.gbai || true".to_string(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
self.update_drive_credentials_in_database(&encrypted_drive_password)
|
self.update_drive_credentials_in_database(&encrypted_drive_password)
|
||||||
.ok();
|
.ok();
|
||||||
|
|
@ -140,318 +142,368 @@ env_vars: HashMap::from([
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|url| {
|
.and_then(|url| {
|
||||||
if let Some(stripped) = url.strip_prefix("postgres://gbuser:") {
|
if let Some(stripped) = url.strip_prefix("postgres://gbuser:") {
|
||||||
if let Some(at_pos) = stripped.find('@') {
|
stripped.split('@').next().map(|s| s.to_string())
|
||||||
Some(stripped[..at_pos].to_string())
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| self.generate_secure_password(16));
|
.unwrap_or_else(|| self.generate_secure_password(16));
|
||||||
|
|
||||||
self.components.insert("tables".to_string(), ComponentConfig {
|
self.components.insert(
|
||||||
name: "tables".to_string(),
|
"tables".to_string(),
|
||||||
required: true,
|
ComponentConfig {
|
||||||
ports: vec![5432],
|
name: "tables".to_string(),
|
||||||
dependencies: vec![],
|
required: true,
|
||||||
linux_packages: vec![],
|
ports: vec![5432],
|
||||||
macos_packages: vec![],
|
dependencies: vec![],
|
||||||
windows_packages: vec![],
|
linux_packages: vec![],
|
||||||
download_url: Some("https://github.com/theseus-rs/postgresql-binaries/releases/download/18.0.0/postgresql-18.0.0-x86_64-unknown-linux-gnu.tar.gz".to_string()),
|
macos_packages: vec![],
|
||||||
binary_name: Some("postgres".to_string()),
|
windows_packages: vec![],
|
||||||
pre_install_cmds_linux: vec![],
|
download_url: Some(
|
||||||
post_install_cmds_linux: vec![
|
"https://github.com/theseus-rs/postgresql-binaries/releases/download/18.0.0/postgresql-18.0.0-x86_64-unknown-linux-gnu.tar.gz".to_string(),
|
||||||
"chmod +x ./bin/*".to_string(),
|
),
|
||||||
|
binary_name: Some("postgres".to_string()),
|
||||||
format!("if [ ! -d \"{{{{DATA_PATH}}}}/pgdata\" ]; then PG_PASSWORD={} ./bin/initdb -D {{{{DATA_PATH}}}}/pgdata -U gbuser --pwfile=<(echo $PG_PASSWORD); fi", db_password).to_string(),
|
pre_install_cmds_linux: vec![],
|
||||||
"echo \"data_directory = '{{DATA_PATH}}/pgdata'\" > {{CONF_PATH}}/postgresql.conf".to_string(),
|
post_install_cmds_linux: vec![
|
||||||
"echo \"ident_file = '{{CONF_PATH}}/pg_ident.conf'\" >> {{CONF_PATH}}/postgresql.conf".to_string(),
|
"chmod +x ./bin/*".to_string(),
|
||||||
"echo \"port = 5432\" >> {{CONF_PATH}}/postgresql.conf".to_string(),
|
format!("if [ ! -d \"{{{{DATA_PATH}}}}/pgdata\" ]; then PG_PASSWORD={} ./bin/initdb -D {{{{DATA_PATH}}}}/pgdata -U gbuser --pwfile=<(echo $PG_PASSWORD); fi", db_password),
|
||||||
"echo \"listen_addresses = '*'\" >> {{CONF_PATH}}/postgresql.conf".to_string(),
|
"echo \"data_directory = '{{DATA_PATH}}/pgdata'\" > {{CONF_PATH}}/postgresql.conf".to_string(),
|
||||||
"echo \"log_directory = '{{LOGS_PATH}}'\" >> {{CONF_PATH}}/postgresql.conf".to_string(),
|
"echo \"ident_file = '{{CONF_PATH}}/pg_ident.conf'\" >> {{CONF_PATH}}/postgresql.conf".to_string(),
|
||||||
"echo \"logging_collector = on\" >> {{CONF_PATH}}/postgresql.conf".to_string(),
|
"echo \"port = 5432\" >> {{CONF_PATH}}/postgresql.conf".to_string(),
|
||||||
"echo \"host all all all md5\" > {{CONF_PATH}}/pg_hba.conf".to_string(),
|
"echo \"listen_addresses = '*'\" >> {{CONF_PATH}}/postgresql.conf".to_string(),
|
||||||
"touch {{CONF_PATH}}/pg_ident.conf".to_string(),
|
"echo \"log_directory = '{{LOGS_PATH}}'\" >> {{CONF_PATH}}/postgresql.conf".to_string(),
|
||||||
|
"echo \"logging_collector = on\" >> {{CONF_PATH}}/postgresql.conf".to_string(),
|
||||||
// Start PostgreSQL with wait flag
|
"echo \"host all all all md5\" > {{CONF_PATH}}/pg_hba.conf".to_string(),
|
||||||
"./bin/pg_ctl -D {{DATA_PATH}}/pgdata -l {{LOGS_PATH}}/postgres.log start -w -t 30".to_string(),
|
"touch {{CONF_PATH}}/pg_ident.conf".to_string(),
|
||||||
|
"./bin/pg_ctl -D {{DATA_PATH}}/pgdata -l {{LOGS_PATH}}/postgres.log start -w -t 30".to_string(),
|
||||||
// Wait for PostgreSQL to be fully ready
|
"sleep 5".to_string(),
|
||||||
"sleep 5".to_string(),
|
"for i in $(seq 1 30); do ./bin/pg_isready -h localhost -p 5432 -U gbuser >/dev/null 2>&1 && echo 'PostgreSQL is ready' && break || echo \"Waiting for PostgreSQL... attempt $i/30\" >&2; sleep 2; done".to_string(),
|
||||||
|
"./bin/pg_isready -h localhost -p 5432 -U gbuser || { echo 'ERROR: PostgreSQL failed to start properly' >&2; cat {{LOGS_PATH}}/postgres.log >&2; exit 1; }".to_string(),
|
||||||
// Check if PostgreSQL is accepting connections with retries
|
format!("PGPASSWORD={} ./bin/psql -h localhost -p 5432 -U gbuser -d postgres -c \"CREATE DATABASE botserver WITH OWNER gbuser\" 2>&1 | grep -v 'already exists' || true", db_password),
|
||||||
"for i in $(seq 1 30); do ./bin/pg_isready -h localhost -p 5432 -U gbuser >/dev/null 2>&1 && echo 'PostgreSQL is ready' && break || echo \"Waiting for PostgreSQL... attempt $i/30\" >&2; sleep 2; done".to_string(),
|
],
|
||||||
|
pre_install_cmds_macos: vec![],
|
||||||
// Final verification
|
post_install_cmds_macos: vec![
|
||||||
"./bin/pg_isready -h localhost -p 5432 -U gbuser || { echo 'ERROR: PostgreSQL failed to start properly' >&2; cat {{LOGS_PATH}}/postgres.log >&2; exit 1; }".to_string(),
|
"chmod +x ./bin/*".to_string(),
|
||||||
|
"if [ ! -d \"{{DATA_PATH}}/pgdata\" ]; then ./bin/initdb -D {{DATA_PATH}}/pgdata -U postgres; fi".to_string(),
|
||||||
// Create database (separate command to ensure previous steps completed)
|
],
|
||||||
format!("PGPASSWORD={} ./bin/psql -h localhost -p 5432 -U gbuser -d postgres -c \"CREATE DATABASE botserver WITH OWNER gbuser\" 2>&1 | grep -v 'already exists' || true", db_password)
|
pre_install_cmds_windows: vec![],
|
||||||
],
|
post_install_cmds_windows: vec![],
|
||||||
pre_install_cmds_macos: vec![],
|
env_vars: HashMap::new(),
|
||||||
post_install_cmds_macos: vec![
|
data_download_list: Vec::new(),
|
||||||
"chmod +x ./bin/*".to_string(),
|
exec_cmd: "./bin/pg_ctl -D {{DATA_PATH}}/pgdata -l {{LOGS_PATH}}/postgres.log start -w -t 30".to_string(),
|
||||||
"if [ ! -d \"{{DATA_PATH}}/pgdata\" ]; then ./bin/initdb -D {{DATA_PATH}}/pgdata -U postgres; fi".to_string(),
|
},
|
||||||
],
|
);
|
||||||
pre_install_cmds_windows: vec![],
|
|
||||||
post_install_cmds_windows: vec![],
|
|
||||||
env_vars: HashMap::new(),
|
|
||||||
exec_cmd: "./bin/pg_ctl -D {{DATA_PATH}}/pgdata -l {{LOGS_PATH}}/postgres.log start -w -t 30".to_string(),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_cache(&mut self) {
|
fn register_cache(&mut self) {
|
||||||
self.components.insert(
|
self.components.insert(
|
||||||
"cache".to_string(),
|
"cache".to_string(),
|
||||||
ComponentConfig {
|
ComponentConfig {
|
||||||
name: "cache".to_string(),
|
name: "cache".to_string(),
|
||||||
required: true,
|
required: true,
|
||||||
ports: vec![6379],
|
ports: vec![6379],
|
||||||
dependencies: vec![],
|
dependencies: vec![],
|
||||||
linux_packages: vec![],
|
linux_packages: vec![],
|
||||||
macos_packages: vec![],
|
macos_packages: vec![],
|
||||||
windows_packages: vec![],
|
windows_packages: vec![],
|
||||||
download_url: Some("https://download.valkey.io/releases/valkey-9.0.0-jammy-x86_64.tar.gz".to_string()),
|
download_url: Some(
|
||||||
binary_name: Some("valkey-server".to_string()),
|
"https://download.valkey.io/releases/valkey-9.0.0-jammy-x86_64.tar.gz".to_string(),
|
||||||
pre_install_cmds_linux: vec![],
|
),
|
||||||
post_install_cmds_linux: vec![
|
binary_name: Some("valkey-server".to_string()),
|
||||||
"tar -xzf {{BIN_PATH}}/valkey-9.0.0-jammy-x86_64.tar.gz -C {{BIN_PATH}}".to_string(),
|
pre_install_cmds_linux: vec![],
|
||||||
"mv {{BIN_PATH}}/valkey-9.0.0-jammy-x86_64/valkey-server {{BIN_PATH}}/valkey-server".to_string(),
|
post_install_cmds_linux: vec![
|
||||||
],
|
"tar -xzf {{BIN_PATH}}/valkey-9.0.0-jammy-x86_64.tar.gz -C {{BIN_PATH}}".to_string(),
|
||||||
pre_install_cmds_macos: vec![],
|
"mv {{BIN_PATH}}/valkey-9.0.0-jammy-x86_64/valkey-server {{BIN_PATH}}/valkey-server".to_string(),
|
||||||
post_install_cmds_macos: vec![],
|
],
|
||||||
pre_install_cmds_windows: vec![],
|
pre_install_cmds_macos: vec![],
|
||||||
post_install_cmds_windows: vec![],
|
post_install_cmds_macos: vec![],
|
||||||
env_vars: HashMap::new(),
|
pre_install_cmds_windows: vec![],
|
||||||
exec_cmd: "{{BIN_PATH}}/valkey-server --port 6379 --dir {{DATA_PATH}}".to_string(),
|
post_install_cmds_windows: vec![],
|
||||||
},
|
env_vars: HashMap::new(),
|
||||||
);
|
data_download_list: Vec::new(),
|
||||||
|
exec_cmd: "{{BIN_PATH}}/valkey-server --port 6379 --dir {{DATA_PATH}}".to_string(),
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_llm(&mut self) {
|
fn register_llm(&mut self) {
|
||||||
self.components.insert("llm".to_string(), ComponentConfig {
|
self.components.insert(
|
||||||
name: "llm".to_string(),
|
"llm".to_string(),
|
||||||
required: true,
|
ComponentConfig {
|
||||||
ports: vec![8081, 8082],
|
name: "llm".to_string(),
|
||||||
dependencies: vec![],
|
required: true,
|
||||||
linux_packages: vec!["unzip".to_string()],
|
ports: vec![8081, 8082],
|
||||||
macos_packages: vec!["unzip".to_string()],
|
dependencies: vec![],
|
||||||
windows_packages: vec![],
|
linux_packages: vec!["unzip".to_string()],
|
||||||
download_url: Some("https://github.com/ggml-org/llama.cpp/releases/download/b6148/llama-b6148-bin-ubuntu-x64.zip".to_string()),
|
macos_packages: vec!["unzip".to_string()],
|
||||||
binary_name: Some("llama-server".to_string()),
|
windows_packages: vec![],
|
||||||
pre_install_cmds_linux: vec![],
|
download_url: Some(
|
||||||
post_install_cmds_linux: vec![
|
"https://github.com/ggml-org/llama.cpp/releases/download/b6148/llama-b6148-bin-ubuntu-x64.zip".to_string(),
|
||||||
"wget -q https://huggingface.co/bartowski/DeepSeek-R1-Distill-Qwen-1.5B-GGUF/resolve/main/DeepSeek-R1-Distill-Qwen-1.5B-Q3_K_M.gguf -P {{DATA_PATH}}".to_string(),
|
),
|
||||||
"wget -q https://huggingface.co/CompendiumLabs/bge-small-en-v1.5-gguf/resolve/main/bge-small-en-v1.5-f32.gguf -P {{DATA_PATH}}".to_string()
|
binary_name: Some("llama-server".to_string()),
|
||||||
],
|
pre_install_cmds_linux: vec![],
|
||||||
pre_install_cmds_macos: vec![],
|
post_install_cmds_linux: vec![],
|
||||||
post_install_cmds_macos: vec![
|
pre_install_cmds_macos: vec![],
|
||||||
"wget -q https://huggingface.co/bartowski/DeepSeek-R1-Distill-Qwen-1.5B-GGUF/resolve/main/DeepSeek-R1-Distill-Qwen-1.5B-Q3_K_M.gguf -P {{DATA_PATH}}".to_string(),
|
post_install_cmds_macos: vec![],
|
||||||
"wget -q https://huggingface.co/CompendiumLabs/bge-small-en-v1.5-gguf/resolve/main/bge-small-en-v1.5-f32.gguf -P {{DATA_PATH}}".to_string()
|
pre_install_cmds_windows: vec![],
|
||||||
],
|
post_install_cmds_windows: vec![],
|
||||||
pre_install_cmds_windows: vec![],
|
env_vars: HashMap::new(),
|
||||||
post_install_cmds_windows: vec![],
|
data_download_list: vec![
|
||||||
env_vars: HashMap::new(),
|
"https://huggingface.co/bartowski/DeepSeek-R1-Distill-Qwen-1.5B-GGUF/resolve/main/DeepSeek-R1-Distill-Qwen-1.5B-Q3_K_M.gguf".to_string(),
|
||||||
exec_cmd: "nohup {{BIN_PATH}}/llama-server -m {{DATA_PATH}}/DeepSeek-R1-Distill-Qwen-1.5B-Q3_K_M.gguf --port 8081 > {{LOGS_PATH}}/llm-main.log 2>&1 & nohup {{BIN_PATH}}/llama-server -m {{DATA_PATH}}/bge-small-en-v1.5-f32.gguf --port 8082 --embedding > {{LOGS_PATH}}/llm-embed.log 2>&1 &".to_string(),
|
"https://huggingface.co/CompendiumLabs/bge-small-en-v1.5-gguf/resolve/main/bge-small-en-v1.5-f32.gguf".to_string(),
|
||||||
});
|
],
|
||||||
|
exec_cmd: "nohup {{BIN_PATH}}/llama-server -m {{DATA_PATH}}/DeepSeek-R1-Distill-Qwen-1.5B-Q3_K_M.gguf --port 8081 > {{LOGS_PATH}}/llm-main.log 2>&1 & nohup {{BIN_PATH}}/llama-server -m {{DATA_PATH}}/bge-small-en-v1.5-f32.gguf --port 8082 --embedding > {{LOGS_PATH}}/llm-embed.log 2>&1 &".to_string(),
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_email(&mut self) {
|
fn register_email(&mut self) {
|
||||||
self.components.insert("email".to_string(), ComponentConfig {
|
self.components.insert(
|
||||||
name: "email".to_string(),
|
"email".to_string(),
|
||||||
required: false,
|
ComponentConfig {
|
||||||
ports: vec![25, 80, 110, 143, 465, 587, 993, 995, 4190],
|
name: "email".to_string(),
|
||||||
dependencies: vec![],
|
required: false,
|
||||||
linux_packages: vec!["libcap2-bin".to_string(), "resolvconf".to_string()],
|
ports: vec![25, 80, 110, 143, 465, 587, 993, 995, 4190],
|
||||||
macos_packages: vec![],
|
dependencies: vec![],
|
||||||
windows_packages: vec![],
|
linux_packages: vec!["libcap2-bin".to_string(), "resolvconf".to_string()],
|
||||||
download_url: Some("https://github.com/stalwartlabs/stalwart/releases/download/v0.13.1/stalwart-x86_64-unknown-linux-gnu.tar.gz".to_string()),
|
macos_packages: vec![],
|
||||||
binary_name: Some("stalwart".to_string()),
|
windows_packages: vec![],
|
||||||
pre_install_cmds_linux: vec![],
|
download_url: Some(
|
||||||
post_install_cmds_linux: vec![
|
"https://github.com/stalwartlabs/stalwart/releases/download/v0.13.1/stalwart-x86_64-unknown-linux-gnu.tar.gz".to_string(),
|
||||||
"setcap 'cap_net_bind_service=+ep' {{BIN_PATH}}/stalwart".to_string()
|
),
|
||||||
],
|
binary_name: Some("stalwart".to_string()),
|
||||||
pre_install_cmds_macos: vec![],
|
pre_install_cmds_linux: vec![],
|
||||||
post_install_cmds_macos: vec![],
|
post_install_cmds_linux: vec![
|
||||||
pre_install_cmds_windows: vec![],
|
"setcap 'cap_net_bind_service=+ep' {{BIN_PATH}}/stalwart".to_string(),
|
||||||
post_install_cmds_windows: vec![],
|
],
|
||||||
env_vars: HashMap::new(),
|
pre_install_cmds_macos: vec![],
|
||||||
exec_cmd: "{{BIN_PATH}}/stalwart --config {{CONF_PATH}}/config.toml".to_string(),
|
post_install_cmds_macos: vec![],
|
||||||
});
|
pre_install_cmds_windows: vec![],
|
||||||
|
post_install_cmds_windows: vec![],
|
||||||
|
env_vars: HashMap::new(),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
|
exec_cmd: "{{BIN_PATH}}/stalwart --config {{CONF_PATH}}/config.toml".to_string(),
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_proxy(&mut self) {
|
fn register_proxy(&mut self) {
|
||||||
self.components.insert("proxy".to_string(), ComponentConfig {
|
self.components.insert(
|
||||||
name: "proxy".to_string(),
|
"proxy".to_string(),
|
||||||
required: false,
|
ComponentConfig {
|
||||||
ports: vec![80, 443],
|
name: "proxy".to_string(),
|
||||||
dependencies: vec![],
|
required: false,
|
||||||
linux_packages: vec!["libcap2-bin".to_string()],
|
ports: vec![80, 443],
|
||||||
macos_packages: vec![],
|
dependencies: vec![],
|
||||||
windows_packages: vec![],
|
linux_packages: vec!["libcap2-bin".to_string()],
|
||||||
download_url: Some("https://github.com/caddyserver/caddy/releases/download/v2.10.0-beta.3/caddy_2.10.0-beta.3_linux_amd64.tar.gz".to_string()),
|
macos_packages: vec![],
|
||||||
binary_name: Some("caddy".to_string()),
|
windows_packages: vec![],
|
||||||
pre_install_cmds_linux: vec![],
|
download_url: Some(
|
||||||
post_install_cmds_linux: vec![
|
"https://github.com/caddyserver/caddy/releases/download/v2.10.0-beta.3/caddy_2.10.0-beta.3_linux_amd64.tar.gz".to_string(),
|
||||||
"setcap 'cap_net_bind_service=+ep' {{BIN_PATH}}/caddy".to_string()
|
),
|
||||||
],
|
binary_name: Some("caddy".to_string()),
|
||||||
pre_install_cmds_macos: vec![],
|
pre_install_cmds_linux: vec![],
|
||||||
post_install_cmds_macos: vec![],
|
post_install_cmds_linux: vec![
|
||||||
pre_install_cmds_windows: vec![],
|
"setcap 'cap_net_bind_service=+ep' {{BIN_PATH}}/caddy".to_string(),
|
||||||
post_install_cmds_windows: vec![],
|
],
|
||||||
env_vars: HashMap::from([
|
pre_install_cmds_macos: vec![],
|
||||||
("XDG_DATA_HOME".to_string(), "{{DATA_PATH}}".to_string())
|
post_install_cmds_macos: vec![],
|
||||||
]),
|
pre_install_cmds_windows: vec![],
|
||||||
exec_cmd: "{{BIN_PATH}}/caddy run --config {{CONF_PATH}}/Caddyfile".to_string(),
|
post_install_cmds_windows: vec![],
|
||||||
});
|
env_vars: HashMap::from([("XDG_DATA_HOME".to_string(), "{{DATA_PATH}}".to_string())]),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
|
exec_cmd: "{{BIN_PATH}}/caddy run --config {{CONF_PATH}}/Caddyfile".to_string(),
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_directory(&mut self) {
|
fn register_directory(&mut self) {
|
||||||
self.components.insert("directory".to_string(), ComponentConfig {
|
self.components.insert(
|
||||||
name: "directory".to_string(),
|
"directory".to_string(),
|
||||||
required: false,
|
ComponentConfig {
|
||||||
ports: vec![8080],
|
name: "directory".to_string(),
|
||||||
dependencies: vec![],
|
required: false,
|
||||||
linux_packages: vec!["libcap2-bin".to_string()],
|
ports: vec![8080],
|
||||||
macos_packages: vec![],
|
dependencies: vec![],
|
||||||
windows_packages: vec![],
|
linux_packages: vec!["libcap2-bin".to_string()],
|
||||||
download_url: Some("https://github.com/zitadel/zitadel/releases/download/v2.71.2/zitadel-linux-amd64.tar.gz".to_string()),
|
macos_packages: vec![],
|
||||||
binary_name: Some("zitadel".to_string()),
|
windows_packages: vec![],
|
||||||
pre_install_cmds_linux: vec![],
|
download_url: Some(
|
||||||
post_install_cmds_linux: vec![
|
"https://github.com/zitadel/zitadel/releases/download/v2.71.2/zitadel-linux-amd64.tar.gz".to_string(),
|
||||||
"setcap 'cap_net_bind_service=+ep' {{BIN_PATH}}/zitadel".to_string()
|
),
|
||||||
],
|
binary_name: Some("zitadel".to_string()),
|
||||||
pre_install_cmds_macos: vec![],
|
pre_install_cmds_linux: vec![],
|
||||||
post_install_cmds_macos: vec![],
|
post_install_cmds_linux: vec![
|
||||||
pre_install_cmds_windows: vec![],
|
"setcap 'cap_net_bind_service=+ep' {{BIN_PATH}}/zitadel".to_string(),
|
||||||
post_install_cmds_windows: vec![],
|
],
|
||||||
env_vars: HashMap::new(),
|
pre_install_cmds_macos: vec![],
|
||||||
exec_cmd: "{{BIN_PATH}}/zitadel start --config {{CONF_PATH}}/zitadel.yaml".to_string(),
|
post_install_cmds_macos: vec![],
|
||||||
});
|
pre_install_cmds_windows: vec![],
|
||||||
|
post_install_cmds_windows: vec![],
|
||||||
|
env_vars: HashMap::new(),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
|
exec_cmd: "{{BIN_PATH}}/zitadel start --config {{CONF_PATH}}/zitadel.yaml".to_string(),
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_alm(&mut self) {
|
fn register_alm(&mut self) {
|
||||||
self.components.insert("alm".to_string(), ComponentConfig {
|
self.components.insert(
|
||||||
name: "alm".to_string(),
|
"alm".to_string(),
|
||||||
required: false,
|
ComponentConfig {
|
||||||
ports: vec![3000],
|
name: "alm".to_string(),
|
||||||
dependencies: vec![],
|
required: false,
|
||||||
linux_packages: vec!["git".to_string(), "git-lfs".to_string()],
|
ports: vec![3000],
|
||||||
macos_packages: vec!["git".to_string(), "git-lfs".to_string()],
|
dependencies: vec![],
|
||||||
windows_packages: vec![],
|
linux_packages: vec!["git".to_string(), "git-lfs".to_string()],
|
||||||
download_url: Some("https://codeberg.org/forgejo/forgejo/releases/download/v10.0.2/forgejo-10.0.2-linux-amd64".to_string()),
|
macos_packages: vec!["git".to_string(), "git-lfs".to_string()],
|
||||||
binary_name: Some("forgejo".to_string()),
|
windows_packages: vec![],
|
||||||
pre_install_cmds_linux: vec![],
|
download_url: Some(
|
||||||
post_install_cmds_linux: vec![],
|
"https://codeberg.org/forgejo/forgejo/releases/download/v10.0.2/forgejo-10.0.2-linux-amd64".to_string(),
|
||||||
pre_install_cmds_macos: vec![],
|
),
|
||||||
post_install_cmds_macos: vec![],
|
binary_name: Some("forgejo".to_string()),
|
||||||
pre_install_cmds_windows: vec![],
|
pre_install_cmds_linux: vec![],
|
||||||
post_install_cmds_windows: vec![],
|
post_install_cmds_linux: vec![],
|
||||||
env_vars: HashMap::from([
|
pre_install_cmds_macos: vec![],
|
||||||
("USER".to_string(), "alm".to_string()),
|
post_install_cmds_macos: vec![],
|
||||||
("HOME".to_string(), "{{DATA_PATH}}".to_string())
|
pre_install_cmds_windows: vec![],
|
||||||
]),
|
post_install_cmds_windows: vec![],
|
||||||
exec_cmd: "{{BIN_PATH}}/forgejo web --work-path {{DATA_PATH}}".to_string(),
|
env_vars: HashMap::from([
|
||||||
});
|
("USER".to_string(), "alm".to_string()),
|
||||||
|
("HOME".to_string(), "{{DATA_PATH}}".to_string()),
|
||||||
|
]),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
|
exec_cmd: "{{BIN_PATH}}/forgejo web --work-path {{DATA_PATH}}".to_string(),
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_alm_ci(&mut self) {
|
fn register_alm_ci(&mut self) {
|
||||||
self.components.insert("alm-ci".to_string(), ComponentConfig {
|
self.components.insert(
|
||||||
name: "alm-ci".to_string(),
|
"alm-ci".to_string(),
|
||||||
required: false,
|
ComponentConfig {
|
||||||
ports: vec![],
|
name: "alm-ci".to_string(),
|
||||||
dependencies: vec!["alm".to_string()],
|
required: false,
|
||||||
linux_packages: vec!["git".to_string(), "curl".to_string(), "gnupg".to_string(), "ca-certificates".to_string(), "build-essential".to_string()],
|
ports: vec![],
|
||||||
macos_packages: vec!["git".to_string(), "node".to_string()],
|
dependencies: vec!["alm".to_string()],
|
||||||
windows_packages: vec![],
|
linux_packages: vec![
|
||||||
download_url: Some("https://code.forgejo.org/forgejo/runner/releases/download/v6.3.1/forgejo-runner-6.3.1-linux-amd64".to_string()),
|
"git".to_string(),
|
||||||
binary_name: Some("forgejo-runner".to_string()),
|
"curl".to_string(),
|
||||||
pre_install_cmds_linux: vec![
|
"gnupg".to_string(),
|
||||||
"curl -fsSL https://deb.nodesource.com/setup_22.x | bash -".to_string(),
|
"ca-certificates".to_string(),
|
||||||
"apt-get install -y nodejs".to_string()
|
"build-essential".to_string(),
|
||||||
],
|
],
|
||||||
post_install_cmds_linux: vec![
|
macos_packages: vec!["git".to_string(), "node".to_string()],
|
||||||
"npm install -g pnpm@latest".to_string()
|
windows_packages: vec![],
|
||||||
],
|
download_url: Some(
|
||||||
pre_install_cmds_macos: vec![],
|
"https://code.forgejo.org/forgejo/runner/releases/download/v6.3.1/forgejo-runner-6.3.1-linux-amd64".to_string(),
|
||||||
post_install_cmds_macos: vec![
|
),
|
||||||
"npm install -g pnpm@latest".to_string()
|
binary_name: Some("forgejo-runner".to_string()),
|
||||||
],
|
pre_install_cmds_linux: vec![
|
||||||
pre_install_cmds_windows: vec![],
|
"curl -fsSL https://deb.nodesource.com/setup_22.x | bash -".to_string(),
|
||||||
post_install_cmds_windows: vec![],
|
"apt-get install -y nodejs".to_string(),
|
||||||
env_vars: HashMap::new(),
|
],
|
||||||
exec_cmd: "{{BIN_PATH}}/forgejo-runner daemon --config {{CONF_PATH}}/config.yaml".to_string(),
|
post_install_cmds_linux: vec!["npm install -g pnpm@latest".to_string()],
|
||||||
});
|
pre_install_cmds_macos: vec![],
|
||||||
|
post_install_cmds_macos: vec!["npm install -g pnpm@latest".to_string()],
|
||||||
|
pre_install_cmds_windows: vec![],
|
||||||
|
post_install_cmds_windows: vec![],
|
||||||
|
env_vars: HashMap::new(),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
|
exec_cmd: "{{BIN_PATH}}/forgejo-runner daemon --config {{CONF_PATH}}/config.yaml".to_string(),
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_dns(&mut self) {
|
fn register_dns(&mut self) {
|
||||||
self.components.insert("dns".to_string(), ComponentConfig {
|
self.components.insert(
|
||||||
name: "dns".to_string(),
|
"dns".to_string(),
|
||||||
required: false,
|
ComponentConfig {
|
||||||
ports: vec![53],
|
name: "dns".to_string(),
|
||||||
dependencies: vec![],
|
required: false,
|
||||||
linux_packages: vec![],
|
ports: vec![53],
|
||||||
macos_packages: vec![],
|
dependencies: vec![],
|
||||||
windows_packages: vec![],
|
linux_packages: vec![],
|
||||||
download_url: Some("https://github.com/coredns/coredns/releases/download/v1.12.4/coredns_1.12.4_linux_amd64.tgz".to_string()),
|
macos_packages: vec![],
|
||||||
binary_name: Some("coredns".to_string()),
|
windows_packages: vec![],
|
||||||
pre_install_cmds_linux: vec![],
|
download_url: Some(
|
||||||
post_install_cmds_linux: vec![
|
"https://github.com/coredns/coredns/releases/download/v1.12.4/coredns_1.12.4_linux_amd64.tgz".to_string(),
|
||||||
"setcap cap_net_bind_service=+ep {{BIN_PATH}}/coredns".to_string()
|
),
|
||||||
],
|
binary_name: Some("coredns".to_string()),
|
||||||
pre_install_cmds_macos: vec![],
|
pre_install_cmds_linux: vec![],
|
||||||
post_install_cmds_macos: vec![],
|
post_install_cmds_linux: vec![
|
||||||
pre_install_cmds_windows: vec![],
|
"setcap cap_net_bind_service=+ep {{BIN_PATH}}/coredns".to_string(),
|
||||||
post_install_cmds_windows: vec![],
|
],
|
||||||
env_vars: HashMap::new(),
|
pre_install_cmds_macos: vec![],
|
||||||
exec_cmd: "{{BIN_PATH}}/coredns -conf {{CONF_PATH}}/Corefile".to_string(),
|
post_install_cmds_macos: vec![],
|
||||||
});
|
pre_install_cmds_windows: vec![],
|
||||||
|
post_install_cmds_windows: vec![],
|
||||||
|
env_vars: HashMap::new(),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
|
exec_cmd: "{{BIN_PATH}}/coredns -conf {{CONF_PATH}}/Corefile".to_string(),
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_webmail(&mut self) {
|
fn register_webmail(&mut self) {
|
||||||
self.components.insert("webmail".to_string(), ComponentConfig {
|
self.components.insert(
|
||||||
name: "webmail".to_string(),
|
"webmail".to_string(),
|
||||||
required: false,
|
ComponentConfig {
|
||||||
ports: vec![8080],
|
name: "webmail".to_string(),
|
||||||
dependencies: vec!["email".to_string()],
|
required: false,
|
||||||
linux_packages: vec!["ca-certificates".to_string(), "apt-transport-https".to_string(), "php8.1".to_string(), "php8.1-fpm".to_string()],
|
ports: vec![8080],
|
||||||
macos_packages: vec!["php".to_string()],
|
dependencies: vec!["email".to_string()],
|
||||||
windows_packages: vec![],
|
linux_packages: vec![
|
||||||
download_url: Some("https://github.com/roundcube/roundcubemail/releases/download/1.6.6/roundcubemail-1.6.6-complete.tar.gz".to_string()),
|
"ca-certificates".to_string(),
|
||||||
binary_name: None,
|
"apt-transport-https".to_string(),
|
||||||
pre_install_cmds_linux: vec![],
|
"php8.1".to_string(),
|
||||||
post_install_cmds_linux: vec![],
|
"php8.1-fpm".to_string(),
|
||||||
pre_install_cmds_macos: vec![],
|
],
|
||||||
post_install_cmds_macos: vec![],
|
macos_packages: vec!["php".to_string()],
|
||||||
pre_install_cmds_windows: vec![],
|
windows_packages: vec![],
|
||||||
post_install_cmds_windows: vec![],
|
download_url: Some(
|
||||||
env_vars: HashMap::new(),
|
"https://github.com/roundcube/roundcubemail/releases/download/1.6.6/roundcubemail-1.6.6-complete.tar.gz".to_string(),
|
||||||
exec_cmd: "php -S 0.0.0.0:8080 -t {{DATA_PATH}}/roundcubemail".to_string(),
|
),
|
||||||
});
|
binary_name: None,
|
||||||
|
pre_install_cmds_linux: vec![],
|
||||||
|
post_install_cmds_linux: vec![],
|
||||||
|
pre_install_cmds_macos: vec![],
|
||||||
|
post_install_cmds_macos: vec![],
|
||||||
|
pre_install_cmds_windows: vec![],
|
||||||
|
post_install_cmds_windows: vec![],
|
||||||
|
env_vars: HashMap::new(),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
|
exec_cmd: "php -S 0.0.0.0:8080 -t {{DATA_PATH}}/roundcubemail".to_string(),
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_meeting(&mut self) {
|
fn register_meeting(&mut self) {
|
||||||
self.components.insert("meeting".to_string(), ComponentConfig {
|
self.components.insert(
|
||||||
name: "meeting".to_string(),
|
"meeting".to_string(),
|
||||||
required: false,
|
ComponentConfig {
|
||||||
ports: vec![7880, 3478],
|
name: "meeting".to_string(),
|
||||||
dependencies: vec![],
|
required: false,
|
||||||
linux_packages: vec!["coturn".to_string()],
|
ports: vec![7880, 3478],
|
||||||
macos_packages: vec![],
|
dependencies: vec![],
|
||||||
windows_packages: vec![],
|
linux_packages: vec!["coturn".to_string()],
|
||||||
download_url: Some("https://github.com/livekit/livekit/releases/download/v1.8.4/livekit_1.8.4_linux_amd64.tar.gz".to_string()),
|
macos_packages: vec![],
|
||||||
binary_name: Some("livekit-server".to_string()),
|
windows_packages: vec![],
|
||||||
pre_install_cmds_linux: vec![],
|
download_url: Some(
|
||||||
post_install_cmds_linux: vec![],
|
"https://github.com/livekit/livekit/releases/download/v1.8.4/livekit_1.8.4_linux_amd64.tar.gz".to_string(),
|
||||||
pre_install_cmds_macos: vec![],
|
),
|
||||||
post_install_cmds_macos: vec![],
|
binary_name: Some("livekit-server".to_string()),
|
||||||
pre_install_cmds_windows: vec![],
|
pre_install_cmds_linux: vec![],
|
||||||
post_install_cmds_windows: vec![],
|
post_install_cmds_linux: vec![],
|
||||||
env_vars: HashMap::new(),
|
pre_install_cmds_macos: vec![],
|
||||||
exec_cmd: "{{BIN_PATH}}/livekit-server --config {{CONF_PATH}}/config.yaml".to_string(),
|
post_install_cmds_macos: vec![],
|
||||||
});
|
pre_install_cmds_windows: vec![],
|
||||||
|
post_install_cmds_windows: vec![],
|
||||||
|
env_vars: HashMap::new(),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
|
exec_cmd: "{{BIN_PATH}}/livekit-server --config {{CONF_PATH}}/config.yaml".to_string(),
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_table_editor(&mut self) {
|
fn register_table_editor(&mut self) {
|
||||||
|
|
@ -474,6 +526,7 @@ self.components.insert(
|
||||||
pre_install_cmds_windows: vec![],
|
pre_install_cmds_windows: vec![],
|
||||||
post_install_cmds_windows: vec![],
|
post_install_cmds_windows: vec![],
|
||||||
env_vars: HashMap::new(),
|
env_vars: HashMap::new(),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
exec_cmd: "{{BIN_PATH}}/nocodb".to_string(),
|
exec_cmd: "{{BIN_PATH}}/nocodb".to_string(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
@ -499,6 +552,7 @@ self.components.insert(
|
||||||
pre_install_cmds_windows: vec![],
|
pre_install_cmds_windows: vec![],
|
||||||
post_install_cmds_windows: vec![],
|
post_install_cmds_windows: vec![],
|
||||||
env_vars: HashMap::new(),
|
env_vars: HashMap::new(),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
exec_cmd: "coolwsd --config-file={{CONF_PATH}}/coolwsd.xml".to_string(),
|
exec_cmd: "coolwsd --config-file={{CONF_PATH}}/coolwsd.xml".to_string(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
@ -524,6 +578,7 @@ self.components.insert(
|
||||||
pre_install_cmds_windows: vec![],
|
pre_install_cmds_windows: vec![],
|
||||||
post_install_cmds_windows: vec![],
|
post_install_cmds_windows: vec![],
|
||||||
env_vars: HashMap::new(),
|
env_vars: HashMap::new(),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
exec_cmd: "xrdp --nodaemon".to_string(),
|
exec_cmd: "xrdp --nodaemon".to_string(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
@ -549,6 +604,7 @@ self.components.insert(
|
||||||
pre_install_cmds_windows: vec![],
|
pre_install_cmds_windows: vec![],
|
||||||
post_install_cmds_windows: vec![],
|
post_install_cmds_windows: vec![],
|
||||||
env_vars: HashMap::new(),
|
env_vars: HashMap::new(),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
exec_cmd: "".to_string(),
|
exec_cmd: "".to_string(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
@ -582,6 +638,7 @@ self.components.insert(
|
||||||
pre_install_cmds_windows: vec![],
|
pre_install_cmds_windows: vec![],
|
||||||
post_install_cmds_windows: vec![],
|
post_install_cmds_windows: vec![],
|
||||||
env_vars: HashMap::from([("DISPLAY".to_string(), ":99".to_string())]),
|
env_vars: HashMap::from([("DISPLAY".to_string(), ":99".to_string())]),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
exec_cmd: "".to_string(),
|
exec_cmd: "".to_string(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
@ -607,31 +664,38 @@ self.components.insert(
|
||||||
pre_install_cmds_windows: vec![],
|
pre_install_cmds_windows: vec![],
|
||||||
post_install_cmds_windows: vec![],
|
post_install_cmds_windows: vec![],
|
||||||
env_vars: HashMap::new(),
|
env_vars: HashMap::new(),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
exec_cmd: "".to_string(),
|
exec_cmd: "".to_string(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_vector_db(&mut self) {
|
fn register_vector_db(&mut self) {
|
||||||
self.components.insert("vector_db".to_string(), ComponentConfig {
|
self.components.insert(
|
||||||
name: "vector_db".to_string(),
|
"vector_db".to_string(),
|
||||||
required: false,
|
ComponentConfig {
|
||||||
ports: vec![6333],
|
name: "vector_db".to_string(),
|
||||||
dependencies: vec![],
|
required: false,
|
||||||
linux_packages: vec![],
|
ports: vec![6333],
|
||||||
macos_packages: vec![],
|
dependencies: vec![],
|
||||||
windows_packages: vec![],
|
linux_packages: vec![],
|
||||||
download_url: Some("https://github.com/qdrant/qdrant/releases/latest/download/qdrant-x86_64-unknown-linux-gnu.tar.gz".to_string()),
|
macos_packages: vec![],
|
||||||
binary_name: Some("qdrant".to_string()),
|
windows_packages: vec![],
|
||||||
pre_install_cmds_linux: vec![],
|
download_url: Some(
|
||||||
post_install_cmds_linux: vec![],
|
"https://github.com/qdrant/qdrant/releases/latest/download/qdrant-x86_64-unknown-linux-gnu.tar.gz".to_string(),
|
||||||
pre_install_cmds_macos: vec![],
|
),
|
||||||
post_install_cmds_macos: vec![],
|
binary_name: Some("qdrant".to_string()),
|
||||||
pre_install_cmds_windows: vec![],
|
pre_install_cmds_linux: vec![],
|
||||||
post_install_cmds_windows: vec![],
|
post_install_cmds_linux: vec![],
|
||||||
env_vars: HashMap::new(),
|
pre_install_cmds_macos: vec![],
|
||||||
exec_cmd: "{{BIN_PATH}}/qdrant --storage-path {{DATA_PATH}}".to_string(),
|
post_install_cmds_macos: vec![],
|
||||||
});
|
pre_install_cmds_windows: vec![],
|
||||||
|
post_install_cmds_windows: vec![],
|
||||||
|
env_vars: HashMap::new(),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
|
exec_cmd: "{{BIN_PATH}}/qdrant --storage-path {{DATA_PATH}}".to_string(),
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_host(&mut self) {
|
fn register_host(&mut self) {
|
||||||
|
|
@ -661,6 +725,7 @@ self.components.insert(
|
||||||
pre_install_cmds_windows: vec![],
|
pre_install_cmds_windows: vec![],
|
||||||
post_install_cmds_windows: vec![],
|
post_install_cmds_windows: vec![],
|
||||||
env_vars: HashMap::new(),
|
env_vars: HashMap::new(),
|
||||||
|
data_download_list: Vec::new(),
|
||||||
exec_cmd: "".to_string(),
|
exec_cmd: "".to_string(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
@ -673,7 +738,6 @@ self.components.insert(
|
||||||
let conf_path = self.base_path.join("conf").join(&component.name);
|
let conf_path = self.base_path.join("conf").join(&component.name);
|
||||||
let logs_path = self.base_path.join("logs").join(&component.name);
|
let logs_path = self.base_path.join("logs").join(&component.name);
|
||||||
|
|
||||||
// For PostgreSQL, check if it's already running
|
|
||||||
if component.name == "tables" {
|
if component.name == "tables" {
|
||||||
let check_cmd = format!(
|
let check_cmd = format!(
|
||||||
"./bin/pg_ctl -D {} status",
|
"./bin/pg_ctl -D {} status",
|
||||||
|
|
@ -687,11 +751,7 @@ self.components.insert(
|
||||||
|
|
||||||
if let Ok(output) = check_output {
|
if let Ok(output) = check_output {
|
||||||
if output.status.success() {
|
if output.status.success() {
|
||||||
trace!(
|
trace!("Component {} is already running, skipping start", component.name);
|
||||||
"Component {} is already running, skipping start",
|
|
||||||
component.name
|
|
||||||
);
|
|
||||||
// Return a dummy child process handle - PostgreSQL is already running
|
|
||||||
return Ok(std::process::Command::new("sh")
|
return Ok(std::process::Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("echo 'Already running'")
|
.arg("echo 'Already running'")
|
||||||
|
|
@ -707,11 +767,7 @@ self.components.insert(
|
||||||
.replace("{{CONF_PATH}}", &conf_path.to_string_lossy())
|
.replace("{{CONF_PATH}}", &conf_path.to_string_lossy())
|
||||||
.replace("{{LOGS_PATH}}", &logs_path.to_string_lossy());
|
.replace("{{LOGS_PATH}}", &logs_path.to_string_lossy());
|
||||||
|
|
||||||
trace!(
|
trace!("Starting component {} with command: {}", component.name, rendered_cmd);
|
||||||
"Starting component {} with command: {}",
|
|
||||||
component.name,
|
|
||||||
rendered_cmd
|
|
||||||
);
|
|
||||||
|
|
||||||
let child = std::process::Command::new("sh")
|
let child = std::process::Command::new("sh")
|
||||||
.current_dir(&bin_path)
|
.current_dir(&bin_path)
|
||||||
|
|
@ -719,16 +775,12 @@ self.components.insert(
|
||||||
.arg(&rendered_cmd)
|
.arg(&rendered_cmd)
|
||||||
.spawn();
|
.spawn();
|
||||||
|
|
||||||
// Handle "already running" errors gracefully
|
|
||||||
match child {
|
match child {
|
||||||
Ok(c) => Ok(c),
|
Ok(c) => Ok(c),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let err_msg = e.to_string();
|
let err_msg = e.to_string();
|
||||||
if err_msg.contains("already running") || component.name == "tables" {
|
if err_msg.contains("already running") || component.name == "tables" {
|
||||||
trace!(
|
trace!("Component {} may already be running, continuing anyway", component.name);
|
||||||
"Component {} may already be running, continuing anyway",
|
|
||||||
component.name
|
|
||||||
);
|
|
||||||
Ok(std::process::Command::new("sh")
|
Ok(std::process::Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("echo 'Already running'")
|
.arg("echo 'Already running'")
|
||||||
|
|
@ -744,14 +796,9 @@ self.components.insert(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generate_secure_password(&self, length: usize) -> String {
|
fn generate_secure_password(&self, length: usize) -> String {
|
||||||
// Use the non-deprecated `rng` function to obtain a thread-local RNG.
|
|
||||||
let mut rng = rand::rng();
|
let mut rng = rand::rng();
|
||||||
|
|
||||||
// Generate `length` alphanumeric characters.
|
|
||||||
(0..length)
|
(0..length)
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
// `Alphanumeric` implements the `Distribution<u8>` trait.
|
|
||||||
// Use the fully qualified `rand::Rng::sample` method to avoid needing an explicit import.
|
|
||||||
let byte = rand::Rng::sample(&mut rng, Alphanumeric);
|
let byte = rand::Rng::sample(&mut rng, Alphanumeric);
|
||||||
char::from(byte)
|
char::from(byte)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ pub fn to_array(value: Dynamic) -> Array {
|
||||||
pub async fn download_file(
|
pub async fn download_file(
|
||||||
url: &str,
|
url: &str,
|
||||||
output_path: &str,
|
output_path: &str,
|
||||||
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
) -> Result<(), anyhow::Error> {
|
||||||
let url = url.to_string();
|
let url = url.to_string();
|
||||||
let output_path = output_path.to_string();
|
let output_path = output_path.to_string();
|
||||||
|
|
||||||
|
|
@ -115,7 +115,7 @@ pub async fn download_file(
|
||||||
trace!("Download completed: {} -> {}", url, output_path);
|
trace!("Download completed: {} -> {}", url, output_path);
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(format!("HTTP {}: {}", response.status(), url).into())
|
Err(anyhow::anyhow!("HTTP {}: {}", response.status(), url))
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue