From 48a85e1732e52f76b4e2cb65ff7acd214624501e Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 3 Oct 2024 13:27:37 +0200 Subject: [PATCH] remove pg-embed --- backend/Cargo.toml | 2 -- backend/src/main.rs | 10 --------- backend/src/pg_embed.rs | 46 ----------------------------------------- 3 files changed, 58 deletions(-) delete mode 100644 backend/src/pg_embed.rs diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 1537837c3f..632f7d3b22 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -47,7 +47,6 @@ stripe = ["windmill-api/stripe"] benchmark = ["windmill-api/benchmark", "windmill-worker/benchmark", "windmill-queue/benchmark", "windmill-common/benchmark"] flamegraph = ["windmill-common/flamegraph", "windmill-worker/flamegraph"] loki = ["windmill-common/loki"] -pg_embed = ["dep:pg-embed"] embedding = ["windmill-api/embedding"] parquet = ["windmill-api/parquet", "windmill-common/parquet", "windmill-worker/parquet", "windmill-indexer/parquet", "dep:object_store"] prometheus = ["windmill-common/prometheus", "windmill-api/prometheus", "windmill-worker/prometheus", "windmill-queue/prometheus"] @@ -88,7 +87,6 @@ serde_json.workspace = true serde.workspace = true deno_core = { workspace = true, optional = true } object_store = { workspace = true, optional = true } -pg-embed = {git = "https://github.com/faokunega/pg-embed", optional = true, default-features = false, features = ['rt_tokio']} quote.workspace = true diff --git a/backend/src/main.rs b/backend/src/main.rs index 3d97e5f1f7..0c06702e4c 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -92,9 +92,6 @@ const DEFAULT_SERVER_BIND_ADDR: Ipv4Addr = Ipv4Addr::new(0, 0, 0, 0); mod ee; mod monitor; -#[cfg(feature = "pg_embed")] -mod pg_embed; - #[inline(always)] fn create_and_run_current_thread_inner(future: F) -> R where @@ -342,13 +339,6 @@ async fn windmill_main() -> anyhow::Result<()> { config }); - #[cfg(feature = "pg_embed")] - let _pg = { - let (db_url, pg) = pg_embed::start().await.expect("pg embed"); - tracing::info!("Use embedded pg: {db_url}"); - std::env::set_var("DATABASE_URL", db_url); - pg - }; tracing::info!("Connecting to database..."); let db = windmill_common::connect_db(server_mode, indexer_mode).await?; diff --git a/backend/src/pg_embed.rs b/backend/src/pg_embed.rs deleted file mode 100644 index ad5529dc02..0000000000 --- a/backend/src/pg_embed.rs +++ /dev/null @@ -1,46 +0,0 @@ -use pg_embed::pg_enums::PgAuthMethod; -use pg_embed::pg_fetch::PgFetchSettings; -use pg_embed::postgres::{PgEmbed, PgSettings}; -use std::path::PathBuf; -use std::time::Duration; - -pub async fn start() -> anyhow::Result<(String, PgEmbed)> { - let pg_settings = PgSettings { - database_dir: PathBuf::from("/tmp/db"), - port: 6543, - user: "postgres".to_string(), - password: "password".to_string(), - auth_method: PgAuthMethod::Plain, - persistent: false, - timeout: Some(Duration::from_secs(15)), - migration_dir: None, - }; - - let fetch_settings = PgFetchSettings { - version: pg_embed::pg_fetch::PostgresVersion("15.3.0"), - - ..Default::default() - }; - - tracing::info!( - "Fetch settings: {:?} {:?}", - fetch_settings.operating_system, - fetch_settings.architecture - ); - - let mut pg = PgEmbed::new(pg_settings, fetch_settings).await?; - - pg.setup().await.expect("pg setup"); - - pg.start_db().await.expect("pg start db"); - - //TODO: re-enable this to make it work - // if !pg.database_exists("windmill").await.expect("db exists") { - // pg.create_database("windmill") - // .await - // .expect("pg create database"); - // } - - let uri = pg.full_db_uri("windmill"); - Ok((uri, pg)) -}