From 777a3eae635c4c8ffc4efed57baeb1e57eba8691 Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Thu, 11 Dec 2025 08:43:28 -0300 Subject: [PATCH] Move Directory (Zitadel) to port 8300 - Directory/Zitadel: 8080 -> 8300 - BotServer API remains on 8080 - Updated all references in bootstrap, installer, oauth, config --- src/core/bootstrap/mod.rs | 10 +++++----- src/core/config/mod.rs | 2 +- src/core/directory/api.rs | 6 +++--- src/core/directory/mod.rs | 2 +- src/core/oauth/providers.rs | 6 +++--- src/core/oauth/routes.rs | 2 +- src/core/package_manager/installer.rs | 12 ++++++------ src/drive/mod.rs | 12 ------------ 8 files changed, 20 insertions(+), 32 deletions(-) diff --git a/src/core/bootstrap/mod.rs b/src/core/bootstrap/mod.rs index b27c4d97..0c5aa5f7 100644 --- a/src/core/bootstrap/mod.rs +++ b/src/core/bootstrap/mod.rs @@ -90,7 +90,7 @@ impl BootstrapManager { 5432, // PostgreSQL 9000, // MinIO 6379, // Redis - 8080, // Zitadel / Main API + 8300, // Zitadel / Main API 8081, // LLM server 8082, // Embedding server 25, // Email SMTP @@ -999,7 +999,7 @@ Machine: ExternalSecure: false ExternalDomain: localhost -ExternalPort: 8080 +ExternalPort: 8300 DefaultInstance: OIDCSettings: @@ -1214,7 +1214,7 @@ meet IN A 127.0.0.1 while attempts < max_attempts { // Check if Zitadel is healthy let health_check = std::process::Command::new("curl") - .args(["-f", "-s", "http://localhost:8080/healthz"]) + .args(["-f", "-s", "http://localhost:8300/healthz"]) .output(); if let Ok(output) = health_check { @@ -1248,7 +1248,7 @@ meet IN A 127.0.0.1 }; let mut setup = DirectorySetup::new( - "http://localhost:8080".to_string(), // Use HTTP since TLS is disabled + "http://localhost:8300".to_string(), // Use HTTP since TLS is disabled config_path, ); @@ -1627,7 +1627,7 @@ VAULT_CACHE_TTL=300 let _ = std::process::Command::new("sh") .arg("-c") .arg(format!( - "unset VAULT_CLIENT_CERT VAULT_CLIENT_KEY VAULT_CACERT; VAULT_ADDR={} VAULT_TOKEN={} ./botserver-stack/bin/vault/vault kv put secret/gbo/directory url=https://localhost:8080 project_id= client_id= client_secret=", + "unset VAULT_CLIENT_CERT VAULT_CLIENT_KEY VAULT_CACERT; VAULT_ADDR={} VAULT_TOKEN={} ./botserver-stack/bin/vault/vault kv put secret/gbo/directory url=https://localhost:8300 project_id= client_id= client_secret=", vault_addr, root_token )) .output()?; diff --git a/src/core/config/mod.rs b/src/core/config/mod.rs index 13937375..2269ff3d 100644 --- a/src/core/config/mod.rs +++ b/src/core/config/mod.rs @@ -337,7 +337,7 @@ impl AppConfig { drive: minio, email, server: ServerConfig { - host: "127.0.0.1".to_string(), + host: "0.0.0.0".to_string(), port: 8080, base_url: "http://localhost:8080".to_string(), }, diff --git a/src/core/directory/api.rs b/src/core/directory/api.rs index cd005fdb..b41c697f 100644 --- a/src/core/directory/api.rs +++ b/src/core/directory/api.rs @@ -84,7 +84,7 @@ pub async fn provision_user_handler( .config .as_ref() .map(|c| c.server.base_url.clone()) - .unwrap_or_else(|| "http://localhost:8080".to_string()); + .unwrap_or_else(|| "http://localhost:8300".to_string()); let provisioning = UserProvisioningService::new(state.conn.clone(), s3_client, base_url); @@ -119,7 +119,7 @@ pub async fn deprovision_user_handler( .config .as_ref() .map(|c| c.server.base_url.clone()) - .unwrap_or_else(|| "http://localhost:8080".to_string()); + .unwrap_or_else(|| "http://localhost:8300".to_string()); let provisioning = UserProvisioningService::new(state.conn.clone(), s3_client, base_url); @@ -275,7 +275,7 @@ pub async fn check_services_status(State(state): State>) -> impl I .build() .unwrap(); - if let Ok(response) = client.get("https://localhost:8080/healthz").send().await { + if let Ok(response) = client.get("https://localhost:8300/healthz").send().await { status.directory = response.status().is_success(); } diff --git a/src/core/directory/mod.rs b/src/core/directory/mod.rs index 3f5ea5ad..bc6b6c95 100644 --- a/src/core/directory/mod.rs +++ b/src/core/directory/mod.rs @@ -22,7 +22,7 @@ pub struct DirectoryConfig { impl Default for DirectoryConfig { fn default() -> Self { Self { - url: "https://localhost:8080".to_string(), + url: "https://localhost:8300".to_string(), admin_token: String::new(), project_id: "default".to_string(), oauth_enabled: true, diff --git a/src/core/oauth/providers.rs b/src/core/oauth/providers.rs index 1ffc2e54..0612a76d 100644 --- a/src/core/oauth/providers.rs +++ b/src/core/oauth/providers.rs @@ -365,7 +365,7 @@ mod tests { OAuthProvider::Google, "test_client_id".to_string(), "test_secret".to_string(), - "http://localhost:8080/callback".to_string(), + "http://localhost:8300/callback".to_string(), ); let url = OAuthProvider::Google.build_auth_url(&config, "test_state"); @@ -389,7 +389,7 @@ mod tests { "my_secret".to_string(), ); - let config = load_oauth_config(OAuthProvider::Google, &bot_config, "http://localhost:8080"); + let config = load_oauth_config(OAuthProvider::Google, &bot_config, "http://localhost:8300"); assert!(config.is_some()); let config = config.unwrap(); @@ -410,7 +410,7 @@ mod tests { "my_secret".to_string(), ); - let config = load_oauth_config(OAuthProvider::Google, &bot_config, "http://localhost:8080"); + let config = load_oauth_config(OAuthProvider::Google, &bot_config, "http://localhost:8300"); assert!(config.is_none()); } diff --git a/src/core/oauth/routes.rs b/src/core/oauth/routes.rs index 41b45897..3be3f486 100644 --- a/src/core/oauth/routes.rs +++ b/src/core/oauth/routes.rs @@ -490,7 +490,7 @@ async fn get_bot_config(state: &AppState) -> HashMap { fn get_base_url(state: &AppState) -> String { // Could read from config, for now use default let _ = state; - "http://localhost:8080".to_string() + "http://localhost:8300".to_string() } /// Create or get existing OAuth user diff --git a/src/core/package_manager/installer.rs b/src/core/package_manager/installer.rs index 8958a92a..48a11ecb 100644 --- a/src/core/package_manager/installer.rs +++ b/src/core/package_manager/installer.rs @@ -465,7 +465,7 @@ impl PackageManager { "directory".to_string(), ComponentConfig { name: "directory".to_string(), - ports: vec![8080], + ports: vec![8300], dependencies: vec!["tables".to_string()], linux_packages: vec![], macos_packages: vec![], @@ -484,7 +484,7 @@ impl PackageManager { // This properly creates the first instance with PAT "ZITADEL_MASTERKEY=MasterkeyNeedsToHave32Characters nohup {{BIN_PATH}}/zitadel start-from-init --config {{CONF_PATH}}/directory/zitadel.yaml --masterkeyFromEnv --tlsMode disabled --steps {{CONF_PATH}}/directory/steps.yaml > {{LOGS_PATH}}/zitadel.log 2>&1 &".to_string(), // Wait for Zitadel to be fully ready (up to 90 seconds for first instance setup) - "for i in $(seq 1 90); do curl -sf http://localhost:8080/debug/ready && break || sleep 1; done".to_string(), + "for i in $(seq 1 90); do curl -sf http://localhost:8300/debug/ready && break || sleep 1; done".to_string(), ], pre_install_cmds_macos: vec![ "mkdir -p {{CONF_PATH}}/directory".to_string(), @@ -495,13 +495,13 @@ impl PackageManager { env_vars: HashMap::from([ ("ZITADEL_EXTERNALSECURE".to_string(), "false".to_string()), ("ZITADEL_EXTERNALDOMAIN".to_string(), "localhost".to_string()), - ("ZITADEL_EXTERNALPORT".to_string(), "8080".to_string()), + ("ZITADEL_EXTERNALPORT".to_string(), "8300".to_string().to_string()), ("ZITADEL_TLS_ENABLED".to_string(), "false".to_string()), ("ZITADEL_MASTERKEY".to_string(), "MasterkeyNeedsToHave32Characters".to_string()), ]), data_download_list: Vec::new(), exec_cmd: "nohup {{BIN_PATH}}/zitadel start --config {{CONF_PATH}}/directory/zitadel.yaml --masterkeyFromEnv --tlsMode disabled > {{LOGS_PATH}}/zitadel.log 2>&1 &".to_string(), - check_cmd: "curl -f http://localhost:8080/healthz >/dev/null 2>&1".to_string(), + check_cmd: "curl -f http://localhost:8300/healthz >/dev/null 2>&1".to_string(), }, ); } @@ -613,7 +613,7 @@ impl PackageManager { ComponentConfig { name: "webmail".to_string(), - ports: vec![8080], + ports: vec![8300], dependencies: vec!["email".to_string()], linux_packages: vec![ "ca-certificates".to_string(), @@ -636,7 +636,7 @@ impl PackageManager { env_vars: HashMap::new(), data_download_list: Vec::new(), exec_cmd: "php -S 0.0.0.0:8080 -t {{DATA_PATH}}/roundcubemail".to_string(), - check_cmd: "curl -f -k https://localhost:8080 >/dev/null 2>&1".to_string(), + check_cmd: "curl -f -k https://localhost:8300 >/dev/null 2>&1".to_string(), }, ); } diff --git a/src/drive/mod.rs b/src/drive/mod.rs index 1f03d144..41d1d4f4 100644 --- a/src/drive/mod.rs +++ b/src/drive/mod.rs @@ -202,8 +202,6 @@ pub fn configure() -> Router> { Router::new() // Basic file operations .route("/files/list", get(list_files)) - // UI-compatible endpoint - .route("/api/drive/list", get(list_drive_files_ui)) .route("/files/read", post(read_file)) .route("/files/write", post(write_file)) .route("/files/save", post(write_file)) @@ -1159,13 +1157,3 @@ pub async fn restore_version( new_version_id, })) } - -// ===== UI-Compatible Endpoints ===== - -/// GET /api/drive/list - List files for UI display -pub async fn list_drive_files_ui(State(_state): State>) -> Json { - Json(serde_json::json!({ - "files": [], - "message": "No files available" - })) -}