Skip to content

Commit

Permalink
CI Fix for CLI (#978)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuajerin authored Oct 4, 2024
1 parent 9e3b87a commit 867808a
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 12 deletions.
10 changes: 5 additions & 5 deletions tembo-cli/Cargo.lock

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

6 changes: 3 additions & 3 deletions tembo-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ dateparser = "0.2.0"
log = "0.4.20"
tera = "1.18.1"
curl = "0.4.44"
temboclient = { version = "1.0.3", path = "temboclient" }
temboclient = { version = "1.0.4", path = "temboclient" }
tembodataclient = { version = "0.0.2", path = "tembodataclient" }
tokio = { version = "1.26.0", features = [
"rt",
Expand All @@ -65,7 +65,7 @@ tokio = { version = "1.26.0", features = [
tungstenite ="0.21.0"
futures-util = "0.3.30"
dirs = "5.0.1"
controller = "0.50.0"
controller = "0.50.1"
sqlx = { version = "0.8.2", features = ["runtime-tokio-native-tls", "postgres", "chrono", "json"] }
base64 = "0.21.5"
colorful = "0.2.2"
Expand All @@ -75,7 +75,7 @@ tiny-gradient = "0.1.0"
urlencoding = "2.1.3"
spinoff = "0.8.0"
k8s-openapi = { version = "0.18.0", features = ["v1_25", "schemars"], default-features = false }
tembo-stacks = "0.16.2"
tembo-stacks = "0.16.7"
itertools = "0.12.1"
random-string = "1.1.0"
test-case = "=2.0.0-rc2"
Expand Down
16 changes: 13 additions & 3 deletions tembo-cli/src/cmd/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,6 @@ pub fn get_rendered_dockerfile(
_ => &stack.images.pg15,
};

// Sorts trunk_installs so the installation order is deterministic, also make sure vector is last
if let Some(mut installs) = trunk_installs.as_ref().cloned() {
// Sort by name, but ensure "vector" is always last
installs.sort_by(|a, b| a.name.to_lowercase().cmp(&b.name.to_lowercase()));
Expand Down Expand Up @@ -1389,14 +1388,25 @@ async fn get_trunk_projects(name: &String) -> Result<Vec<TrunkProject>, Error> {
pub fn get_rendered_dockercompose(
instance_settings: HashMap<String, InstanceSettings>,
) -> Result<String, anyhow::Error> {
// Include the docker-compose template directly into the binary
let contents = include_str!("../../tembo/docker-compose.yml.template");

let mut tera = Tera::new("templates/**/*").unwrap();
let _ = tera.add_raw_template("docker-compose", contents);
let mut context = Context::new();

context.insert("instance_settings", &instance_settings);
// replace the image for VectorDB
let mut updated_instance_settings = instance_settings.clone();
for (_key, instance) in updated_instance_settings.iter_mut() {
if instance.stack_type == Some("VectorDB".to_string()) {
if let Some(app_services) = &mut instance.controller_app_services {
if let Some(embeddings) = app_services.get_mut("embeddings") {
embeddings.image = "quay.io/tembo/vector-serve:latest".to_string();
}
}
}
}

context.insert("instance_settings", &updated_instance_settings);

let rendered_dockercompose = tera.render("docker-compose", &context).unwrap();

Expand Down
2 changes: 1 addition & 1 deletion tembo-cli/temboclient/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "temboclient"
version = "1.0.3"
version = "1.0.4"
authors = ["OpenAPI Generator team and contributors"]
description = "Platform API for Tembo Cloud </br> </br> To find a Tembo Data API, please find it here: </br> </br> [AWS US East 1](https://api.data-1.use1.tembo.io/swagger-ui/) "
# Override this license by providing a License Object in the OpenAPI.
Expand Down
2 changes: 2 additions & 0 deletions tembo-cli/temboclient/src/models/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ impl FromStr for Memory {
"8Gi" => Ok(Memory::Variant8Gi),
"16Gi" => Ok(Memory::Variant16Gi),
"32Gi" => Ok(Memory::Variant32Gi),
"64Gi" => Ok(Memory::Variant64Gi),
_ => Err(()),
}
}
Expand Down Expand Up @@ -83,6 +84,7 @@ impl FromStr for StackType {
"MongoAlternative" => Ok(StackType::MongoAlternative),
"RAG" => Ok(StackType::Rag),
"Timeseries" => Ok(StackType::Timeseries),
"ParadeDB" => Ok(StackType::ParadeDB),
_ => Err(()),
}
}
Expand Down
3 changes: 3 additions & 0 deletions tembo-cli/temboclient/src/models/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ pub enum Memory {
Variant16Gi,
#[serde(rename = "32Gi")]
Variant32Gi,
#[serde(rename = "64Gi")]
Variant64Gi,
}

impl ToString for Memory {
Expand All @@ -34,6 +36,7 @@ impl ToString for Memory {
Self::Variant8Gi => String::from("8Gi"),
Self::Variant16Gi => String::from("16Gi"),
Self::Variant32Gi => String::from("32Gi"),
Self::Variant64Gi => String::from("64Gi"),
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions tembo-cli/temboclient/src/models/stack_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ pub enum StackType {
Rag,
#[serde(rename = "Timeseries")]
Timeseries,
#[serde(rename = "ParadeDB")]
ParadeDB,
}

impl ToString for StackType {
Expand All @@ -52,6 +54,7 @@ impl ToString for StackType {
Self::MongoAlternative => String::from("MongoAlternative"),
Self::Rag => String::from("RAG"),
Self::Timeseries => String::from("Timeseries"),
Self::ParadeDB => String::from("ParadeDB"),
}
}
}
Expand Down

0 comments on commit 867808a

Please sign in to comment.