diff --git a/getting-started/README.md b/getting-started/README.md index 4257e2bad0..32a7376509 100644 --- a/getting-started/README.md +++ b/getting-started/README.md @@ -33,12 +33,10 @@ this directory. Each example has detailed instructions. - [Spark](spark): An example that uses an in-memory metastore, automatically bootstrapped, with Apache Spark and a Jupyter notebook. -- [Trino](trino): An example that uses Trino with Polaris. - - [Telemetry](telemetry): An example that includes Prometheus and Jaeger to collect metrics and traces from Apache Polaris. This example automatically creates a `polaris_demo` catalog. - [Eclipselink](eclipselink): An example that uses an Eclipselink metastore and a Postgres database. The realm is bootstrapped with the Polaris Admin tool. This example also creates a - `polaris_demo` catalog, and offers the ability to run Spark SQL queries. Finally, it shows how to + `polaris_quickstart` catalog, and offers the ability to run Spark SQL and Trino queries. Finally, it shows how to attach a debugger to the Polaris server. diff --git a/getting-started/assets/cloud_providers/deploy-aws.sh b/getting-started/assets/cloud_providers/deploy-aws.sh new file mode 100644 index 0000000000..c943eb69b8 --- /dev/null +++ b/getting-started/assets/cloud_providers/deploy-aws.sh @@ -0,0 +1,78 @@ +# +# 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. +# + +EC2_INSTANCE_ID=$(cat /var/lib/cloud/data/instance-id) + +DESCRIBE_INSTANCE=$(aws ec2 describe-instances \ + --instance-ids $EC2_INSTANCE_ID \ + --query 'Reservations[*].Instances[*].{Instance:InstanceId,VPC:VpcId,AZ:Placement.AvailabilityZone}' \ + --output json) + +CURRENT_VPC=$(echo $DESCRIBE_INSTANCE | jq -r .[0].[0]."VPC") + +CURRENT_REGION=$(echo $DESCRIBE_INSTANCE | jq -r .[0].[0]."AZ" | sed 's/.$//') + +ALL_SUBNETS=$(aws ec2 describe-subnets \ + --region $CURRENT_REGION \ + --query 'Subnets[*].{SubnetId:SubnetId}' \ + --output json \ + | jq -r '[.[]["SubnetId"]] | join(" ")') + +RANDOM_SUFFIX=$(head /dev/urandom | tr -dc 'A-Za-z0-9' | head -c 8) +SUBNET_GROUP_NAME="polaris-db-subnet-group-$RANDOM_SUFFIX" +INSTANCE_NAME="polaris-backend-test-$RANDOM_SUFFIX" + +aws rds create-db-subnet-group \ + --db-subnet-group-name $SUBNET_GROUP_NAME \ + --db-subnet-group-description "Apache Polaris Quickstart DB Subnet Group" \ + --subnet-ids $ALL_SUBNETS + +DB_INSTANCE_INFO=$(aws rds create-db-instance \ + --db-instance-identifier $INSTANCE_NAME \ + --db-instance-class db.t3.micro \ + --engine postgres \ + --master-username postgres \ + --master-user-password postgres \ + --db-name POLARIS \ + --db-subnet-group-name $SUBNET_GROUP_NAME \ + --allocated-storage 10) + +DB_ARN=$(echo $DB_INSTANCE_INFO | jq -r '.["DBInstance"]["DBInstanceArn"]') + +DESCRIBE_DB=$(aws rds describe-db-instances --db-instance-identifier $DB_ARN) + +until echo $DESCRIBE_DB | jq -e '.["DBInstances"][0] | has("Endpoint")'; +do + echo "sleeping 10s to wait for Postgres DB provisioning..." + sleep 10 + DESCRIBE_DB=$(aws rds describe-db-instances --db-instance-identifier $DB_ARN) +done + +POSTGRES_ADDR=$(echo $DESCRIBE_DB | jq -r '.["DBInstances"][0]["Endpoint"]' | jq -r '"\(.Address):\(.Port)"') + +FULL_POSTGRES_ADDR=$(printf '%s\n' "jdbc:postgresql://$POSTGRES_ADDR/{realm}" | sed 's/[&/\]/\\&/g') +sed -i "/jakarta.persistence.jdbc.url/ s|value=\"[^\"]*\"|value=\"$FULL_POSTGRES_ADDR\"|" "getting-started/assets/eclipselink/persistence.xml" + +./gradlew clean :polaris-quarkus-server:assemble :polaris-quarkus-admin:assemble \ + -PeclipseLinkDeps=org.postgresql:postgresql:42.7.4 \ + -Dquarkus.container-image.tag=postgres-latest \ + -Dquarkus.container-image.build=true \ + --no-build-cache + +docker compose -f getting-started/eclipselink/docker-compose-bootstrap-db.yml -f getting-started/eclipselink/docker-compose.yml up -d \ No newline at end of file diff --git a/getting-started/assets/cloud_providers/deploy-azure.sh b/getting-started/assets/cloud_providers/deploy-azure.sh new file mode 100644 index 0000000000..76ee85432b --- /dev/null +++ b/getting-started/assets/cloud_providers/deploy-azure.sh @@ -0,0 +1,40 @@ +# +# 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. +# + +CURRENT_REGION=$(curl -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2021-02-01" | jq -r '.compute.location') +CURRENT_RESOURCE_GROUP=$(curl -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2021-02-01" | jq -r '.compute.resourceGroupName') +RANDOM_SUFFIX=$(head /dev/urandom | tr -dc 'a-z0-9' | head -c 8) +INSTANCE_NAME="polaris-backend-test-$RANDOM_SUFFIX" + +CREATE_DB_RESPONSE=$(az postgres flexible-server create -l $CURRENT_REGION -g $CURRENT_RESOURCE_GROUP -n $INSTANCE_NAME -u postgres -p postgres -y) + +az postgres flexible-server db create -g $CURRENT_RESOURCE_GROUP -s $INSTANCE_NAME -d POLARIS + +POSTGRES_ADDR=$(echo $CREATE_DB_RESPONSE | jq -r '.host') + +FULL_POSTGRES_ADDR=$(printf '%s\n' "jdbc:postgresql://$POSTGRES_ADDR:5432/{realm}" | sed 's/[&/\]/\\&/g') +sed -i "/jakarta.persistence.jdbc.url/ s|value=\"[^\"]*\"|value=\"$FULL_POSTGRES_ADDR\"|" "getting-started/assets/eclipselink/persistence.xml" + +./gradlew clean :polaris-quarkus-server:assemble :polaris-quarkus-admin:assemble \ + -PeclipseLinkDeps=org.postgresql:postgresql:42.7.4 \ + -Dquarkus.container-image.tag=postgres-latest \ + -Dquarkus.container-image.build=true \ + --no-build-cache + +docker compose -f getting-started/eclipselink/docker-compose-bootstrap-db.yml -f getting-started/eclipselink/docker-compose.yml up -d \ No newline at end of file diff --git a/getting-started/assets/cloud_providers/deploy-gcp.sh b/getting-started/assets/cloud_providers/deploy-gcp.sh new file mode 100644 index 0000000000..5da93b5585 --- /dev/null +++ b/getting-started/assets/cloud_providers/deploy-gcp.sh @@ -0,0 +1,50 @@ +# +# 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. +# + +CURRENT_ZONE=$(curl -H "Metadata-Flavor: Google" "http://169.254.169.254/computeMetadata/v1/instance/zone" | awk -F/ '{print $NF}') +CURRENT_REGION=$(echo $CURRENT_ZONE | sed 's/-[a-z]$//') +VM_INSTANCE_NAME=$(curl -H "Metadata-Flavor: Google" "http://169.254.169.254/computeMetadata/v1/instance/name") +RANDOM_SUFFIX=$(head /dev/urandom | tr -dc 'a-z0-9' | head -c 8) +DB_INSTANCE_NAME="polaris-backend-test-$RANDOM_SUFFIX" + +INSTANCE_IP=$(gcloud compute instances describe $VM_INSTANCE_NAME --zone=$CURRENT_ZONE --format="get(networkInterfaces[0].accessConfigs[0].natIP)") + + +gcloud sql instances create $DB_INSTANCE_NAME \ + --database-version=POSTGRES_17 \ + --region=$CURRENT_REGION \ + --tier=db-perf-optimized-N-4 \ + --edition=ENTERPRISE_PLUS \ + --root-password=postgres \ + --authorized-networks="$INSTANCE_IP/32" + +gcloud sql databases create POLARIS --instance=$DB_INSTANCE_NAME + +POSTGRES_ADDR=$(gcloud sql instances describe $DB_INSTANCE_NAME --format="get(ipAddresses[0].ipAddress)") + +FULL_POSTGRES_ADDR=$(printf '%s\n' "jdbc:postgresql://$POSTGRES_ADDR:5432/{realm}" | sed 's/[&/\]/\\&/g') +sed -i "/jakarta.persistence.jdbc.url/ s|value=\"[^\"]*\"|value=\"$FULL_POSTGRES_ADDR\"|" "getting-started/assets/eclipselink/persistence.xml" + +./gradlew clean :polaris-quarkus-server:assemble :polaris-quarkus-admin:assemble \ + -PeclipseLinkDeps=org.postgresql:postgresql:42.7.4 \ + -Dquarkus.container-image.tag=postgres-latest \ + -Dquarkus.container-image.build=true \ + --no-build-cache + +docker compose -f getting-started/eclipselink/docker-compose-bootstrap-db.yml -f getting-started/eclipselink/docker-compose.yml up -d \ No newline at end of file diff --git a/getting-started/assets/eclipselink/persistence.xml b/getting-started/assets/eclipselink/persistence.xml index e569a91832..54fb795a39 100644 --- a/getting-started/assets/eclipselink/persistence.xml +++ b/getting-started/assets/eclipselink/persistence.xml @@ -32,8 +32,7 @@ org.apache.polaris.jpa.models.ModelSequenceId NONE - + diff --git a/getting-started/assets/polaris/create-catalog.sh b/getting-started/assets/polaris/create-catalog.sh index f069c66376..b7b8e0f51d 100755 --- a/getting-started/assets/polaris/create-catalog.sh +++ b/getting-started/assets/polaris/create-catalog.sh @@ -33,7 +33,7 @@ echo echo "Obtained access token: ${token}" echo -echo Creating a catalog named polaris_demo... +echo Creating a catalog named quickstart_catalog... curl -s -H "Authorization: Bearer ${token}" \ -H 'Accept: application/json' \ @@ -41,16 +41,16 @@ curl -s -H "Authorization: Bearer ${token}" \ http://polaris:8181/api/management/v1/catalogs \ -d '{ "catalog": { - "name": "polaris_demo", + "name": "quickstart_catalog", "type": "INTERNAL", "readOnly": false, "properties": { - "default-base-location": "file:///tmp/polaris/" + "default-base-location": "file:///var/tmp/quickstart_catalog/" }, "storageConfigInfo": { "storageType": "FILE", "allowedLocations": [ - "file:///tmp" + "file:///var/tmp" ] } } diff --git a/getting-started/eclipselink/README.md b/getting-started/eclipselink/README.md index dd6abf7c29..0f41d8da15 100644 --- a/getting-started/eclipselink/README.md +++ b/getting-started/eclipselink/README.md @@ -38,7 +38,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.yml up + 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 ``` 3. Using spark-sql: attach to the running spark-sql container: @@ -71,5 +71,23 @@ This example requires `jq` to be installed on your machine. ```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/catalog/v1/config?warehouse=polaris_demo -H "Authorization: Bearer $POLARIS_TOKEN" + curl -v http://127.0.0.1:8181/api/management/v1/catalogs/polaris_demo -H "Authorization: Bearer $POLARIS_TOKEN" ``` + +6. Using Trino CLI: To access the Trino CLI, run this command: +``` +docker exec -it eclipselink-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/eclipselink/docker-compose-bootstrap-db.yml b/getting-started/eclipselink/docker-compose-bootstrap-db.yml new file mode 100644 index 0000000000..6e1ab80751 --- /dev/null +++ b/getting-started/eclipselink/docker-compose-bootstrap-db.yml @@ -0,0 +1,32 @@ +# +# 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-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: eclipse-link + polaris.persistence.eclipselink.configuration-file: /deployments/config/eclipselink/persistence.xml + volumes: + - ../assets/eclipselink/:/deployments/config/eclipselink + command: + - "bootstrap" + - "--realm=POLARIS" + - "--credential=POLARIS,root,s3cr3t" \ No newline at end of file diff --git a/getting-started/eclipselink/docker-compose-postgres.yml b/getting-started/eclipselink/docker-compose-postgres.yml new file mode 100644 index 0000000000..1e86a8c0ea --- /dev/null +++ b/getting-started/eclipselink/docker-compose-postgres.yml @@ -0,0 +1,45 @@ +# +# 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 \ No newline at end of file diff --git a/getting-started/eclipselink/docker-compose.yml b/getting-started/eclipselink/docker-compose.yml index 252ea53d64..4861675991 100644 --- a/getting-started/eclipselink/docker-compose.yml +++ b/getting-started/eclipselink/docker-compose.yml @@ -29,11 +29,6 @@ services: - "8182:8182" # Optional, allows attaching a debugger to the Polaris JVM - "5005:5005" - depends_on: - polaris-bootstrap: - condition: service_completed_successfully - postgres: - condition: service_healthy environment: JAVA_DEBUG: "true" JAVA_DEBUG_PORT: "*:5005" @@ -48,22 +43,7 @@ services: interval: 2s timeout: 10s retries: 10 - - 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 - depends_on: - postgres: - condition: service_healthy - environment: - polaris.persistence.type: eclipse-link - polaris.persistence.eclipselink.configuration-file: /deployments/config/eclipselink/persistence.xml - volumes: - - ../assets/eclipselink/:/deployments/config/eclipselink - command: - - "bootstrap" - - "--realm=POLARIS" - - "--credential=POLARIS,root,s3cr3t" + start_period: 10s polaris-setup: image: alpine/curl @@ -74,37 +54,8 @@ services: - ../assets/polaris/:/polaris entrypoint: '/bin/sh -c "chmod +x /polaris/create-catalog.sh && /polaris/create-catalog.sh"' - 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 - spark-sql: image: apache/spark:3.5.5-java17-python3 - depends_on: - polaris-setup: - condition: service_completed_successfully stdin_open: true tty: true ports: @@ -119,7 +70,7 @@ services: --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=polaris_demo", + --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", @@ -127,3 +78,12 @@ services: --conf, "spark.sql.catalogImplementation=in-memory", --conf, "spark.driver.extraJavaOptions=-Divy.cache.dir=/tmp -Divy.home=/tmp" ] + + trino: + image: trinodb/trino:latest + stdin_open: true + tty: true + ports: + - "8080:8080" + volumes: + - ./trino-config/catalog:/etc/trino/catalog diff --git a/getting-started/trino/trino-config/catalog/iceberg.properties b/getting-started/eclipselink/trino-config/catalog/iceberg.properties similarity index 95% rename from getting-started/trino/trino-config/catalog/iceberg.properties rename to getting-started/eclipselink/trino-config/catalog/iceberg.properties index 1cd0a0e7a2..28c3c61faa 100644 --- a/getting-started/trino/trino-config/catalog/iceberg.properties +++ b/getting-started/eclipselink/trino-config/catalog/iceberg.properties @@ -23,6 +23,6 @@ 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=polaris +iceberg.rest-catalog.warehouse=quickstart_catalog # Required to support local filesystem: https://trino.io/docs/current/object-storage.html#configuration fs.hadoop.enabled=true diff --git a/getting-started/trino/README.md b/getting-started/trino/README.md deleted file mode 100644 index 6b6acf1ef4..0000000000 --- a/getting-started/trino/README.md +++ /dev/null @@ -1,61 +0,0 @@ - - -# Getting Started with Trino and Apache Polaris - -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 \ - :polaris-quarkus-server:quarkusAppPartsBuild --rerun \ - -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: -``` -docker-compose -f getting-started/trino/docker-compose.yml up -``` - -## Run Trino queries via Trino CLI -To access the Trino CLI, run this command: -``` -docker exec -it trino-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; -``` - -## Note -The Polaris in this example is started with realm `default-realm` and root credentials: `root:s3cr3t`. - -An example catalog is created in Apache Polaris using the `curl` command. See `create-polaris-catalog.sh` for details. diff --git a/getting-started/trino/create-polaris-catalog.sh b/getting-started/trino/create-polaris-catalog.sh deleted file mode 100644 index e08e1c5f88..0000000000 --- a/getting-started/trino/create-polaris-catalog.sh +++ /dev/null @@ -1,61 +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. -# - -if ! output=$(curl -X POST -H "Polaris-Realm: default-realm" "http://polaris:8181/api/catalog/v1/oauth/tokens" \ - -d "grant_type=client_credentials" \ - -d "client_id=root" \ - -d "client_secret=s3cr3t" \ - -d "scope=PRINCIPAL_ROLE:ALL"); then - logred "Error: Failed to retrieve bearer token" - exit 1 -fi - -token=$(echo "$output" | awk -F\" '{print $4}') - -if [ "$token" == "unauthorized_client" ]; then - logred "Error: Failed to retrieve bearer token" - exit 1 -fi - -PRINCIPAL_TOKEN=$token - -# Use local filesystem by default -curl -i -X POST -H "Authorization: Bearer $PRINCIPAL_TOKEN" -H 'Accept: application/json' -H 'Content-Type: application/json' \ - http://polaris:8181/api/management/v1/catalogs \ - -d '{ - "catalog": { - "name": "polaris", - "type": "INTERNAL", - "readOnly": false, - "properties": { - "default-base-location": "file:///tmp/polaris/" - }, - "storageConfigInfo": { - "storageType": "FILE", - "allowedLocations": [ - "file:///tmp" - ] - } - } - }' - -# 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 deleted file mode 100644 index fd438f0094..0000000000 --- a/getting-started/trino/docker-compose.yml +++ /dev/null @@ -1,58 +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: - polaris: - 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 - POLARIS_BOOTSTRAP_CREDENTIALS: default-realm,root,s3cr3t - polaris.realm-context.realms: default-realm - quarkus.otel.sdk.disabled: "true" - - healthcheck: - test: ["CMD", "curl", "http://localhost:8182/healthcheck"] - interval: 10s - timeout: 10s - retries: 5 - - create-polaris-catalog: - image: curlimages/curl - depends_on: - polaris: - condition: service_healthy - volumes: - - ./create-polaris-catalog.sh:/create-polaris-catalog.sh - command: ["/bin/sh", "/create-polaris-catalog.sh"] - - trino: - image: trinodb/trino:latest - ports: - - "8080:8080" - volumes: - - ./trino-config/catalog:/etc/trino/catalog diff --git a/site/content/in-dev/unreleased/_index.md b/site/content/in-dev/unreleased/_index.md index 19100e7123..b4e147ecda 100644 --- a/site/content/in-dev/unreleased/_index.md +++ b/site/content/in-dev/unreleased/_index.md @@ -37,7 +37,7 @@ These pages refer to the current state of the main branch, which is still under Functionalities can be changed, removed or added without prior notice. {{< /alert >}} -Check out the [Quick Start]({{% ref "quickstart" %}}) page to get started. +Check out the [Quickstart]({{% ref "getting-started" %}}) page to get started.