From 8887b4596a2225686c7a1d9335298ca3354e39e2 Mon Sep 17 00:00:00 2001 From: Evan H Stanton <79367212+EvanHStanton@users.noreply.github.com> Date: Tue, 5 Dec 2023 11:48:44 -0500 Subject: [PATCH 1/3] Geospatial stack (#397) --- examples/run-tembo-locally/Dockerfile | 1 + tembo-operator/Cargo.lock | 2 +- tembo-operator/Cargo.toml | 2 +- .../src/extensions/database_queries.rs | 1 - tembo-operator/src/stacks/config_engines.rs | 1 - tembo-operator/src/stacks/mod.rs | 3 + tembo-operator/src/stacks/templates/gis.yaml | 55 +++++++++++++++++++ tembo-operator/src/stacks/types.rs | 4 +- tembo-operator/tests/integration_tests.rs | 1 - 9 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 tembo-operator/src/stacks/templates/gis.yaml diff --git a/examples/run-tembo-locally/Dockerfile b/examples/run-tembo-locally/Dockerfile index 103912dd5..b064be822 100644 --- a/examples/run-tembo-locally/Dockerfile +++ b/examples/run-tembo-locally/Dockerfile @@ -1,6 +1,7 @@ FROM quay.io/tembo/tembo-pg-cnpg:latest USER root + RUN chown -R postgres:postgres $PGDATA && \ chmod -R 0700 $PGDATA ENV PGDATA /var/lib/postgresql/data2 diff --git a/tembo-operator/Cargo.lock b/tembo-operator/Cargo.lock index e65f7c66b..ceafdc0e1 100644 --- a/tembo-operator/Cargo.lock +++ b/tembo-operator/Cargo.lock @@ -494,7 +494,7 @@ dependencies = [ [[package]] name = "controller" -version = "0.21.4" +version = "0.22.0" dependencies = [ "actix-web", "anyhow", diff --git a/tembo-operator/Cargo.toml b/tembo-operator/Cargo.toml index 1cb2ad97c..c49d574dc 100644 --- a/tembo-operator/Cargo.toml +++ b/tembo-operator/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "controller" description = "Tembo Operator for Postgres" -version = "0.21.4" +version = "0.22.0" edition = "2021" default-run = "controller" license = "Apache-2.0" diff --git a/tembo-operator/src/extensions/database_queries.rs b/tembo-operator/src/extensions/database_queries.rs index 15a2128e1..d395f765f 100644 --- a/tembo-operator/src/extensions/database_queries.rs +++ b/tembo-operator/src/extensions/database_queries.rs @@ -215,7 +215,6 @@ pub async fn is_not_restarting( })? .into(); - let pg_postmaster = match pg_postmaster_result { Ok(result) => result.stdout.ok_or_else(|| { error!("{cdb_name}: select pg_postmaster_start_time() had no stdout"); diff --git a/tembo-operator/src/stacks/config_engines.rs b/tembo-operator/src/stacks/config_engines.rs index 9e5325702..b295e2e35 100644 --- a/tembo-operator/src/stacks/config_engines.rs +++ b/tembo-operator/src/stacks/config_engines.rs @@ -136,7 +136,6 @@ pub fn mq_config_engine(stack: &Stack) -> Vec { configs } - // olap formula for max_parallel_workers_per_gather fn olap_max_parallel_workers_per_gather(cpu: i32) -> i32 { // higher of default (2) or 0.5 * cpu diff --git a/tembo-operator/src/stacks/mod.rs b/tembo-operator/src/stacks/mod.rs index 15888ed92..3948660d7 100644 --- a/tembo-operator/src/stacks/mod.rs +++ b/tembo-operator/src/stacks/mod.rs @@ -20,6 +20,8 @@ lazy_static! { serde_yaml::from_str(include_str!("templates/oltp.yaml")).expect("oltp.yaml not found"); pub static ref VECTOR_DB: Stack = serde_yaml::from_str(include_str!("templates/vectordb.yaml")).expect("vectordb.yaml not found"); + pub static ref GEOSPATIAL: Stack = + serde_yaml::from_str(include_str!("templates/gis.yaml")).expect("gis.yaml not found"); } pub fn get_stack(entity: StackType) -> types::Stack { @@ -31,5 +33,6 @@ pub fn get_stack(entity: StackType) -> types::Stack { StackType::OLAP => OLAP.clone(), StackType::OLTP => OLTP.clone(), StackType::VectorDB => VECTOR_DB.clone(), + StackType::Geospatial => GEOSPATIAL.clone(), } } diff --git a/tembo-operator/src/stacks/templates/gis.yaml b/tembo-operator/src/stacks/templates/gis.yaml new file mode 100644 index 000000000..55aeb162a --- /dev/null +++ b/tembo-operator/src/stacks/templates/gis.yaml @@ -0,0 +1,55 @@ +name: Geospatial +description: Postgres for geospatial workloads. +image: "quay.io/tembo/standard-cnpg:15.3.0-1-1096aeb" +stack_version: 0.1.0 +compute_templates: + - cpu: 1 + memory: 4Gi + - cpu: 2 + memory: 8Gi + - cpu: 4 + memory: 16Gi + - cpu: 8 + memory: 32Gi + - cpu: 16 + memory: 32Gi +postgres_config_engine: standard +postgres_config: + - name: autovacuum_vacuum_cost_limit + value: -1 + - name: autovacuum_vacuum_scale_factor + value: 0.05 + - name: autovacuum_vacuum_insert_scale_factor + value: 0.05 + - name: autovacuum_analyze_scale_factor + value: 0.05 + - name: checkpoint_timeout + value: 10min + - name: track_activity_query_size + value: 2048 + - name: wal_compression + value: 'on' + - name: track_io_timing + value: 'on' + - name: log_min_duration_statement # https://www.postgresql.org/docs/15/runtime-config-logging.html + value: 1000 + - name: pg_stat_statements.track + value: all + - name: shared_preload_libraries + value: pg_stat_statements +trunk_installs: + - name: pg_stat_statements + version: 1.10.0 + - name: postgis + version: 3.4.0 +extensions: + - name: pg_stat_statements + locations: + - database: postgres + enabled: true + version: 1.10.0 + - name: postgis + locations: + - database: postgres + enabled: true + version: 3.4.0 diff --git a/tembo-operator/src/stacks/types.rs b/tembo-operator/src/stacks/types.rs index 2f1fc26a0..b034b076b 100644 --- a/tembo-operator/src/stacks/types.rs +++ b/tembo-operator/src/stacks/types.rs @@ -10,7 +10,6 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use utoipa::ToSchema; - #[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, ToSchema)] pub enum StackType { DataWarehouse, @@ -21,6 +20,7 @@ pub enum StackType { #[default] OLTP, VectorDB, + Geospatial, } impl std::str::FromStr for StackType { @@ -35,6 +35,7 @@ impl std::str::FromStr for StackType { "OLAP" => Ok(StackType::OLAP), "OLTP" => Ok(StackType::OLTP), "VectorDB" => Ok(StackType::VectorDB), + "Geospatial" => Ok(StackType::Geospatial), _ => Err("invalid value"), } } @@ -50,6 +51,7 @@ impl StackType { StackType::OLAP => "OLAP", StackType::OLTP => "OLTP", StackType::VectorDB => "VectorDB", + StackType::Geospatial => "Geospatial", } } } diff --git a/tembo-operator/tests/integration_tests.rs b/tembo-operator/tests/integration_tests.rs index ac01198d4..7fcb63671 100644 --- a/tembo-operator/tests/integration_tests.rs +++ b/tembo-operator/tests/integration_tests.rs @@ -1159,7 +1159,6 @@ mod test { } }); - // Use the patch method to update the Cluster resource let params = PatchParams::default(); let patch = Patch::Merge(patch_json); From c17bbbacac23354eaff045243331b543f6779bf8 Mon Sep 17 00:00:00 2001 From: Steven Miller Date: Tue, 5 Dec 2023 14:06:47 -0500 Subject: [PATCH 2/3] Rename ArgoCD commit message --- .github/actions/argocd-update/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/argocd-update/action.yml b/.github/actions/argocd-update/action.yml index bf72fcf72..3cd41dc21 100644 --- a/.github/actions/argocd-update/action.yml +++ b/.github/actions/argocd-update/action.yml @@ -74,5 +74,5 @@ runs: git add --all # debugging git diff HEAD - git commit -m "Update from tembo-io/tembo-stacks: ${{ inputs.version }}" + git commit -m "Update from tembo-io/tembo: ${{ inputs.version }}" git push origin ${{ inputs.branch }} From e73a9f850ff5356de8ce4ac6f4dec4f6a38e381e Mon Sep 17 00:00:00 2001 From: Steven Miller Date: Tue, 5 Dec 2023 14:11:37 -0500 Subject: [PATCH 3/3] Fix deployment workflow after repository consolidation --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 179091a88..cdbad3fe6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -32,7 +32,7 @@ jobs: # This allows for filtering out unchanged directories # in a pull request, and using all directories on the release # or main branches. - changed_relative_to_branch: ${{ github.base_ref || 'not-a-branch' }} + changed_relative_to_ref: origin/${{ github.base_ref || 'not-a-branch' }} ignore_dirs: ".coredb examples" build_and_push_images: