From 6ea62589105fdc6268ac8eb01f6842a747d9e9eb Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Wed, 2 Oct 2024 14:14:36 +0200 Subject: [PATCH] all --- backend/src/ee.rs | 17 +- backend/windmill-api/src/ee.rs | 33 +-- backend/windmill-api/src/indexer_ee.rs | 6 +- backend/windmill-api/src/job_helpers_ee.rs | 6 +- backend/windmill-api/src/oauth2_ee.rs | 189 +----------------- backend/windmill-api/src/oidc_ee.rs | 18 +- backend/windmill-api/src/saml_ee.rs | 26 +-- backend/windmill-api/src/scim_ee.rs | 24 +-- backend/windmill-api/src/smtp_server_ee.rs | 18 +- backend/windmill-api/src/stripe_ee.rs | 8 +- backend/windmill-audit/src/audit_ee.rs | 76 +------ backend/windmill-common/src/ee.rs | 84 +------- .../windmill-common/src/job_s3_helpers_ee.rs | 19 +- backend/windmill-common/src/stats_ee.rs | 49 +---- backend/windmill-git-sync/src/git_sync_ee.rs | 18 +- backend/windmill-indexer/src/indexer_ee.rs | 22 +- cli/instance.ts | 38 ++-- 17 files changed, 37 insertions(+), 614 deletions(-) mode change 100644 => 120000 backend/src/ee.rs mode change 100644 => 120000 backend/windmill-api/src/ee.rs mode change 100644 => 120000 backend/windmill-api/src/indexer_ee.rs mode change 100644 => 120000 backend/windmill-api/src/job_helpers_ee.rs mode change 100644 => 120000 backend/windmill-api/src/oauth2_ee.rs mode change 100644 => 120000 backend/windmill-api/src/oidc_ee.rs mode change 100644 => 120000 backend/windmill-api/src/saml_ee.rs mode change 100644 => 120000 backend/windmill-api/src/scim_ee.rs mode change 100644 => 120000 backend/windmill-api/src/smtp_server_ee.rs mode change 100644 => 120000 backend/windmill-api/src/stripe_ee.rs mode change 100644 => 120000 backend/windmill-audit/src/audit_ee.rs mode change 100644 => 120000 backend/windmill-common/src/ee.rs mode change 100644 => 120000 backend/windmill-common/src/job_s3_helpers_ee.rs mode change 100644 => 120000 backend/windmill-common/src/stats_ee.rs mode change 100644 => 120000 backend/windmill-git-sync/src/git_sync_ee.rs mode change 100644 => 120000 backend/windmill-indexer/src/indexer_ee.rs diff --git a/backend/src/ee.rs b/backend/src/ee.rs deleted file mode 100644 index ef944b984b..0000000000 --- a/backend/src/ee.rs +++ /dev/null @@ -1,16 +0,0 @@ -use anyhow::anyhow; -#[cfg(feature = "enterprise")] -use windmill_common::error::{Error, Result}; - -pub async fn set_license_key(_license_key: String) -> anyhow::Result<()> { - // Implementation is not open source - Err(anyhow!("License cannot be set in Windmill CE")) -} - -#[cfg(feature = "enterprise")] -pub async fn verify_license_key() -> Result<()> { - // Implementation is not open source - Err(Error::InternalErr( - "License always invalid in Windmill CE".to_string(), - )) -} diff --git a/backend/src/ee.rs b/backend/src/ee.rs new file mode 120000 index 0000000000..ca288038c6 --- /dev/null +++ b/backend/src/ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/src/ee.rs \ No newline at end of file diff --git a/backend/windmill-api/src/ee.rs b/backend/windmill-api/src/ee.rs deleted file mode 100644 index b20521e8b4..0000000000 --- a/backend/windmill-api/src/ee.rs +++ /dev/null @@ -1,32 +0,0 @@ -use anyhow::anyhow; -#[cfg(feature = "enterprise")] -use std::sync::Arc; -#[cfg(feature = "enterprise")] -use tokio::sync::RwLock; - -pub async fn validate_license_key(_license_key: String) -> anyhow::Result { - // Implementation is not open source - Err(anyhow!("License can't be validated in Windmill CE")) -} - -#[cfg(feature = "enterprise")] -pub async fn jwt_ext_auth( - _w_id: Option<&String>, - _token: &str, - _external_jwks: Option>>, -) -> anyhow::Result<(crate::db::ApiAuthed, usize)> { - // Implementation is not open source - - Err(anyhow!("External JWT auth is not open source")) -} - -#[cfg(feature = "enterprise")] -pub struct ExternalJwks; - -#[cfg(feature = "enterprise")] -impl ExternalJwks { - pub async fn load() -> Option>> { - // Implementation is not open source - None - } -} diff --git a/backend/windmill-api/src/ee.rs b/backend/windmill-api/src/ee.rs new file mode 120000 index 0000000000..0267c6e6fd --- /dev/null +++ b/backend/windmill-api/src/ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-api/src/ee.rs \ No newline at end of file diff --git a/backend/windmill-api/src/indexer_ee.rs b/backend/windmill-api/src/indexer_ee.rs deleted file mode 100644 index 61a946bb84..0000000000 --- a/backend/windmill-api/src/indexer_ee.rs +++ /dev/null @@ -1,5 +0,0 @@ -use axum::Router; - -pub fn workspaced_service() -> Router { - Router::new() -} diff --git a/backend/windmill-api/src/indexer_ee.rs b/backend/windmill-api/src/indexer_ee.rs new file mode 120000 index 0000000000..8a23d0ad13 --- /dev/null +++ b/backend/windmill-api/src/indexer_ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-api/src/indexer_ee.rs \ No newline at end of file diff --git a/backend/windmill-api/src/job_helpers_ee.rs b/backend/windmill-api/src/job_helpers_ee.rs deleted file mode 100644 index 61a946bb84..0000000000 --- a/backend/windmill-api/src/job_helpers_ee.rs +++ /dev/null @@ -1,5 +0,0 @@ -use axum::Router; - -pub fn workspaced_service() -> Router { - Router::new() -} diff --git a/backend/windmill-api/src/job_helpers_ee.rs b/backend/windmill-api/src/job_helpers_ee.rs new file mode 120000 index 0000000000..8cc4fbe8bf --- /dev/null +++ b/backend/windmill-api/src/job_helpers_ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-api/src/job_helpers_ee.rs \ No newline at end of file diff --git a/backend/windmill-api/src/oauth2_ee.rs b/backend/windmill-api/src/oauth2_ee.rs deleted file mode 100644 index 39960cec92..0000000000 --- a/backend/windmill-api/src/oauth2_ee.rs +++ /dev/null @@ -1,188 +0,0 @@ -/* - * 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, fmt::Debug}; - -use axum::{routing::get, Json, Router}; -use hmac::Mac; -use hyper::HeaderMap; - -use itertools::Itertools; -use oauth2::{Client as OClient, *}; -use serde::{Deserialize, Serialize}; -use sqlx::{Postgres, Transaction}; -use windmill_common::more_serde::maybe_number_opt; - -use crate::OAUTH_CLIENTS; -use windmill_common::error; -use windmill_common::oauth2::*; - -use crate::db::DB; -use std::str; - -pub fn global_service() -> Router { - Router::new() - .route("/list_supabase", get(list_supabase)) - .route("/list_logins", get(list_logins)) - .route("/list_connects", get(list_connects)) -} - -pub fn workspaced_service() -> Router { - Router::new() -} - -#[derive(Serialize)] -#[serde(tag = "type")] -pub enum InstanceEvent { - UserAdded { email: String }, - // UserDeleted { email: String }, - // UserDeletedWorkspace { workspace: String, email: String }, - UserAddedWorkspace { workspace: String, email: String }, - UserInvitedWorkspace { workspace: String, email: String }, - UserJoinedWorkspace { workspace: String, email: String, username: String }, -} - -#[derive(Debug, Clone)] -pub struct ClientWithScopes { - _client: OClient, - _scopes: Vec, - _extra_params: Option>, - _extra_params_callback: Option>, - _allowed_domains: Option>, - _userinfo_url: Option, -} - -pub type BasicClientsMap = HashMap; - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct OAuthConfig { - auth_url: String, - token_url: String, - userinfo_url: Option, - scopes: Option>, - extra_params: Option>, - extra_params_callback: Option>, - req_body_auth: Option, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct OAuthClient { - id: String, - secret: String, - allowed_domains: Option>, - connect_config: Option, - login_config: Option, -} - -#[derive(Debug)] -pub struct AllClients { - pub logins: BasicClientsMap, - pub connects: BasicClientsMap, - pub slack: Option, -} - -pub fn build_oauth_clients( - _base_url: &str, - _oauths_from_config: Option>, -) -> anyhow::Result { - // Implementation is not open source - return Ok(AllClients { - logins: HashMap::default(), - connects: HashMap::default(), - slack: None, - }); -} - -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct TokenResponse { - access_token: AccessToken, - #[serde(deserialize_with = "maybe_number_opt")] - #[serde(default)] - expires_in: Option, - refresh_token: Option, - #[serde(deserialize_with = "helpers::deserialize_space_delimited_vec")] - #[serde(serialize_with = "helpers::serialize_space_delimited_vec")] - #[serde(default)] - scope: Option>, -} - -#[derive(Serialize)] -struct Logins { - oauth: Vec, - saml: Option, -} -async fn list_logins() -> error::JsonResult { - // Implementation is not open source - return Ok(Json(Logins { oauth: vec![], saml: None })); -} - -async fn list_connects() -> error::JsonResult> { - Ok(Json( - (&OAUTH_CLIENTS.read().await.connects) - .keys() - .map(|x| x.to_owned()) - .collect_vec(), - )) -} - -pub async fn _refresh_token<'c>( - _tx: Transaction<'c, Postgres>, - _path: &str, - _w_id: &str, - _id: i32, - _db: &DB, -) -> error::Result { - // Implementation is not open source - Err(error::Error::BadRequest( - "Not implemented in Windmill's Open Source repository".to_string(), - )) -} - -async fn list_supabase(_headers: HeaderMap) -> error::Result { - // Implementation is not open source - Err(error::Error::BadRequest( - "Not implemented in Windmill's Open Source repository".to_string(), - )) -} - -pub async fn check_nb_of_user(db: &DB) -> error::Result<()> { - let nb_users_sso = - sqlx::query_scalar!("SELECT COUNT(*) FROM password WHERE login_type != 'password'",) - .fetch_one(db) - .await?; - if nb_users_sso.unwrap_or(0) >= 10 { - return Err(error::Error::BadRequest( - "You have reached the maximum number of oauth users accounts (10) without an enterprise license" - .to_string(), - )); - } - - let nb_users = sqlx::query_scalar!("SELECT COUNT(*) FROM password",) - .fetch_one(db) - .await?; - if nb_users.unwrap_or(0) >= 50 { - return Err(error::Error::BadRequest( - "You have reached the maximum number of accounts (50) without an enterprise license" - .to_string(), - )); - } - return Ok(()); -} - -#[derive(Clone, Debug)] -pub struct SlackVerifier { - _mac: HmacSha256, -} - -impl SlackVerifier { - pub fn new>(secret: S) -> anyhow::Result { - HmacSha256::new_from_slice(secret.as_ref()) - .map(|mac| SlackVerifier { _mac: mac }) - .map_err(|_| anyhow::anyhow!("invalid secret")) - } -} diff --git a/backend/windmill-api/src/oauth2_ee.rs b/backend/windmill-api/src/oauth2_ee.rs new file mode 120000 index 0000000000..1ab1665454 --- /dev/null +++ b/backend/windmill-api/src/oauth2_ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-api/src/oauth2_ee.rs \ No newline at end of file diff --git a/backend/windmill-api/src/oidc_ee.rs b/backend/windmill-api/src/oidc_ee.rs deleted file mode 100644 index 248b990f54..0000000000 --- a/backend/windmill-api/src/oidc_ee.rs +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Author: Ruben Fiszel - * Copyright: Windmill Labs, Inc 2023 - * 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 axum::Router; - -pub fn global_service() -> Router { - Router::new() -} - -pub fn workspaced_service() -> Router { - Router::new() -} diff --git a/backend/windmill-api/src/oidc_ee.rs b/backend/windmill-api/src/oidc_ee.rs new file mode 120000 index 0000000000..1e902de563 --- /dev/null +++ b/backend/windmill-api/src/oidc_ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-api/src/oidc_ee.rs \ No newline at end of file diff --git a/backend/windmill-api/src/saml_ee.rs b/backend/windmill-api/src/saml_ee.rs deleted file mode 100644 index b3f1d4653c..0000000000 --- a/backend/windmill-api/src/saml_ee.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: Ruben Fiszel - * Copyright: Windmill Labs, Inc 2023 - * 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. - */ -#![allow(non_snake_case)] - -use axum::{routing::post, Router}; - -pub struct ServiceProviderExt(); - -pub async fn build_sp_extension() -> anyhow::Result { - return Ok(ServiceProviderExt()); -} - -pub fn global_service() -> Router { - Router::new().route("/acs", post(acs)) -} - -pub async fn acs() -> String { - // Implementation is not open source as it is a Windmill Enterprise Edition feature - "SAML available only in enterprise version".to_string() -} diff --git a/backend/windmill-api/src/saml_ee.rs b/backend/windmill-api/src/saml_ee.rs new file mode 120000 index 0000000000..65286e3f12 --- /dev/null +++ b/backend/windmill-api/src/saml_ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-api/src/saml_ee.rs \ No newline at end of file diff --git a/backend/windmill-api/src/scim_ee.rs b/backend/windmill-api/src/scim_ee.rs deleted file mode 100644 index f11097f874..0000000000 --- a/backend/windmill-api/src/scim_ee.rs +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Author: Ruben Fiszel - * Copyright: Windmill Labs, Inc 2023 - * 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 axum::{middleware::Next, response::Response, routing::get, Router}; -use hyper::Request; - -pub fn global_service() -> Router { - Router::new().route("/ee", get(ee)) -} - -pub async fn ee() -> String { - return "Enterprise Edition".to_string(); -} - -pub async fn has_scim_token(_request: Request, _next: Next) -> Response { - //Not implemented in open-source version - todo!() -} diff --git a/backend/windmill-api/src/scim_ee.rs b/backend/windmill-api/src/scim_ee.rs new file mode 120000 index 0000000000..cd27dc4526 --- /dev/null +++ b/backend/windmill-api/src/scim_ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-api/src/scim_ee.rs \ No newline at end of file diff --git a/backend/windmill-api/src/smtp_server_ee.rs b/backend/windmill-api/src/smtp_server_ee.rs deleted file mode 100644 index 88837c5974..0000000000 --- a/backend/windmill-api/src/smtp_server_ee.rs +++ /dev/null @@ -1,17 +0,0 @@ -use crate::{db::DB, users::AuthCache}; -use std::{net::SocketAddr, sync::Arc}; -use windmill_common::db::UserDB; - -pub struct SmtpServer { - pub auth_cache: Arc, - pub db: DB, - pub user_db: UserDB, - pub rsmq: Option, - pub base_internal_url: String, -} - -impl SmtpServer { - pub async fn start_listener_thread(self: Arc, _addr: SocketAddr) -> anyhow::Result<()> { - Err(anyhow::anyhow!("Implementation not open source")) - } -} diff --git a/backend/windmill-api/src/smtp_server_ee.rs b/backend/windmill-api/src/smtp_server_ee.rs new file mode 120000 index 0000000000..4cbbfd0c62 --- /dev/null +++ b/backend/windmill-api/src/smtp_server_ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-api/src/smtp_server_ee.rs \ No newline at end of file diff --git a/backend/windmill-api/src/stripe_ee.rs b/backend/windmill-api/src/stripe_ee.rs deleted file mode 100644 index 1aea2ecd2d..0000000000 --- a/backend/windmill-api/src/stripe_ee.rs +++ /dev/null @@ -1,7 +0,0 @@ -#[cfg(feature = "stripe")] -use axum::Router; - -#[cfg(feature = "stripe")] -pub fn add_stripe_routes(router: Router) -> Router { - return router; -} diff --git a/backend/windmill-api/src/stripe_ee.rs b/backend/windmill-api/src/stripe_ee.rs new file mode 120000 index 0000000000..a6c7d1230e --- /dev/null +++ b/backend/windmill-api/src/stripe_ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-api/src/stripe_ee.rs \ No newline at end of file diff --git a/backend/windmill-audit/src/audit_ee.rs b/backend/windmill-audit/src/audit_ee.rs deleted file mode 100644 index 97a8e6bbcf..0000000000 --- a/backend/windmill-audit/src/audit_ee.rs +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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(), - )) -} diff --git a/backend/windmill-audit/src/audit_ee.rs b/backend/windmill-audit/src/audit_ee.rs new file mode 120000 index 0000000000..f8d4a81d03 --- /dev/null +++ b/backend/windmill-audit/src/audit_ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-audit/src/audit_ee.rs \ No newline at end of file diff --git a/backend/windmill-common/src/ee.rs b/backend/windmill-common/src/ee.rs deleted file mode 100644 index d2b215a5ad..0000000000 --- a/backend/windmill-common/src/ee.rs +++ /dev/null @@ -1,83 +0,0 @@ -#[cfg(feature = "enterprise")] -use crate::db::DB; -use crate::ee::LicensePlan::Community; -#[cfg(feature = "enterprise")] -use crate::error; -use serde::Deserialize; -use std::sync::Arc; -use tokio::sync::RwLock; - -lazy_static::lazy_static! { - pub static ref LICENSE_KEY_VALID: Arc> = Arc::new(RwLock::new(true)); - pub static ref LICENSE_KEY_ID: Arc> = Arc::new(RwLock::new("".to_string())); - pub static ref LICENSE_KEY: Arc> = Arc::new(RwLock::new("".to_string())); -} - -pub enum LicensePlan { - Community, - Pro, - Enterprise, -} - -pub async fn get_license_plan() -> LicensePlan { - // Implementation is not open source - return Community; -} - -#[derive(Deserialize)] -#[serde(untagged)] -pub enum CriticalErrorChannel { - Email { email: String }, - Slack { slack_channel: String }, -} - -pub enum CriticalAlertKind { - #[cfg(feature = "enterprise")] - CriticalError, - #[cfg(feature = "enterprise")] - RecoveredCriticalError, -} - -#[cfg(feature = "enterprise")] -pub async fn send_critical_alert( - _error_message: String, - _db: &DB, - _kind: CriticalAlertKind, - _channels: Option>, -) { -} - -#[cfg(feature = "enterprise")] -pub async fn schedule_key_renewal(_http_client: &reqwest::Client, _db: &crate::db::DB) -> () { - // Implementation is not open source -} - -#[cfg(feature = "enterprise")] -pub enum RenewReason { - Manual, - Schedule, - OnStart, -} - -#[cfg(feature = "enterprise")] -pub async fn renew_license_key( - _http_client: &reqwest::Client, - _db: &crate::db::DB, - _key: Option, - _reason: RenewReason, -) -> String { - // Implementation is not open source - "".to_string() -} - -#[cfg(feature = "enterprise")] -pub async fn create_customer_portal_session( - _http_client: &reqwest::Client, - _key: Option, -) -> error::Result { - // Implementation is not open source - Ok("".to_string()) -} - -#[cfg(feature = "enterprise")] -pub async fn worker_groups_alerts(_db: &DB) {} diff --git a/backend/windmill-common/src/ee.rs b/backend/windmill-common/src/ee.rs new file mode 120000 index 0000000000..3220066a5d --- /dev/null +++ b/backend/windmill-common/src/ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-common/src/ee.rs \ No newline at end of file diff --git a/backend/windmill-common/src/job_s3_helpers_ee.rs b/backend/windmill-common/src/job_s3_helpers_ee.rs deleted file mode 100644 index b00c00a583..0000000000 --- a/backend/windmill-common/src/job_s3_helpers_ee.rs +++ /dev/null @@ -1,18 +0,0 @@ -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!() -} diff --git a/backend/windmill-common/src/job_s3_helpers_ee.rs b/backend/windmill-common/src/job_s3_helpers_ee.rs new file mode 120000 index 0000000000..6c8430be70 --- /dev/null +++ b/backend/windmill-common/src/job_s3_helpers_ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-common/src/job_s3_helpers_ee.rs \ No newline at end of file diff --git a/backend/windmill-common/src/stats_ee.rs b/backend/windmill-common/src/stats_ee.rs deleted file mode 100644 index c6dc9946bf..0000000000 --- a/backend/windmill-common/src/stats_ee.rs +++ /dev/null @@ -1,48 +0,0 @@ -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, - _skip_job_usage: bool, - _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) -} diff --git a/backend/windmill-common/src/stats_ee.rs b/backend/windmill-common/src/stats_ee.rs new file mode 120000 index 0000000000..d0ddc5bd1d --- /dev/null +++ b/backend/windmill-common/src/stats_ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-common/src/stats_ee.rs \ No newline at end of file diff --git a/backend/windmill-git-sync/src/git_sync_ee.rs b/backend/windmill-git-sync/src/git_sync_ee.rs deleted file mode 100644 index 4be2858c27..0000000000 --- a/backend/windmill-git-sync/src/git_sync_ee.rs +++ /dev/null @@ -1,17 +0,0 @@ -use windmill_common::error::Result; - -use crate::{DeployedObject, DB}; - -pub async fn handle_deployment_metadata<'c, R: rsmq_async::RsmqConnection + Send + Clone + 'c>( - _email: &str, - _created_by: &str, - _db: &DB, - _w_id: &str, - _obj: DeployedObject, - _deployment_message: Option, - _rsmq: Option, - _skip_db_insert: bool, -) -> Result<()> { - // Git sync is an enterprise feature and not part of the open-source version - return Ok(()); -} diff --git a/backend/windmill-git-sync/src/git_sync_ee.rs b/backend/windmill-git-sync/src/git_sync_ee.rs new file mode 120000 index 0000000000..0824f2c28c --- /dev/null +++ b/backend/windmill-git-sync/src/git_sync_ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-git-sync/src/git_sync_ee.rs \ No newline at end of file diff --git a/backend/windmill-indexer/src/indexer_ee.rs b/backend/windmill-indexer/src/indexer_ee.rs deleted file mode 100644 index 79bcbcff77..0000000000 --- a/backend/windmill-indexer/src/indexer_ee.rs +++ /dev/null @@ -1,21 +0,0 @@ -use sqlx::{Pool, Postgres}; -use windmill_common::error::Error; -use anyhow::anyhow; - -#[derive(Clone)] -pub struct IndexReader; - -#[derive(Clone)] -pub struct IndexWriter; - -pub async fn init_index() -> 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<()>, -) { - tracing::error!("Cannot run indexer: not in EE"); -} diff --git a/backend/windmill-indexer/src/indexer_ee.rs b/backend/windmill-indexer/src/indexer_ee.rs new file mode 120000 index 0000000000..925a2c9cd5 --- /dev/null +++ b/backend/windmill-indexer/src/indexer_ee.rs @@ -0,0 +1 @@ +/git/windmill/../windmill-ee-private/windmill-indexer/src/indexer_ee.rs \ No newline at end of file diff --git a/cli/instance.ts b/cli/instance.ts index cf2d5f5b02..b10ad87b66 100644 --- a/cli/instance.ts +++ b/cli/instance.ts @@ -35,7 +35,7 @@ import { pushInstanceConfigs, type SimplifiedSettings, } from "./settings.ts"; -import { sleep, deepEqual } from "./utils.ts"; +import { deepEqual } from "./utils.ts"; import { GlobalOptions } from "./types.ts"; export interface Instance { @@ -183,10 +183,13 @@ export type InstanceSyncOptions = { yes?: boolean; }; -export async function pickInstance(opts: InstanceSyncOptions, allowNew: boolean) { +export async function pickInstance( + opts: InstanceSyncOptions, + allowNew: boolean +) { const instances = await allInstances(); if (opts.baseUrl && opts.token) { - log.info("Using instance fully defined by --base-url and --token") + log.info("Using instance fully defined by --base-url and --token"); return { name: "custom", remote: opts.baseUrl, @@ -284,8 +287,6 @@ async function instancePull(opts: GlobalOptions & InstanceSyncOptions) { log.info("No instance-level changes to apply"); } - sleep(1000); - if (opts.includeWorkspaces) { log.info("\nPulling all workspaces"); const remoteWorkspaces = await wmill.listWorkspacesAsSuperAdmin({ @@ -299,7 +300,6 @@ async function instancePull(opts: GlobalOptions & InstanceSyncOptions) { const rootDir = Deno.cwd(); for (const remoteWorkspace of remoteWorkspaces) { log.info("\nPulling workspace " + remoteWorkspace.id); - sleep(1000); const workspaceName = instance.prefix + "_" + remoteWorkspace.id; await Deno.mkdir(path.join(rootDir, workspaceName), { recursive: true, @@ -409,8 +409,6 @@ async function instancePush(opts: GlobalOptions & InstanceSyncOptions) { log.info("No instance-level changes to apply"); } - sleep(1000); - if (opts.includeWorkspaces) { instances = await allInstances(); const localPrefix = (await Select.prompt({ @@ -424,20 +422,20 @@ async function instancePush(opts: GlobalOptions & InstanceSyncOptions) { default: instance.prefix as unknown, })) as unknown as string; - const remoteWorkspaces = await wmill.listWorkspacesAsSuperAdmin({ - page: 1, - perPage: 1000, - }); - let localWorkspaces = await allWorkspaces(); + const rootDir = Deno.cwd(); + + let localWorkspaces = Deno.readDir("."); localWorkspaces = localWorkspaces.filter((w) => w.name.startsWith(localPrefix + "_") ); - log.info("\nPushing all workspaces"); - const rootDir = Deno.cwd(); + log.info( + `\nPushing all workspaces: ${localWorkspaces.join( + ", " + )} with prefix ${localPrefix}` + ); for (const localWorkspace of localWorkspaces) { log.info("\nPushing workspace " + localWorkspace.workspaceId); - sleep(1000); try { await Deno.chdir(path.join(rootDir, localWorkspace.name)); } catch (_) { @@ -481,6 +479,10 @@ async function instancePush(opts: GlobalOptions & InstanceSyncOptions) { }); } + const remoteWorkspaces = await wmill.listWorkspacesAsSuperAdmin({ + page: 1, + perPage: 1000, + }); const workspacesToDelete = remoteWorkspaces.filter( (w) => !localWorkspaces.find((l) => l.workspaceId === w.id) ); @@ -544,7 +546,9 @@ async function whoami(opts: {}) { log.info(colors.green.underline(`global whoami infos:`)); log.info(JSON.stringify(whoamiInfo, null, 2)); } catch (error) { - log.error(colors.red(`Failed to retrieve whoami information: ${error.message}`)); + log.error( + colors.red(`Failed to retrieve whoami information: ${error.message}`) + ); } }