From a2acd17ce60e928d7ae9c25369c563960301fa8d Mon Sep 17 00:00:00 2001 From: Prashant Date: Sat, 26 Apr 2025 23:06:15 -0700 Subject: [PATCH 1/4] Doc: Add getting started with jdbc source --- .../src/main/resources/postgres/schema-v1.sql | 1 - getting-started/jdbc/README.md | 92 ++++++++++++++++ .../jdbc/docker-compose-bootstrap-db.yml | 54 ++++++++++ .../jdbc/docker-compose-postgres.yml | 53 ++++++++++ getting-started/jdbc/docker-compose.yml | 100 ++++++++++++++++++ getting-started/jdbc/postgresql.conf | 46 ++++++++ .../trino-config/catalog/iceberg.properties | 28 +++++ 7 files changed, 373 insertions(+), 1 deletion(-) create mode 100644 getting-started/jdbc/README.md create mode 100644 getting-started/jdbc/docker-compose-bootstrap-db.yml create mode 100644 getting-started/jdbc/docker-compose-postgres.yml create mode 100644 getting-started/jdbc/docker-compose.yml create mode 100644 getting-started/jdbc/postgresql.conf create mode 100644 getting-started/jdbc/trino-config/catalog/iceberg.properties diff --git a/extension/persistence/relational-jdbc/src/main/resources/postgres/schema-v1.sql b/extension/persistence/relational-jdbc/src/main/resources/postgres/schema-v1.sql index 25acd2ed0f..c9fcbc4488 100644 --- a/extension/persistence/relational-jdbc/src/main/resources/postgres/schema-v1.sql +++ b/extension/persistence/relational-jdbc/src/main/resources/postgres/schema-v1.sql @@ -79,7 +79,6 @@ COMMENT ON COLUMN grant_records.grantee_catalog_id IS 'catalog id of the grantee COMMENT ON COLUMN grant_records.grantee_id IS 'id of the grantee'; COMMENT ON COLUMN grant_records.privilege_code IS 'privilege code'; - CREATE TABLE IF NOT EXISTS principal_authentication_data ( realm_id TEXT NOT NULL, principal_id BIGINT NOT NULL, diff --git a/getting-started/jdbc/README.md b/getting-started/jdbc/README.md new file mode 100644 index 0000000000..05bf0d8f3b --- /dev/null +++ b/getting-started/jdbc/README.md @@ -0,0 +1,92 @@ + + +# Getting Started with Apache Polaris, Relational JDBC, Postgres and Spark SQL + +This example requires `jq` to be installed on your machine. + +1. If such an image is not already present, build the Polaris image with support for EclipseLink and + the Postgres JDBC driver: + + ```shell + ./gradlew \ + :polaris-quarkus-server:assemble \ + :polaris-quarkus-server:quarkusAppPartsBuild --rerun \ + :polaris-quarkus-admin:assemble \ + :polaris-quarkus-admin:quarkusAppPartsBuild --rerun \ + -Dquarkus.container-image.tag=postgres-latest \ + -Dquarkus.container-image.build=true + ``` + +2. Start the docker compose group by running the following command from the root of the repository: + + ```shell + docker compose -f getting-started/jdbc/docker-compose-postgres.yml -f getting-started/jdbc/docker-compose-bootstrap-db.yml -f getting-started/jdbc/docker-compose.yml up + ``` + +3. Using spark-sql: attach to the running spark-sql container: + + ```shell + docker attach $(docker ps -q --filter name=spark-sql) + ``` + + You may not see Spark's prompt immediately, type ENTER to see it. A few commands that you can try: + + ```sql + CREATE NAMESPACE polaris.ns1; + USE polaris.ns1; + CREATE TABLE table1 (id int, name string); + INSERT INTO table1 VALUES (1, 'a'); + SELECT * FROM table1; + ``` + +4. To access Polaris from the host machine, first request an access token: + + ```shell + export POLARIS_TOKEN=$(curl -s http://polaris:8181/api/catalog/v1/oauth/tokens \ + --resolve polaris:8181:127.0.0.1 \ + --user root:s3cr3t \ + -d 'grant_type=client_credentials' \ + -d 'scope=PRINCIPAL_ROLE:ALL' | jq -r .access_token) + ``` + +5. Then, use the access token in the Authorization header when accessing Polaris: + + ```shell + curl -v http://127.0.0.1:8181/api/management/v1/principal-roles -H "Authorization: Bearer $POLARIS_TOKEN" + curl -v http://127.0.0.1:8181/api/management/v1/catalogs/quickstart_catalog -H "Authorization: Bearer $POLARIS_TOKEN" + ``` + +6. Using Trino CLI: To access the Trino CLI, run this command: +``` +docker exec -it jdbc-trino-1 trino +``` +Note, `trino-trino-1` is the name of the Docker container. + +Example Trino queries: +``` +SHOW CATALOGS; +SHOW SCHEMAS FROM iceberg; +SHOW TABLES FROM iceberg.information_schema; +DESCRIBE iceberg.information_schema.tables; + +CREATE SCHEMA iceberg.tpch; +CREATE TABLE iceberg.tpch.test_polaris AS SELECT 1 x; +SELECT * FROM iceberg.tpch.test_polaris; +``` diff --git a/getting-started/jdbc/docker-compose-bootstrap-db.yml b/getting-started/jdbc/docker-compose-bootstrap-db.yml new file mode 100644 index 0000000000..46d88ffa40 --- /dev/null +++ b/getting-started/jdbc/docker-compose-bootstrap-db.yml @@ -0,0 +1,54 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +services: + polaris-purge: + # IMPORTANT: the image MUST contain the Postgres JDBC driver and EclipseLink dependencies, see README for instructions + image: apache/polaris-admin-tool:postgres-latest + environment: + polaris.persistence.type: relational-jdbc + quarkus.datasource.db-kind: pgsql + quarkus.datasource.jdbc.url: jdbc:postgresql://postgres:5432/POLARIS + quarkus.datasource.username: postgres + quarkus.datasource.password: postgres + command: + - "purge" + - "--realm=POLARIS" + + polaris-bootstrap: + # IMPORTANT: the image MUST contain the Postgres JDBC driver and EclipseLink dependencies, see README for instructions + image: apache/polaris-admin-tool:postgres-latest + environment: + polaris.persistence.type: relational-jdbc + quarkus.datasource.db-kind: pgsql + quarkus.datasource.jdbc.url: jdbc:postgresql://postgres:5432/POLARIS + quarkus.datasource.username: postgres + quarkus.datasource.password: postgres + command: + - "bootstrap" + - "--realm=POLARIS" + - "--credential=POLARIS,root,s3cr3t" + depends_on: + polaris-purge: + condition: service_started + + polaris: + depends_on: + polaris-bootstrap: + condition: service_completed_successfully diff --git a/getting-started/jdbc/docker-compose-postgres.yml b/getting-started/jdbc/docker-compose-postgres.yml new file mode 100644 index 0000000000..5bd06b8b23 --- /dev/null +++ b/getting-started/jdbc/docker-compose-postgres.yml @@ -0,0 +1,53 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +services: + postgres: + image: postgres:17.4 + ports: + - "5432:5432" + # set shared memory limit when using docker-compose + shm_size: 128mb + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: POLARIS + POSTGRES_INITDB_ARGS: "--encoding UTF8 --data-checksums" + volumes: + # Bind local conf file to a convenient location in the container + - type: bind + source: ./postgresql.conf + target: /etc/postgresql/postgresql.conf + command: + - "postgres" + - "-c" + - "config_file=/etc/postgresql/postgresql.conf" + healthcheck: + test: "pg_isready -U postgres" + interval: 5s + timeout: 2s + retries: 15 + polaris-bootstrap: + depends_on: + postgres: + condition: service_healthy + polaris: + depends_on: + postgres: + condition: service_healthy diff --git a/getting-started/jdbc/docker-compose.yml b/getting-started/jdbc/docker-compose.yml new file mode 100644 index 0000000000..f77582e70d --- /dev/null +++ b/getting-started/jdbc/docker-compose.yml @@ -0,0 +1,100 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +services: + + polaris: + # IMPORTANT: the image MUST contain the Postgres JDBC driver and EclipseLink dependencies, see README for instructions + image: apache/polaris:postgres-latest + ports: + # API port + - "8181:8181" + # Management port (metrics and health checks) + - "8182:8182" + # Optional, allows attaching a debugger to the Polaris JVM + - "5005:5005" + environment: + JAVA_DEBUG: "true" + JAVA_DEBUG_PORT: "*:5005" + polaris.persistence.type: relational-jdbc + quarkus.datasource.db-kind: pgsql + quarkus.datasource.jdbc.url: jdbc:postgresql://postgres:5432/POLARIS + quarkus.datasource.username: postgres + quarkus.datasource.password: postgres + polaris.realm-context.realms: POLARIS + quarkus.otel.sdk.disabled: "true" + healthcheck: + test: ["CMD", "curl", "http://localhost:8182/q/health"] + interval: 2s + timeout: 10s + retries: 10 + start_period: 10s + + polaris-setup: + image: alpine/curl + depends_on: + polaris: + condition: service_healthy + environment: + - STORAGE_LOCATION=${STORAGE_LOCATION} + - AWS_ROLE_ARN=${AWS_ROLE_ARN} + - AZURE_TENANT_ID=${AZURE_TENANT_ID} + volumes: + - ../assets/polaris/:/polaris + entrypoint: '/bin/sh -c "chmod +x /polaris/create-catalog.sh && /polaris/create-catalog.sh"' + + spark-sql: + image: apache/spark:3.5.5-java17-python3 + depends_on: + polaris-setup: + condition: service_completed_successfully + stdin_open: true + tty: true + ports: + - "4040-4045:4040-4045" + healthcheck: + test: "curl localhost:4040" + interval: 5s + retries: 15 + command: [ + /opt/spark/bin/spark-sql, + --packages, "org.apache.iceberg:iceberg-spark-runtime-3.5_2.12:1.7.0,software.amazon.awssdk:bundle:2.28.17,software.amazon.awssdk:url-connection-client:2.28.17,org.apache.iceberg:iceberg-gcp-bundle:1.7.0,org.apache.iceberg:iceberg-azure-bundle:1.7.0", + --conf, "spark.sql.extensions=org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions", + --conf, "spark.sql.catalog.polaris=org.apache.iceberg.spark.SparkCatalog", + --conf, "spark.sql.catalog.polaris.type=rest", + --conf, "spark.sql.catalog.polaris.warehouse=quickstart_catalog", + --conf, "spark.sql.catalog.polaris.uri=http://polaris:8181/api/catalog", + --conf, "spark.sql.catalog.polaris.credential=root:s3cr3t", + --conf, "spark.sql.catalog.polaris.scope=PRINCIPAL_ROLE:ALL", + --conf, "spark.sql.defaultCatalog=polaris", + --conf, "spark.sql.catalogImplementation=in-memory", + --conf, "spark.driver.extraJavaOptions=-Divy.cache.dir=/tmp -Divy.home=/tmp" + ] + + trino: + image: trinodb/trino:latest + depends_on: + polaris-setup: + condition: service_completed_successfully + stdin_open: true + tty: true + ports: + - "8080:8080" + volumes: + - ./trino-config/catalog:/etc/trino/catalog diff --git a/getting-started/jdbc/postgresql.conf b/getting-started/jdbc/postgresql.conf new file mode 100644 index 0000000000..5594b72c16 --- /dev/null +++ b/getting-started/jdbc/postgresql.conf @@ -0,0 +1,46 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# This contains the postgres config settings provided to the startup command +# as "postgres -c config_file=". +# +# See https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/postgresql.conf.sample +# for more config options. + +# Required standard settings normally specified in default config +listen_addresses = '*' +max_connections = 100 + +shared_buffers = 128MB +dynamic_shared_memory_type = posix + +max_wal_size = 1GB +min_wal_size = 80MB + +log_timezone = 'Etc/UTC' +datestyle = 'iso, mdy' +timezone = 'Etc/UTC' + + +# Custom settings below + +# NOTE: It's best practice to explicitly set the isolation level from the +# application layer where possible, but in some cases this requires careful +# configuration to inject settings into JPA frameworks. This is provided here +# for defense-in-depth and for illustrative purposes if database customization +# is desired. +default_transaction_isolation = 'serializable' diff --git a/getting-started/jdbc/trino-config/catalog/iceberg.properties b/getting-started/jdbc/trino-config/catalog/iceberg.properties new file mode 100644 index 0000000000..28c3c61faa --- /dev/null +++ b/getting-started/jdbc/trino-config/catalog/iceberg.properties @@ -0,0 +1,28 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +connector.name=iceberg +iceberg.catalog.type=rest +iceberg.rest-catalog.uri=http://polaris:8181/api/catalog +iceberg.rest-catalog.security=OAUTH2 +iceberg.rest-catalog.oauth2.credential=root:s3cr3t +iceberg.rest-catalog.oauth2.scope=PRINCIPAL_ROLE:ALL +iceberg.rest-catalog.warehouse=quickstart_catalog +# Required to support local filesystem: https://trino.io/docs/current/object-storage.html#configuration +fs.hadoop.enabled=true From a118344ba4167e86128a26c25c00ce1eafb98f7d Mon Sep 17 00:00:00 2001 From: Prashant Date: Sun, 27 Apr 2025 08:54:38 -0700 Subject: [PATCH 2/4] code reuse --- .../postgres}/postgresql.conf | 0 .../trino-config/catalog/iceberg.properties | 0 .../eclipselink/docker-compose-postgres.yml | 2 +- .../eclipselink/docker-compose.yml | 2 +- .../jdbc/docker-compose-postgres.yml | 2 +- getting-started/jdbc/docker-compose.yml | 2 +- getting-started/jdbc/postgresql.conf | 46 ------------------- .../trino-config/catalog/iceberg.properties | 28 ----------- 8 files changed, 4 insertions(+), 78 deletions(-) rename getting-started/{eclipselink => assets/postgres}/postgresql.conf (100%) rename getting-started/{eclipselink => assets}/trino-config/catalog/iceberg.properties (100%) delete mode 100644 getting-started/jdbc/postgresql.conf delete mode 100644 getting-started/jdbc/trino-config/catalog/iceberg.properties diff --git a/getting-started/eclipselink/postgresql.conf b/getting-started/assets/postgres/postgresql.conf similarity index 100% rename from getting-started/eclipselink/postgresql.conf rename to getting-started/assets/postgres/postgresql.conf diff --git a/getting-started/eclipselink/trino-config/catalog/iceberg.properties b/getting-started/assets/trino-config/catalog/iceberg.properties similarity index 100% rename from getting-started/eclipselink/trino-config/catalog/iceberg.properties rename to getting-started/assets/trino-config/catalog/iceberg.properties diff --git a/getting-started/eclipselink/docker-compose-postgres.yml b/getting-started/eclipselink/docker-compose-postgres.yml index 321c19e54b..6da3782b83 100644 --- a/getting-started/eclipselink/docker-compose-postgres.yml +++ b/getting-started/eclipselink/docker-compose-postgres.yml @@ -32,7 +32,7 @@ services: volumes: # Bind local conf file to a convenient location in the container - type: bind - source: ./postgresql.conf + source: ../assets/postgres/postgresql.conf target: /etc/postgresql/postgresql.conf command: - "postgres" diff --git a/getting-started/eclipselink/docker-compose.yml b/getting-started/eclipselink/docker-compose.yml index 985a6a9e54..ba5d024914 100644 --- a/getting-started/eclipselink/docker-compose.yml +++ b/getting-started/eclipselink/docker-compose.yml @@ -96,4 +96,4 @@ services: ports: - "8080:8080" volumes: - - ./trino-config/catalog:/etc/trino/catalog + - ../assets/trino-config/catalog:/etc/trino/catalog diff --git a/getting-started/jdbc/docker-compose-postgres.yml b/getting-started/jdbc/docker-compose-postgres.yml index 5bd06b8b23..f88329b36d 100644 --- a/getting-started/jdbc/docker-compose-postgres.yml +++ b/getting-started/jdbc/docker-compose-postgres.yml @@ -32,7 +32,7 @@ services: volumes: # Bind local conf file to a convenient location in the container - type: bind - source: ./postgresql.conf + source: ../assets/postgres/postgresql.conf target: /etc/postgresql/postgresql.conf command: - "postgres" diff --git a/getting-started/jdbc/docker-compose.yml b/getting-started/jdbc/docker-compose.yml index f77582e70d..ce593597a6 100644 --- a/getting-started/jdbc/docker-compose.yml +++ b/getting-started/jdbc/docker-compose.yml @@ -97,4 +97,4 @@ services: ports: - "8080:8080" volumes: - - ./trino-config/catalog:/etc/trino/catalog + - ../assets/trino-config/catalog:/etc/trino/catalog diff --git a/getting-started/jdbc/postgresql.conf b/getting-started/jdbc/postgresql.conf deleted file mode 100644 index 5594b72c16..0000000000 --- a/getting-started/jdbc/postgresql.conf +++ /dev/null @@ -1,46 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# This contains the postgres config settings provided to the startup command -# as "postgres -c config_file=". -# -# See https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/postgresql.conf.sample -# for more config options. - -# Required standard settings normally specified in default config -listen_addresses = '*' -max_connections = 100 - -shared_buffers = 128MB -dynamic_shared_memory_type = posix - -max_wal_size = 1GB -min_wal_size = 80MB - -log_timezone = 'Etc/UTC' -datestyle = 'iso, mdy' -timezone = 'Etc/UTC' - - -# Custom settings below - -# NOTE: It's best practice to explicitly set the isolation level from the -# application layer where possible, but in some cases this requires careful -# configuration to inject settings into JPA frameworks. This is provided here -# for defense-in-depth and for illustrative purposes if database customization -# is desired. -default_transaction_isolation = 'serializable' diff --git a/getting-started/jdbc/trino-config/catalog/iceberg.properties b/getting-started/jdbc/trino-config/catalog/iceberg.properties deleted file mode 100644 index 28c3c61faa..0000000000 --- a/getting-started/jdbc/trino-config/catalog/iceberg.properties +++ /dev/null @@ -1,28 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -connector.name=iceberg -iceberg.catalog.type=rest -iceberg.rest-catalog.uri=http://polaris:8181/api/catalog -iceberg.rest-catalog.security=OAUTH2 -iceberg.rest-catalog.oauth2.credential=root:s3cr3t -iceberg.rest-catalog.oauth2.scope=PRINCIPAL_ROLE:ALL -iceberg.rest-catalog.warehouse=quickstart_catalog -# Required to support local filesystem: https://trino.io/docs/current/object-storage.html#configuration -fs.hadoop.enabled=true From 5e0681b7edbd569054d0a81916bf62e420e50987 Mon Sep 17 00:00:00 2001 From: Prashant Date: Thu, 1 May 2025 15:26:24 -0700 Subject: [PATCH 3/4] Addres review feedback --- .../postgres}/docker-compose-postgres.yml | 0 getting-started/eclipselink/README.md | 2 +- getting-started/jdbc/README.md | 8 +-- .../jdbc/docker-compose-bootstrap-db.yml | 16 ------ .../jdbc/docker-compose-postgres.yml | 53 ------------------- getting-started/jdbc/docker-compose.yml | 2 +- 6 files changed, 6 insertions(+), 75 deletions(-) rename getting-started/{eclipselink => assets/postgres}/docker-compose-postgres.yml (100%) delete mode 100644 getting-started/jdbc/docker-compose-postgres.yml diff --git a/getting-started/eclipselink/docker-compose-postgres.yml b/getting-started/assets/postgres/docker-compose-postgres.yml similarity index 100% rename from getting-started/eclipselink/docker-compose-postgres.yml rename to getting-started/assets/postgres/docker-compose-postgres.yml diff --git a/getting-started/eclipselink/README.md b/getting-started/eclipselink/README.md index 29c75adc9e..aaeac63714 100644 --- a/getting-started/eclipselink/README.md +++ b/getting-started/eclipselink/README.md @@ -37,7 +37,7 @@ This example requires `jq` to be installed on your machine. 2. Start the docker compose group by running the following command from the root of the repository: ```shell - docker compose -f getting-started/eclipselink/docker-compose-postgres.yml -f getting-started/eclipselink/docker-compose-bootstrap-db.yml -f getting-started/eclipselink/docker-compose.yml up + docker compose -f getting-started/eclipselink/docker-compose-bootstrap-db.yml -f getting-started/assets/postgres/docker-compose-postgres.yml -f getting-started/eclipselink/docker-compose.yml up ``` 3. Using spark-sql: attach to the running spark-sql container: diff --git a/getting-started/jdbc/README.md b/getting-started/jdbc/README.md index 05bf0d8f3b..15dcaed2a2 100644 --- a/getting-started/jdbc/README.md +++ b/getting-started/jdbc/README.md @@ -21,7 +21,7 @@ This example requires `jq` to be installed on your machine. -1. If such an image is not already present, build the Polaris image with support for EclipseLink and +1. If such an image is not already present, build the Polaris image with support for JDBC persistence and the Postgres JDBC driver: ```shell @@ -37,7 +37,7 @@ This example requires `jq` to be installed on your machine. 2. Start the docker compose group by running the following command from the root of the repository: ```shell - docker compose -f getting-started/jdbc/docker-compose-postgres.yml -f getting-started/jdbc/docker-compose-bootstrap-db.yml -f getting-started/jdbc/docker-compose.yml up + docker compose -f getting-started/jdbc/docker-compose-bootstrap-db.yml -f getting-started/assets/postgres/docker-compose-postgres.yml -f getting-started/jdbc/docker-compose.yml up ``` 3. Using spark-sql: attach to the running spark-sql container: @@ -74,10 +74,10 @@ This example requires `jq` to be installed on your machine. ``` 6. Using Trino CLI: To access the Trino CLI, run this command: -``` +```shell docker exec -it jdbc-trino-1 trino ``` -Note, `trino-trino-1` is the name of the Docker container. +Note, `jdbc-trino-1` is the name of the Docker container. Example Trino queries: ``` diff --git a/getting-started/jdbc/docker-compose-bootstrap-db.yml b/getting-started/jdbc/docker-compose-bootstrap-db.yml index 46d88ffa40..a98da5bc44 100644 --- a/getting-started/jdbc/docker-compose-bootstrap-db.yml +++ b/getting-started/jdbc/docker-compose-bootstrap-db.yml @@ -18,19 +18,6 @@ # services: - polaris-purge: - # IMPORTANT: the image MUST contain the Postgres JDBC driver and EclipseLink dependencies, see README for instructions - image: apache/polaris-admin-tool:postgres-latest - environment: - polaris.persistence.type: relational-jdbc - quarkus.datasource.db-kind: pgsql - quarkus.datasource.jdbc.url: jdbc:postgresql://postgres:5432/POLARIS - quarkus.datasource.username: postgres - quarkus.datasource.password: postgres - command: - - "purge" - - "--realm=POLARIS" - polaris-bootstrap: # IMPORTANT: the image MUST contain the Postgres JDBC driver and EclipseLink dependencies, see README for instructions image: apache/polaris-admin-tool:postgres-latest @@ -44,9 +31,6 @@ services: - "bootstrap" - "--realm=POLARIS" - "--credential=POLARIS,root,s3cr3t" - depends_on: - polaris-purge: - condition: service_started polaris: depends_on: diff --git a/getting-started/jdbc/docker-compose-postgres.yml b/getting-started/jdbc/docker-compose-postgres.yml deleted file mode 100644 index f88329b36d..0000000000 --- a/getting-started/jdbc/docker-compose-postgres.yml +++ /dev/null @@ -1,53 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -services: - postgres: - image: postgres:17.4 - ports: - - "5432:5432" - # set shared memory limit when using docker-compose - shm_size: 128mb - environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: POLARIS - POSTGRES_INITDB_ARGS: "--encoding UTF8 --data-checksums" - volumes: - # Bind local conf file to a convenient location in the container - - type: bind - source: ../assets/postgres/postgresql.conf - target: /etc/postgresql/postgresql.conf - command: - - "postgres" - - "-c" - - "config_file=/etc/postgresql/postgresql.conf" - healthcheck: - test: "pg_isready -U postgres" - interval: 5s - timeout: 2s - retries: 15 - polaris-bootstrap: - depends_on: - postgres: - condition: service_healthy - polaris: - depends_on: - postgres: - condition: service_healthy diff --git a/getting-started/jdbc/docker-compose.yml b/getting-started/jdbc/docker-compose.yml index ce593597a6..7cf386d74e 100644 --- a/getting-started/jdbc/docker-compose.yml +++ b/getting-started/jdbc/docker-compose.yml @@ -20,7 +20,7 @@ services: polaris: - # IMPORTANT: the image MUST contain the Postgres JDBC driver and EclipseLink dependencies, see README for instructions + # IMPORTANT: the image MUST contain the Postgres JDBC driver and JDBC persistence dependencies, see README for instructions image: apache/polaris:postgres-latest ports: # API port From 558e02b390c4dc9dd873fb6e8d61f5a833a11118 Mon Sep 17 00:00:00 2001 From: Prashant Date: Fri, 2 May 2025 11:38:36 -0700 Subject: [PATCH 4/4] remove comment --- getting-started/jdbc/docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/getting-started/jdbc/docker-compose.yml b/getting-started/jdbc/docker-compose.yml index 7cf386d74e..4c85226c23 100644 --- a/getting-started/jdbc/docker-compose.yml +++ b/getting-started/jdbc/docker-compose.yml @@ -20,7 +20,6 @@ services: polaris: - # IMPORTANT: the image MUST contain the Postgres JDBC driver and JDBC persistence dependencies, see README for instructions image: apache/polaris:postgres-latest ports: # API port