adutra commented on code in PR #2976: URL: https://github.com/apache/polaris/pull/2976#discussion_r2493984880
########## getting-started/quickstart/docker-compose.yml: ########## @@ -0,0 +1,249 @@ +# +# 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: + + minio: + image: quay.io/minio/minio:latest + ports: + # API port + - "9000:9000" + # UI port + - "9001:9001" + environment: + MINIO_ROOT_USER: minio_root + MINIO_ROOT_PASSWORD: m1n1opwd + command: + - "server" + - "/data" + - "--console-address" + - ":9001" + healthcheck: + test: ["CMD", "curl", "http://127.0.0.1:9000/minio/health/live"] + interval: 1s + timeout: 10s + + polaris: + image: apache/polaris:latest + ports: + # API port + - "8181:8181" Review Comment: ```suggestion # API port - "8181:8181" # Management port (metrics and health checks) - "8182:8182" ``` ########## getting-started/quickstart/docker-compose.yml: ########## @@ -0,0 +1,249 @@ +# +# 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: + + minio: + image: quay.io/minio/minio:latest + ports: + # API port + - "9000:9000" + # UI port + - "9001:9001" + environment: + MINIO_ROOT_USER: minio_root + MINIO_ROOT_PASSWORD: m1n1opwd + command: + - "server" + - "/data" + - "--console-address" + - ":9001" + healthcheck: + test: ["CMD", "curl", "http://127.0.0.1:9000/minio/health/live"] + interval: 1s + timeout: 10s + + polaris: + image: apache/polaris:latest + ports: + # API port + - "8181:8181" + # Optional, allows attaching a debugger to the Polaris JVM + - "5005:5005" + depends_on: + minio: + condition: service_healthy + environment: + JAVA_DEBUG: true + JAVA_DEBUG_PORT: "*:5005" + AWS_REGION: us-west-2 + AWS_ACCESS_KEY_ID: minio_root + AWS_SECRET_ACCESS_KEY: m1n1opwd + POLARIS_BOOTSTRAP_CREDENTIALS: POLARIS,${ROOT_CLIENT_ID:-root},${ROOT_CLIENT_SECRET:-s3cr3t} + polaris.realm-context.realms: ${POLARIS_REALM:-POLARIS} + quarkus.otel.sdk.disabled: "true" + healthcheck: + test: ["CMD", "curl", "http://localhost:8182/q/health"] + interval: 2s + timeout: 10s + retries: 10 + start_period: 10s + + setup_bucket: + image: quay.io/minio/mc:latest + depends_on: + minio: + condition: service_healthy + entrypoint: "/bin/sh" + command: + - "-c" + - >- + echo Creating MinIO bucket...; + mc alias set pol http://minio:9000 minio_root m1n1opwd; + mc mb pol/bucket123; + mc ls pol; + echo Bucket setup complete.; + + polaris-setup: + image: alpine/curl + depends_on: + polaris: + condition: service_healthy + environment: + - CLIENT_ID=${ROOT_CLIENT_ID:-root} + - CLIENT_SECRET=${ROOT_CLIENT_SECRET:-s3cr3t} + - CATALOG_NAME=${CATALOG_NAME:-quickstart_catalog} + - REALM=${POLARIS_REALM:-POLARIS} + entrypoint: /bin/sh + command: + - -c + - | + set -e + apk add --no-cache jq + + echo "Obtaining root access token..." + TOKEN_RESPONSE=$$(curl -s -X POST http://polaris:8181/api/catalog/v1/oauth/tokens \ + -H 'Content-Type: application/x-www-form-urlencoded' \ + -d "grant_type=client_credentials&client_id=$${CLIENT_ID}&client_secret=$${CLIENT_SECRET}&scope=PRINCIPAL_ROLE:ALL") + + TOKEN=$$(echo $$TOKEN_RESPONSE | jq -r '.access_token') + echo "Obtained access token" + + echo "Creating catalog '$$CATALOG_NAME' in realm $$REALM..." + PAYLOAD='{ + "catalog": { + "name": "'$$CATALOG_NAME'", + "type": "INTERNAL", + "readOnly": false, + "properties": { + "default-base-location": "s3://bucket123" + }, + "storageConfigInfo": { + "storageType": "S3", + "allowedLocations": ["s3://bucket123"], + "endpoint": "http://localhost:9000", + "endpointInternal": "http://minio:9000", + "pathStyleAccess": true + } + } + }' + + curl -s -X POST http://polaris:8181/api/management/v1/catalogs \ + -H "Authorization: Bearer $$TOKEN" \ + -H "Accept: application/json" \ + -H "Content-Type: application/json" \ + -H "Polaris-Realm: $$REALM" \ + -d "$$PAYLOAD" > /dev/null + + echo "✅ Catalog created" + + echo "" + echo "Creating principal 'quickstart_user'..." + PRINCIPAL_RESPONSE=$$(curl -s -X POST http://polaris:8181/api/management/v1/principals \ + -H "Authorization: Bearer $$TOKEN" \ + -H "Polaris-Realm: $$REALM" \ + -H "Content-Type: application/json" \ + -d '{"principal": {"name": "quickstart_user", "properties": {}}}') + + USER_CLIENT_ID=$$(echo $$PRINCIPAL_RESPONSE | jq -r '.credentials.clientId') + USER_CLIENT_SECRET=$$(echo $$PRINCIPAL_RESPONSE | jq -r '.credentials.clientSecret') + + echo "✅ Principal created with clientId: $$USER_CLIENT_ID" + + echo "Creating principal role 'quickstart_user_role'..." + curl -s -X POST http://polaris:8181/api/management/v1/principal-roles \ + -H "Authorization: Bearer $$TOKEN" \ + -H "Polaris-Realm: $$REALM" \ + -H "Content-Type: application/json" \ + -d '{"principalRole": {"name": "quickstart_user_role", "properties": {}}}' > /dev/null + + echo "✅ Principal role created" + + echo "Creating catalog role 'quickstart_catalog_role'..." + curl -s -X POST http://polaris:8181/api/management/v1/catalogs/$$CATALOG_NAME/catalog-roles \ + -H "Authorization: Bearer $$TOKEN" \ + -H "Polaris-Realm: $$REALM" \ + -H "Content-Type: application/json" \ + -d '{"catalogRole": {"name": "quickstart_catalog_role", "properties": {}}}' > /dev/null + + echo "✅ Catalog role created" + + echo "Assigning principal role to principal..." + curl -s -X PUT http://polaris:8181/api/management/v1/principals/quickstart_user/principal-roles \ + -H "Authorization: Bearer $$TOKEN" \ + -H "Polaris-Realm: $$REALM" \ + -H "Content-Type: application/json" \ + -d '{"principalRole": {"name": "quickstart_user_role"}}' > /dev/null + + echo "✅ Principal role assigned" + + echo "Assigning catalog role to principal role..." + curl -s -X PUT http://polaris:8181/api/management/v1/principal-roles/quickstart_user_role/catalog-roles/$$CATALOG_NAME \ + -H "Authorization: Bearer $$TOKEN" \ + -H "Polaris-Realm: $$REALM" \ + -H "Content-Type: application/json" \ + -d '{"catalogRole": {"name": "quickstart_catalog_role"}}' > /dev/null + + echo "✅ Catalog role assigned" + + echo "Granting CATALOG_MANAGE_CONTENT privilege..." + curl -s -X PUT http://polaris:8181/api/management/v1/catalogs/$$CATALOG_NAME/catalog-roles/quickstart_catalog_role/grants \ + -H "Authorization: Bearer $$TOKEN" \ + -H "Polaris-Realm: $$REALM" \ + -H "Content-Type: application/json" \ + -d '{"type": "catalog", "privilege": "CATALOG_MANAGE_CONTENT"}' > /dev/null + + echo "✅ Privileges granted" + + echo "" + echo "==========================================" + echo "🎉 Polaris Quickstart Setup Complete!" + echo "==========================================" + echo "" + echo "Catalog: $$CATALOG_NAME" + echo " Storage: S3 (MinIO)" + echo " Location: s3://bucket123" + echo " MinIO UI: http://localhost:9001" + echo "" + echo "Root credentials:" + echo " Client ID: $$CLIENT_ID" + echo " Client Secret: $$CLIENT_SECRET" + echo "" + echo "User credentials:" + echo " Client ID: $$USER_CLIENT_ID" + echo " Client Secret: $$USER_CLIENT_SECRET" + echo "" + echo "Polaris API: http://localhost:8181" + echo "Health check: http://localhost:8182/q/health" Review Comment: ```suggestion echo "Polaris main APIs:" echo " - Iceberg REST: http://localhost:8181/api/catalog/v1" echo " - Management: http://localhost:8181/api/management/v1" echo " - Generic Tables: http://localhost:8181/api/polaris/v1" echo "" echo "Polaris admin APIs:" echo " - Health check: http://localhost:8182/q/health" echo " - Metrics: http://localhost:8182/q/metrics" ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
