remove pg-embed

This commit is contained in:
Ruben Fiszel
2024-10-03 13:27:37 +02:00
parent a4a59ef21e
commit 48a85e1732
3 changed files with 0 additions and 58 deletions

View File

@@ -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

View File

@@ -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<F, R>(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?;

View File

@@ -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))
}