diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 0ed1c2b0e5..39d036d991 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -51,6 +51,7 @@ lto = "thin" default = [] agent_worker_server = ["windmill-api/agent_worker_server"] enterprise = ["windmill-worker/enterprise", "windmill-queue/enterprise", "windmill-api/enterprise", "dep:windmill-autoscaling", "windmill-autoscaling/enterprise", "windmill-git-sync/enterprise", "windmill-common/prometheus", "windmill-common/enterprise"] +private = ["windmill-worker/private", "windmill-queue/private", "windmill-api/private", "windmill-autoscaling/private", "windmill-git-sync/private", "windmill-common/private", "windmill-audit/private", "windmill-indexer/private"] enterprise_saml = ["windmill-api/enterprise_saml", "oauth2"] stripe = ["windmill-api/stripe"] benchmark = ["windmill-api/benchmark", "windmill-worker/benchmark", "windmill-queue/benchmark", "windmill-common/benchmark"] diff --git a/backend/windmill-api/Cargo.toml b/backend/windmill-api/Cargo.toml index 233fbeec54..12e6dbd9f2 100644 --- a/backend/windmill-api/Cargo.toml +++ b/backend/windmill-api/Cargo.toml @@ -11,6 +11,7 @@ path = "src/lib.rs" [features] default = [] enterprise = ["windmill-queue/enterprise", "windmill-audit/enterprise", "windmill-git-sync/enterprise", "windmill-common/enterprise", "windmill-worker/enterprise"] +private = ["windmill-queue/private", "windmill-audit/private", "windmill-git-sync/private", "windmill-common/private", "windmill-worker/private"] stripe = [] agent_worker_server = [] enterprise_saml = ["dep:samael", "dep:libxml"] diff --git a/backend/windmill-api/src/lib.rs b/backend/windmill-api/src/lib.rs index d79639f0ab..bb29b470ae 100644 --- a/backend/windmill-api/src/lib.rs +++ b/backend/windmill-api/src/lib.rs @@ -11,12 +11,18 @@ use crate::db::ApiAuthed; use crate::ee::ExternalJwks; #[cfg(feature = "embedding")] use crate::embeddings::load_embeddings_db; -#[cfg(feature = "oauth2")] +#[cfg(all(feature = "oauth2", feature = "private"))] use crate::oauth2_ee::AllClients; -#[cfg(feature = "oauth2")] +#[cfg(all(feature = "oauth2", feature = "private"))] use crate::oauth2_ee::SlackVerifier; -#[cfg(feature = "smtp")] +#[cfg(all(feature = "oauth2", not(feature = "private")))] +use crate::oauth2_oss::AllClients; +#[cfg(all(feature = "oauth2", not(feature = "private")))] +use crate::oauth2_oss::SlackVerifier; +#[cfg(all(feature = "smtp", feature = "private"))] use crate::smtp_server_ee::SmtpServer; +#[cfg(all(feature = "smtp", not(feature = "private")))] +use crate::smtp_server_oss::SmtpServer; #[cfg(feature = "mcp")] use crate::mcp::{setup_mcp_server, Runner as McpRunner}; @@ -27,8 +33,10 @@ use crate::{ webhook_util::WebhookShared, }; -#[cfg(feature = "agent_worker_server")] +#[cfg(all(feature = "agent_worker_server", feature = "private"))] use agent_workers_ee::AgentCache; +#[cfg(all(feature = "agent_worker_server", not(feature = "private")))] +use agent_workers_oss::AgentCache; use anyhow::Context; use argon2::Argon2; @@ -58,11 +66,16 @@ use windmill_common::db::UserDB; use windmill_common::worker::CLOUD_HOSTED; use windmill_common::{utils::GIT_VERSION, BASE_URL, INSTANCE_NAME}; +#[cfg(feature = "private")] use crate::scim_ee::has_scim_token; +#[cfg(not(feature = "private"))] +use crate::scim_oss::has_scim_token; use windmill_common::error::AppError; -#[cfg(feature = "agent_worker_server")] +#[cfg(all(feature = "agent_worker_server", feature = "private"))] mod agent_workers_ee; +#[cfg(all(feature = "agent_worker_server", not(feature = "private")))] +mod agent_workers_oss; mod ai; mod apps; pub mod args; @@ -86,55 +99,99 @@ mod http_trigger_args; mod http_trigger_auth; #[cfg(feature = "http_trigger")] pub mod http_triggers; +#[cfg(feature = "private")] mod indexer_ee; +#[cfg(not(feature = "private"))] +mod indexer_oss; mod inputs; mod integration; #[cfg(feature = "postgres_trigger")] mod postgres_triggers; mod approvals; -#[cfg(feature = "enterprise")] +#[cfg(all(feature = "enterprise", feature = "private"))] mod apps_ee; -#[cfg(all(feature = "enterprise", feature = "gcp_trigger"))] +#[cfg(all(feature = "enterprise", not(feature = "private")))] +mod apps_oss; +#[cfg(all(feature = "enterprise", feature = "gcp_trigger", feature = "private"))] mod gcp_triggers_ee; -#[cfg(feature = "enterprise")] +#[cfg(all(feature = "enterprise", feature = "gcp_trigger", not(feature = "private")))] +mod gcp_triggers_oss; +#[cfg(all(feature = "enterprise", feature = "private"))] mod git_sync_ee; -#[cfg(feature = "parquet")] +#[cfg(all(feature = "enterprise", not(feature = "private")))] +mod git_sync_oss; +#[cfg(all(feature = "parquet", feature = "private"))] mod job_helpers_ee; +#[cfg(all(feature = "parquet", not(feature = "private")))] +mod job_helpers_oss; pub mod job_metrics; pub mod jobs; -#[cfg(all(feature = "enterprise", feature = "kafka"))] +#[cfg(all(feature = "enterprise", feature = "kafka", feature = "private"))] mod kafka_triggers_ee; +#[cfg(all(feature = "enterprise", feature = "kafka", not(feature = "private")))] +mod kafka_triggers_oss; #[cfg(feature = "mqtt_trigger")] mod mqtt_triggers; -#[cfg(all(feature = "enterprise", feature = "nats"))] +#[cfg(all(feature = "enterprise", feature = "nats", feature = "private"))] mod nats_triggers_ee; -#[cfg(feature = "oauth2")] +#[cfg(all(feature = "enterprise", feature = "nats", not(feature = "private")))] +mod nats_triggers_oss; +#[cfg(all(feature = "oauth2", feature = "private"))] pub mod oauth2_ee; +#[cfg(all(feature = "oauth2", not(feature = "private")))] +pub mod oauth2_oss; +#[cfg(feature = "private")] mod oidc_ee; +#[cfg(not(feature = "private"))] +mod oidc_oss; mod raw_apps; mod resources; +#[cfg(feature = "private")] mod saml_ee; +#[cfg(not(feature = "private"))] +mod saml_oss; mod schedule; +#[cfg(feature = "private")] mod scim_ee; +#[cfg(not(feature = "private"))] +mod scim_oss; mod scripts; mod service_logs; mod settings; mod slack_approvals; -#[cfg(feature = "smtp")] +#[cfg(all(feature = "smtp", feature = "private"))] mod smtp_server_ee; -#[cfg(all(feature = "enterprise", feature = "sqs_trigger"))] +#[cfg(all(feature = "smtp", not(feature = "private")))] +mod smtp_server_oss; +#[cfg(all(feature = "enterprise", feature = "sqs_trigger", feature = "private"))] mod sqs_triggers_ee; +#[cfg(all(feature = "enterprise", feature = "sqs_trigger", not(feature = "private")))] +mod sqs_triggers_oss; +#[cfg(feature = "private")] mod teams_approvals_ee; +#[cfg(not(feature = "private"))] +mod teams_approvals_oss; mod trigger_helpers; mod static_assets; -#[cfg(all(feature = "stripe", feature = "enterprise"))] +#[cfg(all(feature = "stripe", feature = "enterprise", feature = "private"))] mod stripe_ee; +#[cfg(all(feature = "stripe", feature = "enterprise", not(feature = "private")))] +mod stripe_oss; +#[cfg(feature = "private")] mod teams_ee; +#[cfg(not(feature = "private"))] +mod teams_oss; mod tracing_init; mod triggers; mod users; +mod users_oss; + +#[cfg(feature = "private")] +pub use users_ee::*; +#[cfg(not(feature = "private"))] +pub use users_oss::*; mod users_ee; mod utils; mod variables; @@ -143,6 +200,12 @@ pub mod webhook_util; mod websocket_triggers; mod workers; mod workspaces; +mod workspaces_oss; + +#[cfg(feature = "private")] +pub use workspaces_ee::*; +#[cfg(not(feature = "private"))] +pub use workspaces_oss::*; mod workspaces_ee; mod workspaces_export; mod workspaces_extra; @@ -278,7 +341,10 @@ pub async fn run_server( .allow_headers([http::header::CONTENT_TYPE, http::header::AUTHORIZATION]) .allow_origin(Any); - let sp_extension = Arc::new(saml_ee::build_sp_extension().await?); + #[cfg(feature = "private")] +let sp_extension = Arc::new(saml_ee::build_sp_extension().await?); +#[cfg(not(feature = "private"))] +let sp_extension = Arc::new(saml_oss::build_sp_extension().await?); if server_mode { #[cfg(feature = "embedding")] @@ -600,10 +666,15 @@ pub async fn run_server( .nest("/concurrency_groups", concurrency_groups::global_service()) .nest("/scripts_u", scripts::global_unauthed_service()) .nest("/apps_u", { - #[cfg(feature = "enterprise")] + #[cfg(all(feature = "enterprise", feature = "private"))] { apps_ee::global_unauthed_service() } + + #[cfg(all(feature = "enterprise", not(feature = "private")))] + { + apps_oss::global_unauthed_service() + } #[cfg(not(feature = "enterprise"))] { @@ -644,10 +715,15 @@ pub async fn run_server( ) .route("/slack", post(slack_approvals::slack_app_callback_handler)) .nest("/teams", { - #[cfg(feature = "enterprise")] + #[cfg(all(feature = "enterprise", feature = "private"))] { teams_ee::teams_service() } + + #[cfg(all(feature = "enterprise", not(feature = "private")))] + { + teams_oss::teams_service() + } #[cfg(not(feature = "enterprise"))] { @@ -660,22 +736,41 @@ pub async fn run_server( ) .route( "/w/:workspace_id/jobs/teams_approval/:job_id", - get(teams_approvals_ee::request_teams_approval), + get({ + #[cfg(feature = "private")] + { + teams_approvals_ee::request_teams_approval + } + #[cfg(not(feature = "private"))] + { + teams_approvals_oss::request_teams_approval + } + }), ) .nest("/w/:workspace_id/github_app", { - #[cfg(feature = "enterprise")] + #[cfg(all(feature = "enterprise", feature = "private"))] { git_sync_ee::workspaced_service() } + + #[cfg(all(feature = "enterprise", not(feature = "private")))] + { + git_sync_oss::workspaced_service() + } #[cfg(not(feature = "enterprise"))] Router::new() }) .nest("/github_app", { - #[cfg(feature = "enterprise")] + #[cfg(all(feature = "enterprise", feature = "private"))] { git_sync_ee::global_service() } + + #[cfg(all(feature = "enterprise", not(feature = "private")))] + { + git_sync_oss::global_service() + } #[cfg(not(feature = "enterprise"))] Router::new() diff --git a/backend/windmill-api/src/users_oss.rs b/backend/windmill-api/src/users_oss.rs new file mode 100644 index 0000000000..d5b03d3d21 --- /dev/null +++ b/backend/windmill-api/src/users_oss.rs @@ -0,0 +1,41 @@ +use std::sync::Arc; + +use crate::db::ApiAuthed; + +use crate::users::{EditPassword, NewUser}; +use crate::{db::DB, webhook_util::WebhookShared}; +use argon2::Argon2; + +use http::StatusCode; + +use windmill_common::error::{Error, Result}; + +pub async fn create_user( + _authed: ApiAuthed, + _db: DB, + _webhook: WebhookShared, + _argon2: Arc>, + mut _nu: NewUser, +) -> Result<(StatusCode, String)> { + Err(Error::internal_err( + "Not implemented in Windmill's Open Source repository".to_string(), + )) +} + +pub async fn set_password( + _db: DB, + _argon2: Arc>, + _authed: ApiAuthed, + _user_email: &str, + _ep: EditPassword, +) -> Result { + Err(Error::internal_err( + "Not implemented in Windmill's Open Source repository".to_string(), + )) +} + +pub fn send_email_if_possible(_subject: &str, _content: &str, _to: &str) { + tracing::warn!( + "send_email_if_possible is not implemented in Windmill's Open Source repository" + ); +} \ No newline at end of file diff --git a/backend/windmill-api/src/workspaces_oss.rs b/backend/windmill-api/src/workspaces_oss.rs new file mode 100644 index 0000000000..f1d06fc27c --- /dev/null +++ b/backend/windmill-api/src/workspaces_oss.rs @@ -0,0 +1,15 @@ +use crate::{ + db::{ApiAuthed, DB}, + workspaces::EditAutoInvite, +}; + +pub async fn edit_auto_invite( + _authed: ApiAuthed, + _db: DB, + _w_id: String, + _ea: EditAutoInvite, +) -> windmill_common::error::Result { + Err(windmill_common::error::Error::internal_err( + "Not implemented on OSS".to_string(), + )) +} \ No newline at end of file diff --git a/backend/windmill-audit/Cargo.toml b/backend/windmill-audit/Cargo.toml index 8b202b4abf..89b3fd8106 100644 --- a/backend/windmill-audit/Cargo.toml +++ b/backend/windmill-audit/Cargo.toml @@ -10,6 +10,7 @@ path = "./src/lib.rs" [features] enterprise = ["windmill-common/enterprise"] +private = ["windmill-common/private"] [dependencies] serde.workspace = true diff --git a/backend/windmill-audit/src/audit_oss.rs b/backend/windmill-audit/src/audit_oss.rs new file mode 100644 index 0000000000..c994df98f2 --- /dev/null +++ b/backend/windmill-audit/src/audit_oss.rs @@ -0,0 +1,75 @@ +/* + * Author: Ruben Fiszel + * Copyright: Windmill Labs, Inc 2022 + * This file and its contents are licensed under the AGPLv3 License. + * Please see the included NOTICE for copyright information and + * LICENSE-AGPL for a copy of the license. + */ +use std::collections::HashMap; + +use windmill_common::{ + error::{Error, Result}, + utils::Pagination, +}; + +use crate::{ActionKind, AuditLog, ListAuditLogQuery}; +use sqlx::{Postgres, Transaction}; + +#[derive(Clone)] +pub struct AuditAuthor { + pub username: String, + pub email: String, + pub username_override: Option, +} + +impl AuditAuthorable for AuditAuthor { + fn email(&self) -> &str { + &self.email + } + + fn username(&self) -> &str { + &self.username + } + + fn username_override(&self) -> Option<&str> { + self.username_override.as_deref() + } +} + +pub trait AuditAuthorable { + fn username(&self) -> &str; + fn email(&self) -> &str; + fn username_override(&self) -> Option<&str>; +} + +#[tracing::instrument(level = "trace", skip_all)] +pub async fn audit_log<'c, E: sqlx::Executor<'c, Database = Postgres>>( + _db: E, + _author: &impl AuditAuthorable, + mut _operation: &str, + _action_kind: ActionKind, + _w_id: &str, + mut _resource: Option<&str>, + _parameters: Option>, +) -> Result<()> { + // Implementation is not open source as Audit logs is a Windmill Enterprise Edition feature + Ok(()) +} + +pub async fn list_audit( + _tx: Transaction<'_, Postgres>, + _w_id: String, + _pagination: Pagination, + _lq: ListAuditLogQuery, +) -> Result> { + // Implementation is not open source as Audit logs is a Windmill Enterprise Edition feature + return Ok(vec![]); +} + +pub async fn get_audit(tx: Transaction<'_, Postgres>, _id: i32, _w_id: &str) -> Result { + // Implementation is not open source as Audit logs is a Windmill Enterprise Edition feature + tx.commit().await?; + Err(Error::NotFound( + "Audit log not not available in Windmill Community edition".to_string(), + )) +} \ No newline at end of file diff --git a/backend/windmill-audit/src/lib.rs b/backend/windmill-audit/src/lib.rs index 10894798fb..8b994c9e4e 100644 --- a/backend/windmill-audit/src/lib.rs +++ b/backend/windmill-audit/src/lib.rs @@ -1,8 +1,14 @@ use serde::{Deserialize, Serialize}; use sqlx::FromRow; +pub mod audit_oss; pub mod audit_ee; +#[cfg(feature = "private")] +pub use audit_ee::*; +#[cfg(not(feature = "private"))] +pub use audit_oss::*; + #[derive(sqlx::Type, Serialize, Deserialize, Debug)] #[sqlx(type_name = "ACTION_KIND", rename_all = "lowercase")] pub enum ActionKind { diff --git a/backend/windmill-autoscaling/Cargo.toml b/backend/windmill-autoscaling/Cargo.toml index fbebaf0fd7..7fff3652e7 100644 --- a/backend/windmill-autoscaling/Cargo.toml +++ b/backend/windmill-autoscaling/Cargo.toml @@ -10,6 +10,7 @@ path = "./src/lib.rs" [features] enterprise = ["windmill-queue/enterprise", "windmill-common/enterprise"] +private = ["windmill-queue/private", "windmill-common/private"] default = [] [dependencies] diff --git a/backend/windmill-common/Cargo.toml b/backend/windmill-common/Cargo.toml index d3f7ed4c00..4e7ca9ca33 100644 --- a/backend/windmill-common/Cargo.toml +++ b/backend/windmill-common/Cargo.toml @@ -7,6 +7,7 @@ edition.workspace = true [features] default = [] enterprise = [] +private = [] jemalloc = ["dep:tikv-jemalloc-ctl"] tantivy = [] prometheus = ["dep:prometheus"] diff --git a/backend/windmill-common/src/email_oss.rs b/backend/windmill-common/src/email_oss.rs new file mode 100644 index 0000000000..c30c684ba1 --- /dev/null +++ b/backend/windmill-common/src/email_oss.rs @@ -0,0 +1,11 @@ +use crate::server::Smtp; + +pub async fn send_email( + _subject: &str, + _content: &str, + _to: Vec, + _smtp: Smtp, + _client_timeout: Option, +) -> crate::error::Result<()> { + Ok(()) +} \ No newline at end of file diff --git a/backend/windmill-common/src/job_s3_helpers_oss.rs b/backend/windmill-common/src/job_s3_helpers_oss.rs new file mode 100644 index 0000000000..28ff1c8754 --- /dev/null +++ b/backend/windmill-common/src/job_s3_helpers_oss.rs @@ -0,0 +1,18 @@ +use std::future::Future; + +use crate::{ + error::Error, + s3_helpers::{ObjectStoreResource, StorageResourceType}, +}; + +pub async fn get_s3_resource_internal<'c, F, Fut>( + _resource_type: StorageResourceType, + _s3_resource_value_raw: serde_json::Value, + _gen_token: F, +) -> crate::error::Result +where + F: FnOnce(String) -> Fut, + Fut: Future> + Send + 'static, +{ + todo!() +} \ No newline at end of file diff --git a/backend/windmill-common/src/lib.rs b/backend/windmill-common/src/lib.rs index e1c2f4aa15..9484d263c1 100644 --- a/backend/windmill-common/src/lib.rs +++ b/backend/windmill-common/src/lib.rs @@ -33,6 +33,12 @@ pub mod cache; pub mod db; pub mod ee; pub mod email_ee; +pub mod email_oss; + +#[cfg(feature = "private")] +pub use email_ee::*; +#[cfg(not(feature = "private"))] +pub use email_oss::*; pub mod error; pub mod external_ip; pub mod flow_status; @@ -42,12 +48,25 @@ pub mod indexer; pub mod job_metrics; #[cfg(feature = "parquet")] pub mod job_s3_helpers_ee; +#[cfg(feature = "parquet")] +pub mod job_s3_helpers_oss; + +#[cfg(all(feature = "parquet", feature = "private"))] +pub use job_s3_helpers_ee::*; +#[cfg(all(feature = "parquet", not(feature = "private")))] +pub use job_s3_helpers_oss::*; pub mod jobs; pub mod jwt; pub mod more_serde; pub mod oauth2; pub mod otel_ee; +pub mod otel_oss; + +#[cfg(feature = "private")] +pub use otel_ee::*; +#[cfg(not(feature = "private"))] +pub use otel_oss::*; pub mod queue; pub mod s3_helpers; pub mod schedule; @@ -55,7 +74,19 @@ pub mod schema; pub mod scripts; pub mod server; pub mod stats_ee; +pub mod stats_oss; pub mod teams_ee; +pub mod teams_oss; + +#[cfg(feature = "private")] +pub use stats_ee::*; +#[cfg(not(feature = "private"))] +pub use stats_oss::*; + +#[cfg(feature = "private")] +pub use teams_ee::*; +#[cfg(not(feature = "private"))] +pub use teams_oss::*; pub mod tracing_init; pub mod users; pub mod utils; diff --git a/backend/windmill-common/src/otel_oss.rs b/backend/windmill-common/src/otel_oss.rs new file mode 100644 index 0000000000..1da3f56f8c --- /dev/null +++ b/backend/windmill-common/src/otel_oss.rs @@ -0,0 +1,58 @@ +/* + * Author: Ruben Fiszel + * Copyright: Windmill Labs, Inc 2022 + * This file and its contents are licensed under the AGPLv3 License. + * Please see the included NOTICE for copyright information and + * LICENSE-AGPL for a copy of the license. + */ + +use crate::{jobs::QueuedJob, utils::Mode}; +use uuid::Uuid; + +pub fn set_span_parent(_span: &tracing::Span, _rj: &Uuid) {} + +#[cfg(not(all(feature = "otel", feature = "enterprise")))] +pub(crate) type OtelProvider = Option<()>; + +#[cfg(all(feature = "otel", feature = "enterprise"))] +pub(crate) type OtelProvider = Option; + +#[cfg(not(feature = "otel"))] +pub fn otel_ctx() -> () {} + +#[cfg(feature = "otel")] +#[inline(always)] +pub fn otel_ctx() -> opentelemetry::Context { + opentelemetry::Context::current() +} + +#[cfg(not(feature = "otel"))] +impl FutureExt for T {} + +#[cfg(not(feature = "otel"))] +pub trait FutureExt: Sized { + fn with_context(self, _otel_cx: ()) -> Self { + self + } +} + +use tracing_subscriber::EnvFilter; + +pub(crate) fn init_logs_bridge(_mode: &Mode, _hostname: &str, _env: &str) -> Option { + None +} + +#[cfg(all(feature = "otel", feature = "enterprise"))] +pub(crate) fn init_otlp_tracer( + _mode: &Mode, + _hostname: &str, + _env: &str, +) -> Option { + None +} + +pub(crate) fn init_meter_provider(_mode: &Mode, _hostname: &str, _env: &str) -> OtelProvider { + None +} + +pub fn add_root_flow_job_to_otlp(_queued_job: &QueuedJob, _success: bool) {} \ No newline at end of file diff --git a/backend/windmill-common/src/stats_oss.rs b/backend/windmill-common/src/stats_oss.rs new file mode 100644 index 0000000000..2a841f00a8 --- /dev/null +++ b/backend/windmill-common/src/stats_oss.rs @@ -0,0 +1,47 @@ +use sqlx::Postgres; + +use crate::{error::Result, scripts::ScriptLang, DB}; + +pub async fn get_disable_stats_setting(_db: &DB) -> bool { + // stats details are closed source + + false +} + +pub async fn schedule_stats(_db: &DB, _http_client: &reqwest::Client) -> () { + // stats details are closed source +} + +#[derive(Debug, sqlx::FromRow, serde::Serialize)] +struct JobsUsage { + language: Option, + total_duration: i64, + count: i64, +} + +pub enum SendStatsReason { + Manual, + Schedule, + OnStart, +} + +pub async fn send_stats( + _http_client: &reqwest::Client, + _db: &DB, + _reason: SendStatsReason, +) -> Result<()> { + // stats details are closed source + Ok(()) +} + +pub struct ActiveUserUsage { + pub author_count: Option, + pub operator_count: Option, +} + +pub async fn get_user_usage<'c, E: sqlx::Executor<'c, Database = Postgres>>( + _db: E, +) -> Result { + let usage = ActiveUserUsage { author_count: None, operator_count: None }; + Ok(usage) +} \ No newline at end of file diff --git a/backend/windmill-common/src/teams_oss.rs b/backend/windmill-common/src/teams_oss.rs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/backend/windmill-git-sync/Cargo.toml b/backend/windmill-git-sync/Cargo.toml index d5a8412fae..25c9a06b45 100644 --- a/backend/windmill-git-sync/Cargo.toml +++ b/backend/windmill-git-sync/Cargo.toml @@ -10,6 +10,7 @@ path = "./src/lib.rs" [features] enterprise = ["windmill-queue/enterprise", "windmill-common/enterprise"] +private = ["windmill-queue/private", "windmill-common/private"] default = [] [dependencies] diff --git a/backend/windmill-git-sync/src/git_sync_oss.rs b/backend/windmill-git-sync/src/git_sync_oss.rs new file mode 100644 index 0000000000..8c1a8cf057 --- /dev/null +++ b/backend/windmill-git-sync/src/git_sync_oss.rs @@ -0,0 +1,16 @@ +use windmill_common::error::Result; + +use crate::{DeployedObject, DB}; + +pub async fn handle_deployment_metadata<'c>( + _email: &str, + _created_by: &str, + _db: &DB, + _w_id: &str, + _obj: DeployedObject, + _deployment_message: Option, + _skip_db_insert: bool, +) -> Result<()> { + // Git sync is an enterprise feature and not part of the open-source version + return Ok(()); +} \ No newline at end of file diff --git a/backend/windmill-git-sync/src/lib.rs b/backend/windmill-git-sync/src/lib.rs index f1e0ed6ee3..7b3b1faa36 100644 --- a/backend/windmill-git-sync/src/lib.rs +++ b/backend/windmill-git-sync/src/lib.rs @@ -11,8 +11,12 @@ use sqlx::{Pool, Postgres}; use windmill_common::scripts::ScriptHash; pub mod git_sync_ee; +pub mod git_sync_oss; +#[cfg(feature = "private")] pub use git_sync_ee::handle_deployment_metadata; +#[cfg(not(feature = "private"))] +pub use git_sync_oss::handle_deployment_metadata; pub type DB = Pool; #[derive(Clone, Debug)] diff --git a/backend/windmill-indexer/Cargo.toml b/backend/windmill-indexer/Cargo.toml index 14ab53beef..62c676b8bf 100644 --- a/backend/windmill-indexer/Cargo.toml +++ b/backend/windmill-indexer/Cargo.toml @@ -12,6 +12,7 @@ path = "src/lib.rs" default = [] parquet = ["dep:object_store"] enterprise = [] +private = ["windmill-common/private"] [dependencies] windmill-common.workspace = true diff --git a/backend/windmill-indexer/src/completed_runs_oss.rs b/backend/windmill-indexer/src/completed_runs_oss.rs new file mode 100644 index 0000000000..06296264dd --- /dev/null +++ b/backend/windmill-indexer/src/completed_runs_oss.rs @@ -0,0 +1,22 @@ +use anyhow::anyhow; +use sqlx::{Pool, Postgres}; +use windmill_common::error::Error; + +#[derive(Clone)] +pub struct IndexReader; + +#[derive(Clone)] +pub struct IndexWriter; + +pub async fn init_index(_db: &Pool) -> Result<(IndexReader, IndexWriter), Error> { + Err(anyhow!("Cannot initialize index: not in EE").into()) +} + +pub async fn run_indexer( + _db: Pool, + mut _index_writer: IndexWriter, + mut _killpill_rx: tokio::sync::broadcast::Receiver<()>, +) -> Result<(), Error> { + tracing::error!("Cannot run indexer: not in EE"); + Err(anyhow!("Cannot run indexer: not in EE").into()) +} \ No newline at end of file diff --git a/backend/windmill-indexer/src/indexer_oss.rs b/backend/windmill-indexer/src/indexer_oss.rs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/backend/windmill-indexer/src/lib.rs b/backend/windmill-indexer/src/lib.rs index 59c6a627f7..34ea5e17cd 100644 --- a/backend/windmill-indexer/src/lib.rs +++ b/backend/windmill-indexer/src/lib.rs @@ -1,3 +1,21 @@ pub mod completed_runs_ee; +pub mod completed_runs_oss; pub mod indexer_ee; +pub mod indexer_oss; pub mod service_logs_ee; +pub mod service_logs_oss; + +#[cfg(feature = "private")] +pub use completed_runs_ee::*; +#[cfg(not(feature = "private"))] +pub use completed_runs_oss::*; + +#[cfg(feature = "private")] +pub use indexer_ee::*; +#[cfg(not(feature = "private"))] +pub use indexer_oss::*; + +#[cfg(feature = "private")] +pub use service_logs_ee::*; +#[cfg(not(feature = "private"))] +pub use service_logs_oss::*; diff --git a/backend/windmill-indexer/src/service_logs_oss.rs b/backend/windmill-indexer/src/service_logs_oss.rs new file mode 100644 index 0000000000..f18f9a991f --- /dev/null +++ b/backend/windmill-indexer/src/service_logs_oss.rs @@ -0,0 +1,25 @@ +use anyhow::anyhow; +use sqlx::{Pool, Postgres}; +use windmill_common::error::Error; +use windmill_common::KillpillSender; +#[derive(Clone)] +pub struct ServiceLogIndexReader; + +#[derive(Clone)] +pub struct ServiceLogIndexWriter; + +pub async fn init_index( + _db: &Pool, + mut _killpill_tx: KillpillSender, +) -> Result<(ServiceLogIndexReader, ServiceLogIndexWriter), Error> { + Err(anyhow!("Cannot initialize index: not in EE").into()) +} + +pub async fn run_indexer( + _db: Pool, + mut _index_writer: ServiceLogIndexWriter, + mut _killpill_rx: tokio::sync::broadcast::Receiver<()>, +) -> Result<(), Error> { + tracing::error!("Cannot run indexer: not in EE"); + Err(anyhow!("Cannot run indexer: not in EE").into()) +} \ No newline at end of file diff --git a/backend/windmill-queue/Cargo.toml b/backend/windmill-queue/Cargo.toml index a90fa6ccf7..73a3f2065e 100644 --- a/backend/windmill-queue/Cargo.toml +++ b/backend/windmill-queue/Cargo.toml @@ -11,6 +11,7 @@ path = "src/lib.rs" [features] default = [] enterprise = ["windmill-common/enterprise"] +private = ["windmill-common/private"] cloud = [] benchmark = ["windmill-common/benchmark"] prometheus = ["dep:prometheus"] diff --git a/backend/windmill-queue/src/jobs_oss.rs b/backend/windmill-queue/src/jobs_oss.rs new file mode 100644 index 0000000000..1fb4991b3a --- /dev/null +++ b/backend/windmill-queue/src/jobs_oss.rs @@ -0,0 +1,16 @@ +use chrono::{DateTime, Utc}; +use uuid::Uuid; +use windmill_common::DB; + +#[allow(dead_code)] +pub(crate) async fn update_concurrency_counter( + _db: &DB, + _job_id: &Uuid, + _job_concurrency_key: String, + _jobs_uuids_init_json_value: serde_json::Value, + _pulled_job_id: String, + _job_custom_concurrency_time_window_s: i32, + _limit: i32, +) -> anyhow::Result<(bool, Option>)> { + Ok((true, None)) +} \ No newline at end of file diff --git a/backend/windmill-queue/src/lib.rs b/backend/windmill-queue/src/lib.rs index 2496bdf818..190267debb 100644 --- a/backend/windmill-queue/src/lib.rs +++ b/backend/windmill-queue/src/lib.rs @@ -8,7 +8,14 @@ mod jobs; pub mod jobs_ee; +pub mod jobs_oss; pub mod schedule; + +#[cfg(feature = "private")] +pub use jobs_ee::*; +#[cfg(not(feature = "private"))] +pub use jobs_oss::*; + pub use jobs::*; pub mod flow_status; pub mod tags; diff --git a/backend/windmill-worker/Cargo.toml b/backend/windmill-worker/Cargo.toml index c37e78d7cf..6f166920d2 100644 --- a/backend/windmill-worker/Cargo.toml +++ b/backend/windmill-worker/Cargo.toml @@ -12,6 +12,7 @@ path = "src/lib.rs" default = [] prometheus = ["dep:prometheus", "windmill-common/prometheus"] enterprise = ["windmill-queue/enterprise", "windmill-git-sync/enterprise", "windmill-common/enterprise", "dep:pem", "dep:tokio-util"] +private = ["windmill-queue/private", "windmill-git-sync/private", "windmill-common/private"] mssql = ["dep:tiberius"] bigquery = ["dep:gcp_auth"] benchmark = ["windmill-queue/benchmark", "windmill-common/benchmark"] diff --git a/backend/windmill-worker/src/job_logger_oss.rs b/backend/windmill-worker/src/job_logger_oss.rs new file mode 100644 index 0000000000..88af0d95e8 --- /dev/null +++ b/backend/windmill-worker/src/job_logger_oss.rs @@ -0,0 +1,41 @@ +use std::io; +use std::sync::atomic::AtomicU32; +use std::sync::Arc; + +use uuid::Uuid; +use windmill_common::DB; + +use crate::job_logger::CompactLogs; + +#[cfg(all(feature = "enterprise", feature = "parquet"))] +pub(crate) async fn s3_storage( + _job_id: &Uuid, + _w_id: &str, + _db: &sqlx::Pool, + _logs: &str, + _total_size: Arc, + _worker_name: &str, +) { + tracing::info!("Logs length of {_job_id} has exceeded a threshold. Implementation to store excess on s3 in not OSS"); +} + +#[allow(dead_code)] +pub(crate) async fn default_disk_log_storage( + job_id: &Uuid, + _w_id: &str, + _db: &DB, + _logs: &str, + _total_size: Arc, + _compact_kind: CompactLogs, + _worker_name: &str, +) { + tracing::info!("Logs length of {job_id} has exceeded a threshold. Implementation to store excess on disk in not OSS"); +} + +pub(crate) fn process_streaming_log_lines( + r: Result, io::Error>, + _stderr: bool, + _job_id: &Uuid, +) -> Option> { + r.transpose() +} \ No newline at end of file diff --git a/backend/windmill-worker/src/lib.rs b/backend/windmill-worker/src/lib.rs index 64a9cf2c88..ca44f8ec4f 100644 --- a/backend/windmill-worker/src/lib.rs +++ b/backend/windmill-worker/src/lib.rs @@ -26,6 +26,12 @@ mod graphql_executor; mod handle_child; pub mod job_logger; mod job_logger_ee; +mod job_logger_oss; + +#[cfg(feature = "private")] +pub use job_logger_ee::*; +#[cfg(not(feature = "private"))] +pub use job_logger_oss::*; mod js_eval; #[cfg(feature = "mysql")] mod mysql_executor; @@ -34,6 +40,12 @@ mod nu_executor; #[cfg(feature = "oracledb")] mod oracledb_executor; mod otel_ee; +mod otel_oss; + +#[cfg(feature = "private")] +pub use otel_ee::*; +#[cfg(not(feature = "private"))] +pub use otel_oss::*; mod pg_executor; #[cfg(feature = "php")] mod php_executor; diff --git a/backend/windmill-worker/src/otel_oss.rs b/backend/windmill-worker/src/otel_oss.rs new file mode 100644 index 0000000000..ef065398db --- /dev/null +++ b/backend/windmill-worker/src/otel_oss.rs @@ -0,0 +1,3 @@ +use windmill_queue::MiniPulledJob; + +pub fn add_root_flow_job_to_otlp(_queued_job: &MiniPulledJob, _success: bool) {} \ No newline at end of file