Skip to content

Commit 94f6cb6

Browse files
docs: Add quickstart documentation (#2976)
* Add quickstart documentation targeting CLI convenience Co-authored-by: Alexandre Dutra <[email protected]>
1 parent 5c0a653 commit 94f6cb6

File tree

5 files changed

+334
-6
lines changed

5 files changed

+334
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ for contribution guidelines.
4040
Click [here](https://polaris.apache.org/in-dev/unreleased/) for a quick overview of Polaris.
4141

4242
## Quickstart
43-
Click [here](https://polaris.apache.org/in-dev/unreleased/getting-started/install-dependencies/) for the quickstart experience, which will help you set up a Polaris instance locally or on any supported cloud provider.
43+
Click [here](https://polaris.apache.org/in-dev/unreleased/getting-started/quick-start/) for the quickstart experience.
4444

4545
## Project Structure
4646

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
20+
# Apache Polaris Quickstart
21+
22+
Please see the [quickstart guide](../../site/content/in-dev/unreleased/getting-started/quick-start.md) for more information.
Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
services:
21+
22+
minio:
23+
image: quay.io/minio/minio:latest
24+
ports:
25+
# API port
26+
- "9000:9000"
27+
# UI port
28+
- "9001:9001"
29+
environment:
30+
MINIO_ROOT_USER: minio_root
31+
MINIO_ROOT_PASSWORD: m1n1opwd
32+
command:
33+
- "server"
34+
- "/data"
35+
- "--console-address"
36+
- ":9001"
37+
healthcheck:
38+
test: ["CMD", "curl", "http://127.0.0.1:9000/minio/health/live"]
39+
interval: 1s
40+
timeout: 10s
41+
42+
polaris:
43+
image: apache/polaris:latest
44+
ports:
45+
# API port
46+
- "8181:8181"
47+
# Management port (metrics and health checks)
48+
- "8182:8182"
49+
# Optional, allows attaching a debugger to the Polaris JVM
50+
- "5005:5005"
51+
depends_on:
52+
minio:
53+
condition: service_healthy
54+
environment:
55+
JAVA_DEBUG: true
56+
JAVA_DEBUG_PORT: "*:5005"
57+
AWS_REGION: us-west-2
58+
AWS_ACCESS_KEY_ID: minio_root
59+
AWS_SECRET_ACCESS_KEY: m1n1opwd
60+
POLARIS_BOOTSTRAP_CREDENTIALS: POLARIS,${ROOT_CLIENT_ID:-root},${ROOT_CLIENT_SECRET:-s3cr3t}
61+
polaris.realm-context.realms: ${POLARIS_REALM:-POLARIS}
62+
quarkus.otel.sdk.disabled: "true"
63+
healthcheck:
64+
test: ["CMD", "curl", "http://localhost:8182/q/health"]
65+
interval: 2s
66+
timeout: 10s
67+
retries: 10
68+
start_period: 10s
69+
70+
setup_bucket:
71+
image: quay.io/minio/mc:latest
72+
depends_on:
73+
minio:
74+
condition: service_healthy
75+
entrypoint: "/bin/sh"
76+
command:
77+
- "-c"
78+
- >-
79+
echo Creating MinIO bucket...;
80+
mc alias set pol http://minio:9000 minio_root m1n1opwd;
81+
mc mb pol/bucket123;
82+
mc ls pol;
83+
echo Bucket setup complete.;
84+
85+
polaris-setup:
86+
image: alpine/curl
87+
depends_on:
88+
polaris:
89+
condition: service_healthy
90+
environment:
91+
- CLIENT_ID=${ROOT_CLIENT_ID:-root}
92+
- CLIENT_SECRET=${ROOT_CLIENT_SECRET:-s3cr3t}
93+
- CATALOG_NAME=${CATALOG_NAME:-quickstart_catalog}
94+
- REALM=${POLARIS_REALM:-POLARIS}
95+
entrypoint: /bin/sh
96+
command:
97+
- -c
98+
- |
99+
set -e
100+
apk add --no-cache jq
101+
102+
echo "Obtaining root access token..."
103+
TOKEN_RESPONSE=$$(curl -s -X POST http://polaris:8181/api/catalog/v1/oauth/tokens \
104+
-H 'Content-Type: application/x-www-form-urlencoded' \
105+
-d "grant_type=client_credentials&client_id=$${CLIENT_ID}&client_secret=$${CLIENT_SECRET}&scope=PRINCIPAL_ROLE:ALL")
106+
107+
TOKEN=$$(echo $$TOKEN_RESPONSE | jq -r '.access_token')
108+
echo "Obtained access token"
109+
110+
echo "Creating catalog '$$CATALOG_NAME' in realm $$REALM..."
111+
PAYLOAD='{
112+
"catalog": {
113+
"name": "'$$CATALOG_NAME'",
114+
"type": "INTERNAL",
115+
"readOnly": false,
116+
"properties": {
117+
"default-base-location": "s3://bucket123"
118+
},
119+
"storageConfigInfo": {
120+
"storageType": "S3",
121+
"allowedLocations": ["s3://bucket123"],
122+
"endpoint": "http://localhost:9000",
123+
"endpointInternal": "http://minio:9000",
124+
"pathStyleAccess": true
125+
}
126+
}
127+
}'
128+
129+
curl -s -X POST http://polaris:8181/api/management/v1/catalogs \
130+
-H "Authorization: Bearer $$TOKEN" \
131+
-H "Accept: application/json" \
132+
-H "Content-Type: application/json" \
133+
-H "Polaris-Realm: $$REALM" \
134+
-d "$$PAYLOAD" > /dev/null
135+
136+
echo "✅ Catalog created"
137+
138+
echo ""
139+
echo "Creating principal 'quickstart_user'..."
140+
PRINCIPAL_RESPONSE=$$(curl -s -X POST http://polaris:8181/api/management/v1/principals \
141+
-H "Authorization: Bearer $$TOKEN" \
142+
-H "Polaris-Realm: $$REALM" \
143+
-H "Content-Type: application/json" \
144+
-d '{"principal": {"name": "quickstart_user", "properties": {}}}')
145+
146+
USER_CLIENT_ID=$$(echo $$PRINCIPAL_RESPONSE | jq -r '.credentials.clientId')
147+
USER_CLIENT_SECRET=$$(echo $$PRINCIPAL_RESPONSE | jq -r '.credentials.clientSecret')
148+
149+
echo "✅ Principal created with clientId: $$USER_CLIENT_ID"
150+
151+
echo "Creating principal role 'quickstart_user_role'..."
152+
curl -s -X POST http://polaris:8181/api/management/v1/principal-roles \
153+
-H "Authorization: Bearer $$TOKEN" \
154+
-H "Polaris-Realm: $$REALM" \
155+
-H "Content-Type: application/json" \
156+
-d '{"principalRole": {"name": "quickstart_user_role", "properties": {}}}' > /dev/null
157+
158+
echo "✅ Principal role created"
159+
160+
echo "Creating catalog role 'quickstart_catalog_role'..."
161+
curl -s -X POST http://polaris:8181/api/management/v1/catalogs/$$CATALOG_NAME/catalog-roles \
162+
-H "Authorization: Bearer $$TOKEN" \
163+
-H "Polaris-Realm: $$REALM" \
164+
-H "Content-Type: application/json" \
165+
-d '{"catalogRole": {"name": "quickstart_catalog_role", "properties": {}}}' > /dev/null
166+
167+
echo "✅ Catalog role created"
168+
169+
echo "Assigning principal role to principal..."
170+
curl -s -X PUT http://polaris:8181/api/management/v1/principals/quickstart_user/principal-roles \
171+
-H "Authorization: Bearer $$TOKEN" \
172+
-H "Polaris-Realm: $$REALM" \
173+
-H "Content-Type: application/json" \
174+
-d '{"principalRole": {"name": "quickstart_user_role"}}' > /dev/null
175+
176+
echo "✅ Principal role assigned"
177+
178+
echo "Assigning catalog role to principal role..."
179+
curl -s -X PUT http://polaris:8181/api/management/v1/principal-roles/quickstart_user_role/catalog-roles/$$CATALOG_NAME \
180+
-H "Authorization: Bearer $$TOKEN" \
181+
-H "Polaris-Realm: $$REALM" \
182+
-H "Content-Type: application/json" \
183+
-d '{"catalogRole": {"name": "quickstart_catalog_role"}}' > /dev/null
184+
185+
echo "✅ Catalog role assigned"
186+
187+
echo "Granting CATALOG_MANAGE_CONTENT privilege..."
188+
curl -s -X PUT http://polaris:8181/api/management/v1/catalogs/$$CATALOG_NAME/catalog-roles/quickstart_catalog_role/grants \
189+
-H "Authorization: Bearer $$TOKEN" \
190+
-H "Polaris-Realm: $$REALM" \
191+
-H "Content-Type: application/json" \
192+
-d '{"type": "catalog", "privilege": "CATALOG_MANAGE_CONTENT"}' > /dev/null
193+
194+
echo "✅ Privileges granted"
195+
196+
echo ""
197+
echo "=========================================="
198+
echo "🎉 Polaris Quickstart Setup Complete!"
199+
echo "=========================================="
200+
echo ""
201+
echo "Catalog: $$CATALOG_NAME"
202+
echo " Storage: S3 (MinIO)"
203+
echo " Location: s3://bucket123"
204+
echo " MinIO UI: http://localhost:9001"
205+
echo ""
206+
echo "Root credentials:"
207+
echo " Client ID: $$CLIENT_ID"
208+
echo " Client Secret: $$CLIENT_SECRET"
209+
echo ""
210+
echo "User credentials:"
211+
echo " Client ID: $$USER_CLIENT_ID"
212+
echo " Client Secret: $$USER_CLIENT_SECRET"
213+
echo ""
214+
echo "Polaris main APIs:"
215+
echo " - Iceberg REST: http://localhost:8181/api/catalog/v1"
216+
echo " - Management: http://localhost:8181/api/management/v1"
217+
echo " - Generic Tables: http://localhost:8181/api/polaris/v1"
218+
echo ""
219+
echo "Polaris admin APIs:"
220+
echo " - Health check: http://localhost:8182/q/health"
221+
echo " - Metrics: http://localhost:8182/q/metrics"
222+
echo ""
223+
echo "To get started with Spark:"
224+
echo " spark-sql \\"
225+
echo " --packages org.apache.iceberg:iceberg-spark-runtime-3.5_2.12:1.10.0,org.apache.iceberg:iceberg-aws-bundle:1.10.0 \\"
226+
echo " --conf spark.sql.extensions=org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions \\"
227+
echo " --conf spark.sql.catalog.polaris=org.apache.iceberg.spark.SparkCatalog \\"
228+
echo " --conf spark.sql.catalog.polaris.type=rest \\"
229+
echo " --conf spark.sql.catalog.polaris.warehouse=$$CATALOG_NAME \\"
230+
echo " --conf spark.sql.catalog.polaris.uri=http://localhost:8181/api/catalog \\"
231+
echo " --conf spark.sql.catalog.polaris.credential=$$USER_CLIENT_ID:$$USER_CLIENT_SECRET \\"
232+
echo " --conf spark.sql.catalog.polaris.scope=PRINCIPAL_ROLE:ALL \\"
233+
echo " --conf spark.sql.catalog.polaris.s3.endpoint=http://localhost:9000 \\"
234+
echo " --conf spark.sql.catalog.polaris.s3.path-style-access=true \\"
235+
echo " --conf spark.sql.catalog.polaris.s3.access-key-id=minio_root \\"
236+
echo " --conf spark.sql.catalog.polaris.s3.secret-access-key=m1n1opwd \\"
237+
echo " --conf spark.sql.catalog.polaris.client.region=irrelevant \\"
238+
echo " --conf spark.sql.defaultCatalog=polaris"
239+
echo ""
240+
echo "To get started with REST API:"
241+
echo " # Get a token"
242+
echo " export TOKEN=\$$(curl -s -X POST http://localhost:8181/api/catalog/v1/oauth/tokens \\"
243+
echo " -d 'grant_type=client_credentials' \\"
244+
echo " -d 'client_id=$$USER_CLIENT_ID' \\"
245+
echo " -d 'client_secret=$$USER_CLIENT_SECRET' \\"
246+
echo " -d 'scope=PRINCIPAL_ROLE:ALL' \\"
247+
echo " | jq -r '.access_token')"
248+
echo ""
249+
echo " # Create a namespace"
250+
echo " curl -X POST http://localhost:8181/api/catalog/v1/$$CATALOG_NAME/namespaces \\"
251+
echo " -H \"Authorization: Bearer \$$TOKEN\" \\"
252+
echo " -H 'Content-Type: application/json' \\"
253+
echo " -d '{\"namespace\": [\"my_namespace\"], \"properties\": {}}'"
254+
echo ""
255+
echo " # List namespaces"
256+
echo " curl -X GET http://localhost:8181/api/catalog/v1/$$CATALOG_NAME/namespaces \\"
257+
echo " -H \"Authorization: Bearer \$$TOKEN\""
258+
echo ""
259+
echo "=========================================="

site/content/in-dev/unreleased/getting-started/_index.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,21 @@ type: docs
2323
weight: 101
2424
---
2525

26-
The fastest way to get started is with our Docker Compose examples. Each example provides a complete working environment with detailed instructions.
26+
There are several options for getting started with Apache Polaris.
2727

28-
## Next Steps
28+
To quickly try out Apache Polaris, please use the [quickstart guide](./quick-start). For other examples, please see below.
2929

30-
1. Check/Install dependencies
30+
## Docker Compose Examples
31+
Each of the proceeding Docker Compose examples provides a complete working environment with detailed instructions.
32+
33+
### Next Steps
34+
35+
1. Check & install dependencies
3136
2. Choose the way you want to deploy Polaris
3237
3. Create a catalog
33-
4. Check Using polaris page
38+
4. Check Using Polaris page
3439

35-
## Getting Help
40+
### Getting Help
3641

3742
- Documentation: https://polaris.apache.org
3843
- GitHub Issues: https://github.com/apache/polaris/issues
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
Title: Quickstart
21+
type: docs
22+
weight: 99
23+
---
24+
Use this guide to quickly start running Polaris. This is not intended for production use.
25+
26+
## Prerequisites
27+
28+
- Have Docker (with Docker Compose v2) installed & running on your machine
29+
30+
## Running
31+
32+
Run the following command:
33+
34+
```bash
35+
curl -s https://raw.githubusercontent.com/apache/polaris/main/getting-started/quickstart/docker-compose.yml | docker compose -f - up
36+
37+
```
38+
This command will:
39+
1. Create a Catalog named `quickstart_catalog` with MinIO-backed storage.
40+
2. Create a user principal `quickstart_user` with full access to the catalog.
41+
42+
Once the command has been run, you will see examples on how to interact with this Polaris server in the logs.

0 commit comments

Comments
 (0)