diff --git a/gradle/projects.main.properties b/gradle/projects.main.properties index 5c1a222d55..ed46bf280e 100644 --- a/gradle/projects.main.properties +++ b/gradle/projects.main.properties @@ -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 diff --git a/quarkus/admin/build.gradle.kts b/quarkus/admin/build.gradle.kts index 18b998a21b..0eeb117807 100644 --- a/quarkus/admin/build.gradle.kts +++ b/quarkus/admin/build.gradle.kts @@ -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")) @@ -69,8 +57,6 @@ dependencies { testRuntimeOnly(project(":polaris-eclipselink")) testRuntimeOnly("org.postgresql:postgresql") - - runScript(project(":polaris-quarkus-run-script", "runScript")) } quarkus { @@ -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") - -val distTar = - tasks.named("distTar") { - dependsOn(quarkusBuild) - // Trigger resolution (and build) of the run-script artifact - inputs.files(runScript) - compression = Compression.GZIP - } - -val distZip = - tasks.named("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("digestDistTar") { - description = "Generate the distribution tar digest" - mustRunAfter(distTar) - file.set { distTar.get().archiveFile.get().asFile } - } - -val digestDistZip = - tasks.register("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("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")) } diff --git a/quarkus/admin/distribution/README.md b/quarkus/admin/distribution/README.md deleted file mode 100644 index f50f58c543..0000000000 --- a/quarkus/admin/distribution/README.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Polaris Admin Tool - -The Polaris Admin Tool is a maintenance tool for performing administrative tasks on the Polaris server. - -## Prerequisites - -Polaris admin tool requires a Java SE 21 or higher to run. - -## Getting help - -To get help, simple run (in a command line where you extracted the Polaris tool archive): - -``` -./run.sh help -``` - -## Bootstrap - -You can bootstrap realms and root principal credentials with: - -``` -./run.sh bootstrap -``` - -providing all required arguments. - -## Purge - -You can purge realms and all associated entities with: - -``` -./run.sh purge -``` - -## Documentation - -For more details, please take a look on the documentation: https://polaris.apache.org/in-dev/unreleased/admin-tool/ \ No newline at end of file diff --git a/quarkus/distribution/DISCLAIMER b/quarkus/distribution/DISCLAIMER new file mode 100644 index 0000000000..e78e79b242 --- /dev/null +++ b/quarkus/distribution/DISCLAIMER @@ -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. \ No newline at end of file diff --git a/quarkus/distribution/README.md b/quarkus/distribution/README.md new file mode 100644 index 0000000000..69a4ee4c82 --- /dev/null +++ b/quarkus/distribution/README.md @@ -0,0 +1,79 @@ + + +# Apache Polaris Distribution + +This distribution contains both the Polaris Server and Admin Tool. + +## Prerequisites + +- Java SE 21 or higher + +## 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 + +# 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/ \ No newline at end of file diff --git a/quarkus/run-script/scripts/run.sh b/quarkus/distribution/bin/admin similarity index 63% rename from quarkus/run-script/scripts/run.sh rename to quarkus/distribution/bin/admin index d7531c66ae..7e7aa2b4c2 100755 --- a/quarkus/run-script/scripts/run.sh +++ b/quarkus/distribution/bin/admin @@ -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 "$@" diff --git a/quarkus/distribution/bin/server b/quarkus/distribution/bin/server new file mode 100755 index 0000000000..526357f3cb --- /dev/null +++ b/quarkus/distribution/bin/server @@ -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 diff --git a/quarkus/distribution/build.gradle.kts b/quarkus/distribution/build.gradle.kts new file mode 100644 index 0000000000..1552b534c0 --- /dev/null +++ b/quarkus/distribution/build.gradle.kts @@ -0,0 +1,118 @@ +/* + * 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. + */ + +import org.apache.tools.ant.filters.ReplaceTokens +import publishing.GenerateDigest + +plugins { + id("distribution") + id("signing") +} + +description = "Apache Polaris Binary Distribution" + +val adminProject = project(":polaris-quarkus-admin") +val serverProject = project(":polaris-quarkus-server") + +// Configurations to resolve artifacts from other projects +val adminDistribution by configurations.creating { + isCanBeConsumed = false + isCanBeResolved = true +} + +val serverDistribution by configurations.creating { + isCanBeConsumed = false + isCanBeResolved = true +} + +val adminDocs by configurations.creating { + isCanBeConsumed = false + isCanBeResolved = true +} + +dependencies { + adminDistribution(project(":polaris-quarkus-admin", "distributionElements")) + serverDistribution(project(":polaris-quarkus-server", "distributionElements")) + adminDocs(project(":polaris-quarkus-admin", "distributionDocs")) +} + +distributions { + main { + distributionBaseName.set("polaris-bin") + contents { + // Copy admin distribution contents + into("admin") { + from(adminDistribution) { + exclude("quarkus-app-dependencies.txt") + } + } + + // Copy server distribution contents + into("server") { + from(serverDistribution) { + exclude("quarkus-app-dependencies.txt") + } + } + + // Copy scripts to bin directory + into("bin") { + from("bin/server") + from("bin/admin") + } + + from("README.md") + from("DISCLAIMER") + + // TODO: combine the LICENSE and NOTICE in a follow-up PR + from(adminDocs) + } + } +} + +val distTar = tasks.named("distTar") { + compression = Compression.GZIP +} + +val distZip = tasks.named("distZip") { +} + +val digestDistTar = + tasks.register("digestDistTar") { + description = "Generate the distribution tar digest" + dependsOn(distTar) + file.set { distTar.get().archiveFile.get().asFile } + } + +val digestDistZip = + tasks.register("digestDistZip") { + description = "Generate the distribution zip digest" + dependsOn(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()) + } +} \ No newline at end of file diff --git a/quarkus/run-script/build.gradle.kts b/quarkus/run-script/build.gradle.kts deleted file mode 100644 index 315e88edda..0000000000 --- a/quarkus/run-script/build.gradle.kts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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. - */ - -val runScript by - configurations.creating { description = "Used to provide the run.sh script" } - -description = "Provides run.sh script for Quarkus fast-jar for distribution tar/zip" - -// This is a separate project that only provides run scripts (run.sh). -// It is a separate project, because it is not good practice to directly -// reference files outside any project. -// -// Artifacts are NOT published as a Maven artifacts. - -artifacts { - add(runScript.name, project.layout.projectDirectory.file("scripts/run.sh")) -} - -// Need this task to be present, there are no checks/tests in this project though -tasks.register("check") diff --git a/quarkus/server/build.gradle.kts b/quarkus/server/build.gradle.kts index b9af7b98fe..b486914c4f 100644 --- a/quarkus/server/build.gradle.kts +++ b/quarkus/server/build.gradle.kts @@ -19,7 +19,6 @@ import io.quarkus.gradle.tasks.QuarkusBuild import io.quarkus.gradle.tasks.QuarkusRun -import publishing.GenerateDigest plugins { alias(libs.plugins.quarkus) @@ -27,19 +26,17 @@ plugins { alias(libs.plugins.openapi.generator) id("polaris-quarkus") // id("polaris-license-report") - id("distribution") } val quarkusRunner by configurations.creating { description = "Used to reference the generated runner-jar" } -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" } +// Configuration to expose distribution artifacts +val distributionElements by + configurations.creating { + isCanBeConsumed = true + isCanBeResolved = false + } dependencies { implementation(project(":polaris-core")) @@ -56,8 +53,6 @@ dependencies { // enforce the Quarkus _platform_ here, to get a consistent and validated set of dependencies implementation(enforcedPlatform(libs.quarkus.bom)) implementation("io.quarkus:quarkus-container-image-docker") - - runScript(project(":polaris-quarkus-run-script", "runScript")) } quarkus { @@ -84,78 +79,13 @@ tasks.named("quarkusRun") { listOf("-Dpolaris.bootstrap.credentials=POLARIS,root,secret", "-Dquarkus.console.color=true") } -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") -val distTar = - tasks.named("distTar") { - dependsOn(quarkusBuild) - inputs.files(runScript) - compression = Compression.GZIP - } - -val distZip = - tasks.named("distZip") { - dependsOn(quarkusBuild) - inputs.files(runScript) - } - -val digestDistTar = - tasks.register("digestDistTar") { - description = "Generate the distribution tar digest" - mustRunAfter(distTar) - file.set { distTar.get().archiveFile.get().asFile } - } - -val digestDistZip = - tasks.register("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. artifacts { add(quarkusRunner.name, provider { quarkusBuild.get().fastJar.resolve("quarkus-run.jar") }) { builtBy(quarkusBuild) } - 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) } -} - -afterEvaluate { - publishing { - publications { - named("maven") { - artifact(distTar.get().archiveFile) { builtBy(distTar) } - artifact(distZip.get().archiveFile) { builtBy(distZip) } - } - } - } + add("distributionElements", layout.buildDirectory.dir("quarkus-app")) { builtBy("quarkusBuild") } } diff --git a/quarkus/server/distribution/README.md b/quarkus/server/distribution/README.md deleted file mode 100644 index 00003f1e6f..0000000000 --- a/quarkus/server/distribution/README.md +++ /dev/null @@ -1,40 +0,0 @@ - - -# Apache Polaris - Server - -## Prerequisites - -Polaris server requires a Java SE 21 or higher to run. - -## Start the server - -In a command line, in the directory where you extracted the Polaris server archive, run the following command to start the server: - -``` -./run.sh -``` - -## Stop the server - -In the command line where you started the Polaris server, simply type CTRL-C to stop the server. - -## Documentation - -For more details, please take a look on the documentation: https://polaris.apache.org/in-dev/unreleased/configuring-polaris-for-production/ \ No newline at end of file