From 5d53cd4d2b6be0170ffb0fb23b8da0344914c4c8 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 6 Feb 2025 21:24:35 +0100 Subject: [PATCH] re-enable s3 on agent workers + add DISABLE_S3_STORE env variable --- backend/src/main.rs | 23 +++++++++++++++---- backend/src/monitor.rs | 4 ++-- .../windmill-common/src/global_settings.rs | 7 +++--- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/backend/src/main.rs b/backend/src/main.rs index e3b846bfb2..3a1899c23b 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -374,6 +374,11 @@ async fn windmill_main() -> anyhow::Result<()> { let is_agent = mode == Mode::Agent; + #[cfg(feature = "parquet")] + let disable_s3_store = std::env::var("DISABLE_S3_STORE") + .ok() + .is_some_and(|x| x == "1" || x == "true"); + if !is_agent { let skip_migration = std::env::var("SKIP_MIGRATION") .map(|val| val == "true") @@ -474,7 +479,15 @@ Windmill Community Edition {GIT_VERSION} default_base_internal_url.clone() }; - initial_load(&db, killpill_tx.clone(), worker_mode, server_mode, is_agent).await; + initial_load( + &db, + killpill_tx.clone(), + worker_mode, + server_mode, + #[cfg(feature = "parquet")] + disable_s3_store, + ) + .await; monitor_db( &db, @@ -635,7 +648,7 @@ Windmill Community Edition {GIT_VERSION} killpill_tx.clone(), num_workers, base_internal_url.clone(), - mode.clone() == Mode::Agent, + is_agent, hostname.clone(), ) .await?; @@ -757,8 +770,10 @@ Windmill Community Edition {GIT_VERSION} reload_job_default_timeout_setting(&db).await }, #[cfg(feature = "parquet")] - OBJECT_STORE_CACHE_CONFIG_SETTING if !is_agent => { - reload_s3_cache_setting(&db).await + OBJECT_STORE_CACHE_CONFIG_SETTING => { + if !disable_s3_store { + reload_s3_cache_setting(&db).await + } }, SCIM_TOKEN_SETTING => { reload_scim_token_setting(&db).await diff --git a/backend/src/monitor.rs b/backend/src/monitor.rs index 5353d6fbf5..cb57d94622 100644 --- a/backend/src/monitor.rs +++ b/backend/src/monitor.rs @@ -136,7 +136,7 @@ pub async fn initial_load( tx: tokio::sync::broadcast::Sender<()>, worker_mode: bool, server_mode: bool, - _is_agent: bool, + #[cfg(feature = "parquet")] disable_s3_store: bool, ) { if let Err(e) = load_metrics_enabled(db).await { tracing::error!("Error loading expose metrics: {e:#}"); @@ -180,7 +180,7 @@ pub async fn initial_load( } #[cfg(feature = "parquet")] - if !_is_agent { + if !disable_s3_store { reload_s3_cache_setting(&db).await; } diff --git a/backend/windmill-common/src/global_settings.rs b/backend/windmill-common/src/global_settings.rs index 3829826da6..31d8214e0c 100644 --- a/backend/windmill-common/src/global_settings.rs +++ b/backend/windmill-common/src/global_settings.rs @@ -40,7 +40,7 @@ pub const JWT_SECRET_SETTING: &str = "jwt_secret"; pub const EMAIL_DOMAIN_SETTING: &str = "email_domain"; pub const OTEL_SETTING: &str = "otel"; -pub const ENV_SETTINGS: [&str; 55] = [ +pub const ENV_SETTINGS: [&str; 56] = [ "DISABLE_NSJAIL", "MODE", "NUM_WORKERS", @@ -96,11 +96,12 @@ pub const ENV_SETTINGS: [&str; 55] = [ "OTEL_METRICS", "OTEL_TRACING", "OTEL_LOGS", + "DISABLE_S3_STORE", ]; use crate::error; -use sqlx::Pool; use sqlx::postgres::Postgres; +use sqlx::Pool; pub async fn load_value_from_global_settings( db: &Pool, @@ -114,4 +115,4 @@ pub async fn load_value_from_global_settings( .await? .map(|x| x.value); Ok(r) -} \ No newline at end of file +}