Skip to content

Create a single binary distribution bundle #1589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion gradle/projects.main.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ polaris-service-common=service/common
polaris-quarkus-defaults=quarkus/defaults
polaris-quarkus-service=quarkus/service
polaris-quarkus-server=quarkus/server
polaris-quarkus-distribution=quarkus/distribution
polaris-quarkus-spark-tests=quarkus/spark-tests
polaris-quarkus-admin=quarkus/admin
polaris-quarkus-common=quarkus/common
polaris-quarkus-test-commons=quarkus/test-commons
polaris-quarkus-run-script=quarkus/run-script
polaris-eclipselink=extension/persistence/eclipselink
polaris-jpa-model=extension/persistence/jpa-model
polaris-relational-jdbc=extension/persistence/relational-jdbc
Expand Down
98 changes: 17 additions & 81 deletions quarkus/admin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,14 @@
* under the License.
*/

import io.quarkus.gradle.tasks.QuarkusBuild
import publishing.GenerateDigest

plugins {
alias(libs.plugins.quarkus)
alias(libs.plugins.jandex)
alias(libs.plugins.openapi.generator)
id("polaris-quarkus")
// id("polaris-license-report")
id("distribution")
}

val runScript by configurations.creating { description = "Used to reference the run.sh script" }

val distributionZip by
configurations.creating { description = "Used to reference the distribution zip" }

val distributionTar by
configurations.creating { description = "Used to reference the distribution tarball" }

