Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 153 additions & 0 deletions site/content/in-dev/unreleased/admin-tool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
---
#
# 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.
#
linkTitle: Polaris Admin Tool
title: Apache Polaris (incubating) Admin Tool
type: docs
weight: 300
---

In order to help administrators manage their Polaris database, Polaris provides an administration

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we be consistent with the name?

Suggested change
In order to help administrators manage their Polaris database, Polaris provides an administration
In order to help administrators manage their Polaris metastore, Polaris provides an administration

tool.

The tool is built using [Quarkus](https://quarkus.io/).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: do we need to call it out explicitly?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? IMHO, it informs users about the technology stack (e.g. how to configure stuff).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wanted to double-check if this is truly necessary. Typically, users don’t need to know the inner workings of a tool, especially since this document already explicitly states that configurations should remain consistent. Plus, there are a bunch of technologies behind it, we don't want to enumerate all of them. That said, it’s not a blocker, and I’m fine with proceeding either way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove, I think it's pretty obvious already that Quarkus is being used.


## How to Download the Admin Tool

As of January 2025, there is currently no binary release or official Docker image available for
the tool. For now, you need to build the artifacts yourself, for example, by running the following
command:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to use a matched version for both polaris server and admin tool, even after the binary release. In that case, if a user/developer is using the main branch, they should compile the admin tool anyway.

Suggested change
As of January 2025, there is currently no binary release or official Docker image available for
the tool. For now, you need to build the artifacts yourself, for example, by running the following
command:
Make sure the admin tool and Polaris server are with the same version. If you are using Polaris from the source code, you need to build the artifacts yourself by running the following command:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll apply the suggestion, but for the record, while it is definitely better if server and tool have the exact same version, that is not a hard requirement. What needs to match is the metastore/database schema.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. I think version matching is fine for a normal user, it's even harder for any user to check the metastore schema.


```shell
./gradlew :polaris-quarkus-admin:build -Dquarkus.container-image.build=true
```

The above command will generate:

- One standalone JAR in `quarkus/admin/build/polaris-quarkus-admin-*-runner.jar`
- Two distribution archives in `quarkus/admin/build/distributions`
- Two Docker image named `apache/polaris-admin-tool:latest` and `apache/polaris-admin-tool:<version>`

## Usage

To run the standalone JAR, use the following command:

```shell
java -jar quarkus/admin/build/polaris-quarkus-admin-*-runner.jar --help
```

To unpack and run the distribution, you can use the following command:

```shell
cd quarkus/admin/build/distributions
unzip polaris-quarkus-admin-*.zip
cd polaris-quarkus-admin-*/
java -jar polaris-quarkus-admin-*-runner.jar --help
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this unpack instruction? I'd prefer to leave for users/developers to figure it out by themselves if they want to do this.


To run the Docker image, use the following command:

```shell
docker run apache/polaris-admin-tool:latest --help
```
`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`

The basic usage of the Polaris Admin Tool is outlined below:

```
Usage: polaris-quarkus-admin-runner.jar [-hV] [COMMAND]
Polaris Admin Tool
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
Commands:
help Display help information about the specified command.
bootstrap Bootstraps realms and principal credentials.
purge Purge principal credentials.
```

## Configuration

The Polaris Admin Tool must be executed with the same configuration as the Polaris server. The
configuration can be done via environment variables or system properties.

At a minimum, it is necessary to configure the Polaris Admin Tool to connect to the same database
used by the Polaris server. This can be done by setting the following system properties:

```shell
java -jar quarkus/admin/build/polaris-quarkus-admin-*-runner.jar \
-Dpolaris.persistence.eclipselink.configuration-file=/path/to/persistence.xml
-Dpolaris.persistence.eclipselink.persistence-unit=polaris
```

See the [metastore documentation]({{% ref "metastores" %}}) for more information on configuring the
database connection.

## Bootstrapping Principal Credentials

The `bootstrap` command is used to bootstrap realms and create the necessary principal credentials for the Polaris
server. This command is idempotent and can be run multiple times without causing any issues.

```shell
java -jar quarkus/admin/build/polaris-quarkus-admin-*-runner.jar bootstrap --help
```

The basic usage of the `bootstrap` command is outlined below:

```
Usage: polaris-quarkus-admin-runner.jar bootstrap [-hV] [-c=<credentials>]...
-r=<realms> [-r=<realms>]...
Bootstraps realms and principal credentials.
-c, --credential=<credentials>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: we should probably support reading secrets from the shell console and/or env. variables and/or files (as a follow-up PR)

@adutra adutra Jan 21, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the tool is currently extremely rudimentary at this point. The idea of reading from stdin or file is excellent.

Principal credentials to bootstrap. Must be of the
form 'realm,clientId,clientSecret'.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

realm has a dedicated option -r 🤔 does the value have to repeat it? It looks off from the usability perspective.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks clumsy indeed, but the rationale is that you may want to bootstrap a realm without specifying credentials for it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's usable :) and it's better to document a usable tool with rough edges, than not have a doc at all :)

-h, --help Show this help message and exit.
-r, --realm=<realms> The name of a realm to bootstrap.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: realms (plural) looks odd as a placeholder for a singular option.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to look into picocli options to fix this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is fixed in the latest commit, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops yes, pushed one more commit.

-V, --version Print version information and exit.
```

For example, to bootstrap the `realm1` realm and create its root principal credential with the
client ID `admin` and client secret `admin`, you can run the following command:

```shell
java -jar quarkus/admin/build/polaris-quarkus-admin-*-runner.jar bootstrap -r realm1 -c realm1,admin,admin
```

## Purging Principal Credentials

The `purge` command is used to remove realms and principal credentials from the Polaris server. This

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we mention "realms" in the section title too? Could you add a paragraph on the implications of purging a realm?

command is idempotent and can be run multiple times without causing any issues.

```shell
java -jar quarkus/admin/build/polaris-quarkus-admin-*-runner.jar purge --help
```

The basic usage of the `purge` command is outlined below:

```
Usage: polaris-quarkus-admin-runner.jar purge [-hV] -r=<realms> [-r=<realms>]...
Purge principal credentials.
-h, --help Show this help message and exit.
-r, --realm=<realms> The name of a realm to purge.
-V, --version Print version information and exit.
```

For example, to purge the `realm1` realm, you can run the following command:

```shell
java -jar quarkus/admin/build/polaris-quarkus-admin-*-runner.jar purge -r realm1
```