Skip to content

Commit 9001785

Browse files
authored
Create a single binary distribution bundle (#1589)
1 parent e5bc87e commit 9001785

File tree

11 files changed

+274
-308
lines changed

11 files changed

+274
-308
lines changed

gradle/projects.main.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ polaris-service-common=service/common
2828
polaris-quarkus-defaults=quarkus/defaults
2929
polaris-quarkus-service=quarkus/service
3030
polaris-quarkus-server=quarkus/server
31+
polaris-quarkus-distribution=quarkus/distribution
3132
polaris-quarkus-spark-tests=quarkus/spark-tests
3233
polaris-quarkus-admin=quarkus/admin
3334
polaris-quarkus-common=quarkus/common
3435
polaris-quarkus-test-commons=quarkus/test-commons
35-
polaris-quarkus-run-script=quarkus/run-script
3636
polaris-eclipselink=extension/persistence/eclipselink
3737
polaris-jpa-model=extension/persistence/jpa-model
3838
polaris-relational-jdbc=extension/persistence/relational-jdbc

quarkus/admin/build.gradle.kts

Lines changed: 17 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,14 @@
1717
* under the License.
1818
*/
1919

20-
import io.quarkus.gradle.tasks.QuarkusBuild
21-
import publishing.GenerateDigest
22-
2320
plugins {
2421
alias(libs.plugins.quarkus)
2522
alias(libs.plugins.jandex)
2623
alias(libs.plugins.openapi.generator)
2724
id("polaris-quarkus")
2825
// id("polaris-license-report")
29-
id("distribution")
3026
}
3127

32-
val runScript by configurations.creating { description = "Used to reference the run.sh script" }
33-
34-
val distributionZip by
35-
configurations.creating { description = "Used to reference the distribution zip" }
36-
37-
val distributionTar by
38-
configurations.creating { description = "Used to reference the distribution tarball" }
39-
4028
dependencies {
4129
implementation(project(":polaris-core"))
4230
implementation(project(":polaris-version"))
@@ -69,8 +57,6 @@ dependencies {
6957

7058
testRuntimeOnly(project(":polaris-eclipselink"))
7159
testRuntimeOnly("org.postgresql:postgresql")
72-
73-
runScript(project(":polaris-quarkus-run-script", "runScript"))
7460
}
7561

7662
quarkus {
@@ -90,77 +76,27 @@ quarkus {
9076
)
9177
}
9278

93-
distributions {
94-
main {
95-
contents {
96-
from(runScript)
97-
from(project.layout.buildDirectory.dir("quarkus-app"))
98-
from("distribution/NOTICE")
99-
from("distribution/LICENSE")
100-
from("distribution/README.md")
101-
from("distribution/DISCLAIMER")
102-
}
103-
}
104-
}
105-
106-
val quarkusBuild = tasks.named<QuarkusBuild>("quarkusBuild")
107-
108-
val distTar =
109-
tasks.named<Tar>("distTar") {
110-
dependsOn(quarkusBuild)
111-
// Trigger resolution (and build) of the run-script artifact
112-
inputs.files(runScript)
113-
compression = Compression.GZIP
114-
}
115-
116-
val distZip =
117-
tasks.named<Zip>("distZip") {
118-
dependsOn(quarkusBuild)
119-
// Trigger resolution (and build) of the run-script artifact
120-
inputs.files(runScript)
79+
// Configuration to expose distribution artifacts
80+
val distributionElements by
81+
configurations.creating {
82+
isCanBeConsumed = true
83+
isCanBeResolved = false
12184
}
12285

123-
val digestDistTar =
124-
tasks.register<GenerateDigest>("digestDistTar") {
125-
description = "Generate the distribution tar digest"
126-
mustRunAfter(distTar)
127-
file.set { distTar.get().archiveFile.get().asFile }
128-
}
129-
130-
val digestDistZip =
131-
tasks.register<GenerateDigest>("digestDistZip") {
132-
description = "Generate the distribution zip digest"
133-
mustRunAfter(distZip)
134-
file.set { distZip.get().archiveFile.get().asFile }
135-
}
136-
137-
distTar.configure { finalizedBy(digestDistTar) }
138-
139-
distZip.configure { finalizedBy(digestDistZip) }
140-
141-
if (project.hasProperty("release") || project.hasProperty("signArtifacts")) {
142-
signing {
143-
sign(distTar.get())
144-
sign(distZip.get())
145-
}
146-
}
147-
148-
// Expose runnable jar via quarkusRunner configuration for integration-tests that require the
149-
// server.
86+
// Register the quarkus app directory as an artifact
15087
artifacts {
151-
add(distributionTar.name, provider { distTar.get().archiveFile }) { builtBy(distTar) }
152-
add(distributionTar.name, provider { digestDistTar.get().outputFile }) { builtBy(digestDistTar) }
153-
add(distributionZip.name, provider { distZip.get().archiveFile }) { builtBy(distZip) }
154-
add(distributionZip.name, provider { digestDistZip.get().outputFile }) { builtBy(digestDistZip) }
88+
add("distributionElements", layout.buildDirectory.dir("quarkus-app")) { builtBy("quarkusBuild") }
15589
}
15690

157-
afterEvaluate {
158-
publishing {
159-
publications {
160-
named<MavenPublication>("maven") {
161-
artifact(distTar.get().archiveFile) { builtBy(distTar) }
162-
artifact(distZip.get().archiveFile) { builtBy(distZip) }
163-
}
164-
}
91+
// Configuration to expose LICENSE and NOTICE files
92+
val distributionDocs by
93+
configurations.creating {
94+
isCanBeConsumed = true
95+
isCanBeResolved = false
16596
}
97+
98+
// Add LICENSE and NOTICE as artifacts
99+
artifacts {
100+
add("distributionDocs", file("distribution/LICENSE"))
101+
add("distributionDocs", file("distribution/NOTICE"))
166102
}

quarkus/admin/distribution/README.md

Lines changed: 0 additions & 56 deletions
This file was deleted.

quarkus/distribution/DISCLAIMER

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Apache Polaris (incubating) is an effort undergoing incubation at The Apache
2+
Software Foundation (ASF), sponsored by the Apache Incubator PMC.
3+
4+
Incubation is required of all newly accepted projects until a further review
5+
indicates that the infrastructure, communications, and decision making process
6+
have stabilized in a manner consistent with other successful ASF projects.
7+
8+
While incubation status is not necessarily a reflection of the completeness
9+
or stability of the code, it does indicate that the project has yet to be
10+
fully endorsed by the ASF.

quarkus/distribution/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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 Distribution
21+
22+
This distribution contains both the Polaris Server and Admin Tool.
23+
24+
## Prerequisites
25+
26+
- Java SE 21 or higher
27+
28+
## Directory Structure
29+
30+
```
31+
polaris-quarkus-distribution-@version@/
32+
├── LICENSE
33+
├── NOTICE
34+
├── README.md
35+
├── admin/ # Admin tool files
36+
├── bin/ # Executable scripts
37+
│ ├── admin
38+
│ └── server
39+
└── server/ # Server files
40+
```
41+
42+
## Usage
43+
44+
The distribution includes separate scripts for running the server and admin tool:
45+
46+
### Start the Server
47+
48+
```bash
49+
bin/server
50+
```
51+
52+
### Use the Admin Tool
53+
54+
```bash
55+
bin/admin --help # Show admin commands
56+
bin/admin bootstrap -h # Show bootstrap help
57+
bin/admin purge -h # Show purge help
58+
```
59+
60+
For full usage instructions and configuration details, see the official Polaris docs at https://polaris.apache.org/.
61+
62+
### Configuration
63+
64+
Both components can be configured using environment variables or system properties. For example:
65+
66+
```bash
67+
# Configure server port
68+
POLARIS_JAVA_OPTS="-Dquarkus.http.port=8080" bin/server
69+
70+
# Configure admin tool
71+
POLARIS_JAVA_OPTS="-Dpolaris.persistence.type=relational-jdbc" bin/admin
72+
73+
# You can also set JAVA_OPTS as an environment variable
74+
export POLARIS_JAVA_OPTS="-Xms512m -Xmx1g -Dquarkus.http.port=8080"
75+
bin/server
76+
```
77+
78+
For more details on configuration, please refer to the Polaris documentation:
79+
https://polaris.apache.org/

quarkus/run-script/scripts/run.sh renamed to quarkus/distribution/bin/admin

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,17 @@
1616
# KIND, either express or implied. See the License for the
1717
# specific language governing permissions and limitations
1818
# under the License.
19-
#
20-
21-
# Linux Quarkus fast-jar run script for Apache Polaris
22-
23-
set -e
2419

25-
script_dir="$(dirname "$0")"
20+
set -euo pipefail
2621

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

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

39-
exec "${JAVACMD}" -jar "${script_dir}/quarkus-run.jar" $@
31+
# Launch Quarkus
32+
exec "$JAVA_CMD" ${POLARIS_JAVA_OPTS:-} -jar quarkus-run.jar "$@"

quarkus/distribution/bin/server

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
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+
set -euo pipefail
21+
22+
# Get the directory
23+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
24+
cd "$SCRIPT_DIR/../server"
25+
26+
# Get the Java command
27+
JAVA_CMD="${JAVA_HOME:+${JAVA_HOME%/}/bin/java}"
28+
JAVA_CMD="${JAVA_CMD:-$(command -v java)}"
29+
[ -x "$JAVA_CMD" ] || { echo "Java not found – set JAVA_HOME or add java to PATH." >&2; exit 1; }
30+
31+
# Launch Quarkus
32+
exec "$JAVA_CMD" ${POLARIS_JAVA_OPTS:-} -jar quarkus-run.jar

0 commit comments

Comments
 (0)