From 72bfa3349fa8a22ab85d4c70cd9c3ea1cf396a7e Mon Sep 17 00:00:00 2001 From: Honah J Date: Thu, 23 Jan 2025 20:41:14 -0800 Subject: [PATCH 1/2] make trino getting-started example works --- getting-started/trino/create-polaris-catalog.sh | 5 +++++ getting-started/trino/docker-compose.yml | 16 ++++++++++++---- .../trino-config/catalog/iceberg.properties | 2 ++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/getting-started/trino/create-polaris-catalog.sh b/getting-started/trino/create-polaris-catalog.sh index e5eb96331..20b007a82 100644 --- a/getting-started/trino/create-polaris-catalog.sh +++ b/getting-started/trino/create-polaris-catalog.sh @@ -38,3 +38,8 @@ curl -i -X POST -H "Authorization: Bearer $PRINCIPAL_TOKEN" -H 'Accept: applicat } } }' + +# Add TABLE_WRITE_DATA to the catalog's catalog_admin role since by default it can only manage access and metadata +curl -i -X PUT -H "Authorization: Bearer $PRINCIPAL_TOKEN" -H 'Accept: application/json' -H 'Content-Type: application/json' \ + http://polaris:8181/api/management/v1/catalogs/polaris/catalog-roles/catalog_admin/grants \ + -d '{"type": "catalog", "privilege": "TABLE_WRITE_DATA"}' diff --git a/getting-started/trino/docker-compose.yml b/getting-started/trino/docker-compose.yml index 3c9ab36f5..5ea31fb41 100644 --- a/getting-started/trino/docker-compose.yml +++ b/getting-started/trino/docker-compose.yml @@ -19,19 +19,27 @@ services: polaris: - build: - context: ../../ + image: apache/polaris:latest ports: - "8181:8181" - "8182" environment: AWS_REGION: us-west-2 + AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY GOOGLE_APPLICATION_CREDENTIALS: $GOOGLE_APPLICATION_CREDENTIALS AZURE_TENANT_ID: $AZURE_TENANT_ID AZURE_CLIENT_ID: $AZURE_CLIENT_ID AZURE_CLIENT_SECRET: $AZURE_CLIENT_SECRET - # add aws keys as dropwizard config - JAVA_OPTS: -Ddw.awsAccessKey=$AWS_ACCESS_KEY_ID -Ddw.awsSecretKey=$AWS_SECRET_ACCESS_KEY + polaris.persistence.type: in-memory + polaris.authentication.authenticator.type: test + polaris.authentication.token-service.type: test + polaris.authentication.token-broker.type: symmetric-key + polaris.authentication.token-broker.symmetric-key.secret: polaris + polaris.features.defaults."SUPPORTED_CATALOG_STORAGE_TYPES": '["FILE","S3","GCS","AZURE"]' + polaris.realm-context.realms: default-realm,realm1 + quarkus.log.file.enable: false + quarkus.otel.sdk.disabled: "true" healthcheck: test: ["CMD", "curl", "http://localhost:8182/healthcheck"] diff --git a/getting-started/trino/trino-config/catalog/iceberg.properties b/getting-started/trino/trino-config/catalog/iceberg.properties index a5075530f..94b8b489e 100644 --- a/getting-started/trino/trino-config/catalog/iceberg.properties +++ b/getting-started/trino/trino-config/catalog/iceberg.properties @@ -23,3 +23,5 @@ iceberg.rest-catalog.uri=http://polaris:8181/api/catalog iceberg.rest-catalog.security=OAUTH2 iceberg.rest-catalog.oauth2.token=principal:root;realm:default-realm iceberg.rest-catalog.warehouse=polaris +# Required to support local filesystem: https://trino.io/docs/current/object-storage.html#configuration +fs.hadoop.enabled=true From be0124d6b403b6828648e267b6469770cc1bbe8f Mon Sep 17 00:00:00 2001 From: Honah J Date: Thu, 23 Jan 2025 20:50:06 -0800 Subject: [PATCH 2/2] Update README --- getting-started/trino/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/getting-started/trino/README.md b/getting-started/trino/README.md index c4f99b08a..26804a77a 100644 --- a/getting-started/trino/README.md +++ b/getting-started/trino/README.md @@ -21,6 +21,12 @@ This getting started guide provides a `docker-compose` file to set up [Trino](https://trino.io/) with Apache Polaris. Apache Polaris is configured as an Iceberg REST Catalog in Trino. +## Build Polaris Image +Build Polaris Image while Docker is running +``` +./gradlew :polaris-quarkus-server:assemble -Dquarkus.container-image.build=true +``` + ## Run the `docker-compose` file To start the `docker-compose` file, run this command from the repo's root directory: ```