Skip to content

Commit

Permalink
Remove OLAP, DataWarehouse (#1123)
Browse files Browse the repository at this point in the history
Remove the stacks and all references to them. Also remove remaining
references to the Rag stack, removed in 6d472c9 (#1070).

While at it, update the integration test environment variable
configuration to default to using the dev API and testing org ID (also
present in `cargo-test.yml`) and returning a more informative error when
the `ACCESS_TOKEN` isn't set. Also fix the lifetime scoping of the
return value of `gradient_p()` and delete a test assertion that the
compiler removes.
  • Loading branch information
theory committed Jan 29, 2025
1 parent fb15bfb commit 0b4ffec
Show file tree
Hide file tree
Showing 27 changed files with 68 additions and 519 deletions.
2 changes: 1 addition & 1 deletion conductor/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tembo-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tembo-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
workspace = { members = ["temboclient", "tembodataclient"] }
[package]
name = "tembo-cli"
version = "0.20.8"
version = "0.21.0"
edition = "2021"
authors = ["Tembo.io"]
description = "The CLI for Tembo"
Expand Down
33 changes: 18 additions & 15 deletions tembo-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ managing, and running Postgres.

Using homebrew

```
``` sh
brew tap tembo-io/tembo
brew install tembo-cli
```

Using cargo

```
``` sh
cargo install tembo-cli
```

Expand All @@ -30,13 +30,15 @@ Discover a wide range of commands and subcommands, along with their respective o

Clone this repo and run:

`cargo install --path .`
``` sh
cargo install --path .
```

If the install path is in your shell path, you can then run `tembo help` and other `tembo` commands.

You can run this command to use the local code for any tembo command during development:

```
``` sh
alias tembo='cargo run --'
```

Expand All @@ -58,7 +60,7 @@ openapi-generator generate -i https://api.data-1.use1.tembo.io/api-docs/openapi.

* Go to `tembodataclient/src/lib.rs` & add following line at the top to disable clippy for the generated code

```
``` rs
#![allow(clippy::all)]
```

Expand All @@ -74,13 +76,13 @@ openapi-generator generate -i https://api.tembo.io/api-docs/openapi.json -g rus

* Go to `temboclient/src/lib.rs` & add following line at the top to disable clippy for the generated code

```
``` rs
#![allow(clippy::all)]
```

* Create `temboclient/src/models/impls.rs` file & add following code to it:

```
```rs
use std::str::FromStr;

use super::{Cpu, Environment, Memory, StackType, Storage};
Expand Down Expand Up @@ -154,15 +156,16 @@ impl FromStr for StackType {

fn from_str(input: &str) -> core::result::Result<StackType, Self::Err> {
match input {
"Standard" => Ok(StackType::Standard),
"MessageQueue" => Ok(StackType::MessageQueue),
"MachineLearning" => Ok(StackType::MachineLearning),
"OLAP" => Ok(StackType::Olap),
"VectorDB" => Ok(StackType::VectorDb),
"OLTP" => Ok(StackType::Oltp),
"DataWarehouse" => Ok(StackType::DataWarehouse),
"Analytics" => Ok(StackType::Analytics),
"Geospatial" => Ok(StackType::Geospatial),
"MachineLearning" => Ok(StackType::MachineLearning),
"MessageQueue" => Ok(StackType::MessageQueue),
"MongoAlternative" => Ok(StackType::MongoAlternative),
"OLTP" => Ok(StackType::OLTP),
"ParadeDB" => Ok(StackType::ParadeDB),
"Standard" => Ok(StackType::Standard),
"Timeseries" => Ok(StackType::Timeseries),
"VectorDB" => Ok(StackType::VectorDB),
_ => Err(()),
}
}
Expand All @@ -171,7 +174,7 @@ impl FromStr for StackType {

* Add following line towards the end of `temboclient/src/models/mod.rs`

```
``` rs
pub mod impls;
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
data-warehouse/*
analytics/*
docker-compose.yml
11 changes: 11 additions & 0 deletions tembo-cli/examples/analytics/tembo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[analytics]
environment = "test"
instance_name = "analytics"
cpu = "2"
memory = "8Gi"
storage = "50Gi"
stack_type = "Analytics"

[analytics.extensions.clerk_fdw]
enabled = true
version = "0.2.4"
11 changes: 0 additions & 11 deletions tembo-cli/examples/data-warehouse/tembo.toml

This file was deleted.

6 changes: 0 additions & 6 deletions tembo-cli/src/cmd/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,9 @@ pub fn execute(verbose: bool) -> Result<(), anyhow::Error> {

fn validate_support(config: &HashMap<String, InstanceSettings>) -> Result<(), anyhow::Error> {
for settings in config.values() {
validate_stack_support(settings, 14, "OLAP")?;
validate_stack_support(settings, 14, "VectorDB")?;
validate_stack_support(settings, 16, "DataWarehouse")?;
validate_stack_support(settings, 16, "MachineLearning")?;
validate_stack_support(settings, 16, "MessageQueue")?;
validate_stack_support(settings, 16, "OLAP")?;
validate_stack_support(settings, 16, "RAG")?;
validate_stack_support(settings, 16, "VectorDB")?;
}
Ok(())
Expand Down Expand Up @@ -354,8 +350,6 @@ mod tests {
#[case("Standard", true)]
#[case("VectorDB", true)]
#[case("OLTP", true)]
#[case("OLAP", true)]
#[case("datawarehouse", false)]
fn test_validate_stack_type(#[case] stack_type: &str, #[case] is_valid: bool) {
let result = validate_stack_type(stack_type, "test_section", false);
assert_eq!(result.is_ok(), is_valid);
Expand Down
2 changes: 1 addition & 1 deletion tembo-cli/src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ pub mod colors {

#[allow(dead_code)]
#[allow(clippy::needless_lifetimes)]
pub fn gradient_p<'a>(log: &'a str) -> TemboCliLog {
pub fn gradient_p<'a>(log: &'a str) -> TemboCliLog<'a> {
let term_program = std::env::var("TERM_PROGRAM").unwrap_or_default();
// aTerminal only supports 8 bit colors so gradients won't work
if term_program == "Apple_Terminal" {
Expand Down
3 changes: 0 additions & 3 deletions tembo-cli/temboclient/src/models/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,11 @@ impl FromStr for StackType {
"Standard" => Ok(StackType::Standard),
"MessageQueue" => Ok(StackType::MessageQueue),
"MachineLearning" => Ok(StackType::MachineLearning),
"OLAP" => Ok(StackType::Olap),
"VectorDB" => Ok(StackType::VectorDb),
"OLTP" => Ok(StackType::Oltp),
"Analytics" => Ok(StackType::Analytics),
"DataWarehouse" => Ok(StackType::DataWarehouse),
"Geospatial" => Ok(StackType::Geospatial),
"MongoAlternative" => Ok(StackType::MongoAlternative),
"RAG" => Ok(StackType::Rag),
"Timeseries" => Ok(StackType::Timeseries),
"ParadeDB" => Ok(StackType::ParadeDB),
_ => Err(()),
Expand Down
9 changes: 0 additions & 9 deletions tembo-cli/temboclient/src/models/stack_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,16 @@ pub enum StackType {
MessageQueue,
#[serde(rename = "MachineLearning")]
MachineLearning,
#[serde(rename = "OLAP")]
Olap,
#[serde(rename = "OLTP")]
Oltp,
#[serde(rename = "Analytics")]
Analytics,
#[serde(rename = "VectorDB")]
VectorDb,
#[serde(rename = "DataWarehouse")]
DataWarehouse,
#[serde(rename = "Geospatial")]
Geospatial,
#[serde(rename = "MongoAlternative")]
MongoAlternative,
#[serde(rename = "RAG")]
Rag,
#[serde(rename = "Timeseries")]
Timeseries,
#[serde(rename = "ParadeDB")]
Expand All @@ -45,14 +39,11 @@ impl ToString for StackType {
Self::Standard => String::from("Standard"),
Self::MessageQueue => String::from("MessageQueue"),
Self::MachineLearning => String::from("MachineLearning"),
Self::Olap => String::from("OLAP"),
Self::Oltp => String::from("OLTP"),
Self::Analytics => String::from("Analytics"),
Self::VectorDb => String::from("VectorDB"),
Self::DataWarehouse => String::from("DataWarehouse"),
Self::Geospatial => String::from("Geospatial"),
Self::MongoAlternative => String::from("MongoAlternative"),
Self::Rag => String::from("RAG"),
Self::Timeseries => String::from("Timeseries"),
Self::ParadeDB => String::from("ParadeDB"),
}
Expand Down
32 changes: 24 additions & 8 deletions tembo-cli/tests/integration_tests_cloud.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use assert_cmd::Command;
use random_string::generate;
use std::env;
use std::env::{self, VarError};
use std::error::Error;
use std::fs::File;
use std::io::{Read, Write};
Expand Down Expand Up @@ -97,8 +97,6 @@ async fn minimal_cloud() -> Result<(), Box<dyn Error>> {
let maybe_instance = get_instance(&instance_name, &config, &env).await?;
if let Some(instance) = maybe_instance {
assert_eq!(instance.state, State::Deleting, "Instance isn't Deleting")
} else {
assert!(true, "Instance isn't Deleting")
}

replace_vars_in_file(
Expand All @@ -110,25 +108,43 @@ async fn minimal_cloud() -> Result<(), Box<dyn Error>> {
Ok(())
}

fn get_var(name: &str, default: &str) -> Result<String, Box<dyn Error>> {
match env::var(name) {
Ok(str) => Ok(str),
Err(e) => match e {
VarError::NotUnicode(_) => Err(format!("Invalid environment variable {name}").into()),
VarError::NotPresent => match default {
"" => Err(format!("Missing environment variable {name}").into()),
s => Ok(s.to_string()),
},
},
}
}

fn setup_env(instance_name: &String) -> Result<(), Box<dyn Error>> {
replace_vars_in_file(tembo_context_file_path(), "ORG_ID", &env::var("ORG_ID")?)?;
replace_vars_in_file(
tembo_context_file_path(),
"ORG_ID",
&get_var("ORG_ID", "org_2YW4TYIMI1LeOqJTXIyvkHOHCUo")?,
)?;

// Use https://cloud.cdb-dev.com/generate-jwt to create token.
replace_vars_in_file(
tembo_credentials_file_path(),
"ACCESS_TOKEN",
&env::var("ACCESS_TOKEN")?,
&get_var("ACCESS_TOKEN", "")?,
)?;

replace_vars_in_file(
tembo_credentials_file_path(),
"https://api.tembo.io",
&env::var("TEMBO_HOST")?,
&get_var("TEMBO_HOST", "https://api.cdb-dev.com")?,
)?;

replace_vars_in_file(
tembo_credentials_file_path(),
"https://api.data-1.use1.tembo.io",
&env::var("TEMBO_DATA_HOST")?,
&get_var("TEMBO_DATA_HOST", "https://api.data-1.use1.cdb-dev.com")?,
)?;

replace_vars_in_file(
Expand Down Expand Up @@ -157,7 +173,7 @@ fn replace_vars_in_file(
drop(src);
let new_data = data.replace(word_from, word_to);
let mut dst = File::create(&file_path)?;
dst.write(new_data.as_bytes())?;
dst.write_all(new_data.as_bytes())?;
drop(dst);

Ok(())
Expand Down
13 changes: 2 additions & 11 deletions tembo-cli/tests/integration_tests_docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ fn help() -> Result<(), anyhow::Error> {
#[test_case(14, "Standard")]
#[test_case(15, "Standard")]
#[test_case(16, "Standard")]
#[test_case(14, "DataWarehouse")]
#[test_case(15, "DataWarehouse")]
#[test_case(16, "DataWarehouse")]
#[test_case(14, "Geospatial")]
#[test_case(15, "Geospatial")]
#[test_case(16, "Geospatial")]
Expand All @@ -45,15 +42,9 @@ fn help() -> Result<(), anyhow::Error> {
#[test_case(14, "MongoAlternative")]
#[test_case(15, "MongoAlternative")]
#[test_case(16, "MongoAlternative")]
#[test_case(14, "OLAP")]
#[test_case(15, "OLAP")]
#[test_case(16, "OLAP")]
#[test_case(14, "OLTP")]
#[test_case(15, "OLTP")]
#[test_case(16, "OLTP")]
#[test_case(14, "RAG")]
#[test_case(15, "RAG")]
#[test_case(16, "RAG")]
#[test_case(14, "VectorDB")]
#[test_case(15, "VectorDB")]
#[test_case(16, "VectorDB")]
Expand Down Expand Up @@ -231,8 +222,8 @@ async fn migrations() -> Result<(), anyhow::Error> {
}

#[tokio::test]
async fn data_warehouse() -> Result<(), anyhow::Error> {
let instance_name = "data-warehouse";
async fn analytics() -> Result<(), anyhow::Error> {
let instance_name = "analytics";

let root_dir = env!("CARGO_MANIFEST_DIR");
let test_dir = PathBuf::from(root_dir).join("examples").join(instance_name);
Expand Down
2 changes: 1 addition & 1 deletion tembo-operator/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tembo-operator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "controller"
description = "Tembo Operator for Postgres"
version = "0.54.3"
version = "0.55.0"
edition = "2021"
default-run = "controller"
license = "Apache-2.0"
Expand Down
1 change: 0 additions & 1 deletion tembo-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ Check out the others in the yaml directory.
Here are some select options to apply just as `sample-standard.yaml` was:

- Try out the [Message Queue Stack](https://tembo.io/docs/tembo-stacks/message-queue) with [sample-message-queue.yaml](./yaml/sample-message-queue.yaml).
- Try out the [OLAP Stack](https://tembo.io/docs/tembo-stacks/olap) with [sample-olap.yaml](./yaml/sample-olap.yaml).
- Try out the [MongoAlternative Stack](https://tembo.io/docs/tembo-stacks/mongo-alternative) with [sample-document.yaml](./yaml/sample-document.yaml).

## Observability with curl
Expand Down
6 changes: 3 additions & 3 deletions tembo-operator/src/apis/coredb_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ const TLS_MIN_VERSION: &str = "TLSv1.2";
/// mainly used for the [https://tembo.io](https://tembo.io) platform to allow
/// for the deployment of pre-configured Postgres instances.
///
/// Standard, OLAP and the MessageQueue stacks are some of the common stacks configured
/// Standard, Analytics and the MessageQueue stacks are some of the common stacks configured
///
/// **Example**: Deploy a OLAP stack
/// **Example**: Deploy a Analytics stack
///
/// ```yaml
/// apiVersion: coredb.io/v1alpha1
Expand All @@ -42,7 +42,7 @@ const TLS_MIN_VERSION: &str = "TLSv1.2";
/// name: test-db
/// spec:
/// stack:
/// name: OLAP
/// name: Analytics
/// postgres_config:
/// - name: checkpoint_timeout
/// value: "30min"
Expand Down
Loading

0 comments on commit 0b4ffec

Please sign in to comment.