Skip to content
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

Switch to golang based launcher #24132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions core/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ COPY --from=jdk-download $JAVA_HOME $JAVA_HOME
RUN \
set -xeu && \
microdnf update -y && \
microdnf install -y tar less python3 shadow-utils && \
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \
microdnf install -y tar less shadow-utils && \
groupadd trino --gid 1000 && \
useradd trino --uid 1000 --gid 1000 --create-home && \
mkdir -p /usr/lib/trino /data/trino && \
Expand Down
32 changes: 29 additions & 3 deletions core/trino-server-rpm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
</properties>

<dependencies>

<dependency>
<groupId>com.github.docker-java</groupId>
<artifactId>docker-java-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -180,7 +186,6 @@
<description>Trino Server RPM Package.</description>
<epoch>0</epoch>
<requires>
<require>python ge 2.4</require>
<require>/usr/sbin/useradd</require>
<require>/usr/sbin/groupadd</require>
<!-- Used e.g. by service launcher -->
Expand Down Expand Up @@ -222,7 +227,28 @@
<!-- make sure launcher scripts are executable -->
<mode>0755</mode>
</file>
<!-- make launcher and launcher.py executable -->
<!-- make launcher and launcher executable -->
<file>
<when>
<suffix>/usr/lib/trino/bin/linux-amd64/launcher2</suffix>
<type>file</type>
</when>
<mode>0755</mode>
</file>
<file>
<when>
<suffix>/usr/lib/trino/bin/linux-arm64/launcher2</suffix>
<type>file</type>
</when>
<mode>0755</mode>
</file>
<file>
<when>
<suffix>/usr/lib/trino/bin/linux-ppc64le/launcher2</suffix>
<type>file</type>
</when>
<mode>0755</mode>
</file>
<file>
<when>
<suffix>/usr/lib/trino/bin/launcher</suffix>
Expand All @@ -232,7 +258,7 @@
</file>
<file>
<when>
<suffix>/usr/lib/trino/bin/launcher.py</suffix>
<suffix>/usr/lib/trino/bin/launcher</suffix>
wendigo marked this conversation as resolved.
Show resolved Hide resolved
<type>file</type>
</when>
<mode>0755</mode>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private void testInstall(String temurinReleaseName, String javaHome, String expe
String rpm = "/" + new File(rpmHostPath).getName();
String command =
"""
microdnf install -y tar gzip python sudo shadow-utils
microdnf install -y tar gzip sudo shadow-utils
%s
rpm -i %s
mkdir /etc/trino/catalog
Expand All @@ -106,7 +106,10 @@ private void testInstall(String temurinReleaseName, String javaHome, String expe
container.withExposedPorts(8080)
// the RPM is hundreds MB and file system bind is much more efficient
.withFileSystemBind(rpmHostPath, rpm, BindMode.READ_ONLY)
.withPrivilegedMode(true)
.withCommand("sh", "-xeuc", command)
.withCreateContainerCmdModifier(modifier -> modifier
.withHostConfig(modifier.getHostConfig().withInit(true)))
.waitingFor(forLogMessage(".*SERVER STARTED.*", 1).withStartupTimeout(Duration.ofMinutes(5)))
.start();
QueryRunner queryRunner = new QueryRunner(container.getHost(), container.getMappedPort(8080));
Expand All @@ -125,7 +128,7 @@ private void testUninstall(String temurinReleaseName, String javaHome)
String rpm = "/" + new File(rpmHostPath).getName();
String installAndStartTrino =
"""
microdnf install -y tar gzip python sudo shadow-utils
microdnf install -y tar gzip sudo shadow-utils
%s
rpm -i %s
/etc/init.d/trino start
Expand All @@ -135,11 +138,16 @@ private void testUninstall(String temurinReleaseName, String javaHome)
try (GenericContainer<?> container = new GenericContainer<>(BASE_IMAGE)) {
container.withFileSystemBind(rpmHostPath, rpm, BindMode.READ_ONLY)
.withCommand("sh", "-xeuc", installAndStartTrino)
.withCreateContainerCmdModifier(modifier -> modifier
.withHostConfig(modifier.getHostConfig().withInit(true)))
.withPrivilegedMode(true)
.waitingFor(forLogMessage(".*SERVER STARTED.*", 1).withStartupTimeout(Duration.ofMinutes(5)))
.start();
String uninstallTrino =
"""
echo "Before stop"
/etc/init.d/trino stop
echo "After stop"
rpm -e trino-server-rpm
""";
container.execInContainer("sh", "-xeuc", uninstallTrino);
Expand Down Expand Up @@ -171,7 +179,12 @@ public void testRpmContents()
assertThatPaths(files)
.exists("/usr/lib/trino/bin")
.path("/usr/lib/trino/bin/launcher").isOwnerExecutable()
.path("/usr/lib/trino/bin/launcher.py").isOwnerExecutable()
.path("/usr/lib/trino/bin/linux-amd64/launcher").isOwnerExecutable()
.path("/usr/lib/trino/bin/linux-arm64/launcher").isOwnerExecutable()
.path("/usr/lib/trino/bin/linux-ppc64le/launcher").isOwnerExecutable()
.exists("/usr/lib/trino/bin/linux-amd64/libprocname.so")
.exists("/usr/lib/trino/bin/linux-arm64/libprocname.so")
.exists("/usr/lib/trino/bin/linux-ppc64le/libprocname.so")
.path("/etc/init.d/trino").isOwnerExecutable()
.exists("/usr/lib/trino/bin/launcher.properties");

Expand Down
11 changes: 2 additions & 9 deletions docs/src/main/sphinx/installation/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ We recommend using the Eclipse Temurin OpenJDK distribution from
against that distribution. Eclipse Temurin is also the JDK used by the [Trino
Docker image](https://hub.docker.com/r/trinodb/trino).

(requirements-python)=
### Python

- version 2.6.x, 2.7.x, or 3.x
- required by the `bin/launcher` script only

## Installing Trino

Download the Trino server tarball, {maven_download}`server`, and unpack it. The
Expand Down Expand Up @@ -293,9 +287,8 @@ See {doc}`/connector` for more information about configuring catalogs.
(running-trino)=
## Running Trino

The installation provides a `bin/launcher` script, which requires Python in
the `PATH`. The script can be used manually or as a daemon startup script. It
accepts the following commands:
The installation provides a `bin/launcher` script that can be used manually
or as a daemon startup script. It accepts the following commands:

:::{list-table} `launcher` commands
:widths: 15, 85
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
<air.test.jvm.additional-arguments>${air.test.jvm.additional-arguments.default}</air.test.jvm.additional-arguments>

<!-- keep dependency properties sorted -->
<dep.airlift.version>284</dep.airlift.version>
<dep.airlift.version>285-SNAPSHOT</dep.airlift.version>
<dep.alluxio.version>2.9.6</dep.alluxio.version>
<dep.antlr.version>4.13.2</dep.antlr.version>
<dep.avro.version>1.12.0</dep.avro.version>
Expand Down
Loading