dependencies {
implementation(project(":polaris-core"))
implementation(project(":polaris-version"))
Expand Down Expand Up @@ -69,8 +57,6 @@ dependencies {

testRuntimeOnly(project(":polaris-eclipselink"))
testRuntimeOnly("org.postgresql:postgresql")

runScript(project(":polaris-quarkus-run-script", "runScript"))
}

quarkus {
Expand All @@ -90,77 +76,27 @@ quarkus {
)
}

distributions {
main {
contents {
from(runScript)
from(project.layout.buildDirectory.dir("quarkus-app"))
from("distribution/NOTICE")
from("distribution/LICENSE")
from("distribution/README.md")
from("distribution/DISCLAIMER")
}
}
}

val quarkusBuild = tasks.named<QuarkusBuild>("quarkusBuild")

val distTar =
tasks.named<Tar>("distTar") {
dependsOn(quarkusBuild)
// Trigger resolution (and build) of the run-script artifact
inputs.files(runScript)
compression = Compression.GZIP
}

val distZip =
tasks.named<Zip>("distZip") {
dependsOn(quarkusBuild)
// Trigger resolution (and build) of the run-script artifact
inputs.files(runScript)
// Configuration to expose distribution artifacts
val distributionElements by
configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
}

val digestDistTar =
tasks.register<GenerateDigest>("digestDistTar") {
description = "Generate the distribution tar digest"
mustRunAfter(distTar)
file.set { distTar.get().archiveFile.get().asFile }
}

val digestDistZip =
tasks.register<GenerateDigest>("digestDistZip") {
description = "Generate the distribution zip digest"
mustRunAfter(distZip)
file.set { distZip.get().archiveFile.get().asFile }
}

distTar.configure { finalizedBy(digestDistTar) }

distZip.configure { finalizedBy(digestDistZip) }

if (project.hasProperty("release") || project.hasProperty("signArtifacts")) {
signing {
sign(distTar.get())
sign(distZip.get())
}
}

// Expose runnable jar via quarkusRunner configuration for integration-tests that require the
// server.
// Register the quarkus app directory as an artifact
artifacts {
add(distributionTar.name, provider { distTar.get().archiveFile }) { builtBy(distTar) }
add(distributionTar.name, provider { digestDistTar.get().outputFile }) { builtBy(digestDistTar) }
add(distributionZip.name, provider { distZip.get().archiveFile }) { builtBy(distZip) }
add(distributionZip.name, provider { digestDistZip.get().outputFile }) { builtBy(digestDistZip) }
add("distributionElements", layout.buildDirectory.dir("quarkus-app")) { builtBy("quarkusBuild") }
}

afterEvaluate {
publishing {
publications {
named<MavenPublication>("maven") {
artifact(distTar.get().archiveFile) { builtBy(distTar) }
artifact(distZip.get().archiveFile) { builtBy(distZip) }
}
}
// Configuration to expose LICENSE and NOTICE files
val distributionDocs by
configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
}

// Add LICENSE and NOTICE as artifacts
artifacts {
add("distributionDocs", file("distribution/LICENSE"))
add("distributionDocs", file("distribution/NOTICE"))
}
56 changes: 0 additions & 56 deletions quarkus/admin/distribution/README.md

This file was deleted.

10 changes: 10 additions & 0 deletions quarkus/distribution/DISCLAIMER
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Apache Polaris (incubating) is an effort undergoing incubation at The Apache
Software Foundation (ASF), sponsored by the Apache Incubator PMC.

Incubation is required of all newly accepted projects until a further review
indicates that the infrastructure, communications, and decision making process
have stabilized in a manner consistent with other successful ASF projects.

While incubation status is not necessarily a reflection of the completeness
or stability of the code, it does indicate that the project has yet to be
fully endorsed by the ASF.
79 changes: 79 additions & 0 deletions quarkus/distribution/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<!--
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.
-->

# Apache Polaris Distribution

This distribution contains both the Polaris Server and Admin Tool.

## Prerequisites

- Java SE 21 or higher
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we just say 21 here, please ref thread here : #1517 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right that Polaris target jdk version is 21,

tasks.withType(JavaCompile::class.java).configureEach { options.release = 21 }
. However, this is a binary distribution. Users should only care about the runtime jdk version here. I think it's the right call to say 21+ here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think 21+ is fine. We can always adjust docs if we hit incompatibilities.

Copy link
Member

Choose a reason for hiding this comment

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

Agree, 21+ is fine.


## Directory Structure

```
polaris-quarkus-distribution-@version@/
├── LICENSE
├── NOTICE
├── README.md
├── admin/ # Admin tool files
├── bin/ # Executable scripts
│ ├── admin
│ └── server
└── server/ # Server files
```

## Usage

The distribution includes separate scripts for running the server and admin tool:

### Start the Server

```bash
bin/server
```

### Use the Admin Tool

```bash
bin/admin --help # Show admin commands
bin/admin bootstrap -h # Show bootstrap help
bin/admin purge -h # Show purge help
```

For full usage instructions and configuration details, see the official Polaris docs at https://polaris.apache.org/.

### Configuration

Both components can be configured using environment variables or system properties. For example:

```bash
# Configure server port
POLARIS_JAVA_OPTS="-Dquarkus.http.port=8080" bin/server
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: env POLARIS_JAVA_OPTS="-Dquarkus.http.port=8080" bin/server is more portable, AFAIK.


# Configure admin tool
POLARIS_JAVA_OPTS="-Dpolaris.persistence.type=relational-jdbc" bin/admin

# You can also set JAVA_OPTS as an environment variable
export POLARIS_JAVA_OPTS="-Xms512m -Xmx1g -Dquarkus.http.port=8080"
bin/server
```

For more details on configuration, please refer to the Polaris documentation:
https://polaris.apache.org/
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,17 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

# Linux Quarkus fast-jar run script for Apache Polaris

set -e

script_dir="$(dirname "$0")"
set -euo pipefail

if [ -z "$JAVA_HOME" ] ; then
JAVACMD="`\\unset -f command; \\command -v java`"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
# Get the directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR/../admin"

if [ ! -x "$JAVACMD" ] ; then
echo "The JAVA_HOME environment variable is not defined correctly," >&2
echo "this environment variable is needed to run this program." >&2
exit 1
fi
# Get the Java command
JAVA_CMD="${JAVA_HOME:+${JAVA_HOME%/}/bin/java}"
JAVA_CMD="${JAVA_CMD:-$(command -v java)}"
[ -x "$JAVA_CMD" ] || { echo "Java not found – set JAVA_HOME or add java to PATH." >&2; exit 1; }

exec "${JAVACMD}" -jar "${script_dir}/quarkus-run.jar" $@
# Launch Quarkus
exec "$JAVA_CMD" ${POLARIS_JAVA_OPTS:-} -jar quarkus-run.jar "$@"
32 changes: 32 additions & 0 deletions quarkus/distribution/bin/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
#
# 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.

set -euo pipefail

# Get the directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR/../server"

# Get the Java command
JAVA_CMD="${JAVA_HOME:+${JAVA_HOME%/}/bin/java}"
JAVA_CMD="${JAVA_CMD:-$(command -v java)}"
[ -x "$JAVA_CMD" ] || { echo "Java not found – set JAVA_HOME or add java to PATH." >&2; exit 1; }

# Launch Quarkus
exec "$JAVA_CMD" ${POLARIS_JAVA_OPTS:-} -jar quarkus-run.jar
Loading
Loading