Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 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.
73 changes: 73 additions & 0 deletions quarkus/distribution/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!--
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
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: bin/server (./ is not necessary, PATH is not used anyway)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

```

### 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
```

### Configuration

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

```bash
# Configure server port
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.

I believe env JAVA_OPTS="-Dquarkus.http.port=8080" bin/server is more portable. IIRC, current syntax assumes running in sh or bash.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd also suggest using env. vars like POLARIS_JAVA_OPTS so that they could be saved in local env. without affecting other applications.

Copy link
Contributor Author

@flyrain flyrain May 23, 2025

Choose a reason for hiding this comment

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

good catch, it doesn't work with the current script anymore. Removed this section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added support for POLARIS_JAVA_OPTS. All POSIX sh should work well without env, given this is a readme doc, I think it should be good.


# Configure admin tool
JAVA_OPTS="-Dpolaris.persistence.type=relational-jdbc" ./bin/admin
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not think JAVA_OPTS work with the latest scripts 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same 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 see that this config example got removed from the README. How is the user supposed to pass config options to the server?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Only options 2 and 3 are applicable when using these distribution's scripts. It would be nice to mention that in the README and perhaps include an sample config/application.properties in the archive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

let me fix it, I think we should allow user to use option 1 as well.
option 4(The application.properties files packaged in Polaris.) should also work, right? User will need to put a application.properties file in the classpath.

Copy link
Contributor

@dimas-b dimas-b May 23, 2025

Choose a reason for hiding this comment

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

I do not think users of the distribution bundle should put extra application.properties on the class path. The behaviour will be very uncertain in that case (with respect to the built-in application.properties in Polaris jars).

```

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,7 @@
# 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")"

if [ -z "$JAVA_HOME" ] ; then
JAVACMD="`\\unset -f command; \\command -v java`"
else
JAVACMD="$JAVA_HOME/bin/java"
fi

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

exec "${JAVACMD}" -jar "${script_dir}/quarkus-run.jar" $@
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${SCRIPT_DIR}/../admin" || exit
java -jar quarkus-run.jar "$@"
Copy link
Contributor

Choose a reason for hiding this comment

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

[minor] new line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

22 changes: 22 additions & 0 deletions quarkus/distribution/bin/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/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.

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${SCRIPT_DIR}/../server" || exit
java -jar quarkus-run.jar "$@"
Copy link
Contributor

Choose a reason for hiding this comment

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

[minor] new line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Loading
Loading