Skip to content

Commit 415bffd

Browse files
committed
Add launcher and create tar for trino-gateway
1 parent 3a1553a commit 415bffd

28 files changed

+229
-76
lines changed

docker/Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,16 @@ RUN \
5959
set -xeu && \
6060
groupadd trino --gid 1000 && \
6161
useradd trino --uid 1000 --gid 1000 --create-home && \
62-
mkdir -p /usr/lib/trino-gateway /etc/trino-gateway && \
63-
chown -R "trino:trino" /usr/lib/trino-gateway /etc/trino-gateway
62+
mkdir -p /usr/lib/trino-gateway /data/trino-gateway && \
63+
chown -R "trino:trino" /usr/lib/trino-gateway /data/trino-gateway
6464

65-
COPY --chown=trino:trino gateway-ha /usr/lib/trino-gateway
65+
ARG TRINO_GATEWAY_VERSION
66+
COPY --chown=trino:trino trino-gateway-server-${TRINO_GATEWAY_VERSION} /usr/lib/trino-gateway
67+
COPY --chown=trino:trino default/etc /etc/trino-gateway
6668

6769
EXPOSE 8080
6870
USER trino:trino
69-
CMD java -jar /usr/lib/trino-gateway/gateway-ha-jar-with-dependencies.jar "/etc/trino-gateway/config.yaml"
71+
CMD ["/usr/lib/trino-gateway/bin/run-trino-gateway"]
7072

7173
HEALTHCHECK --interval=10s --timeout=5s --start-period=10s \
7274
CMD /usr/lib/trino-gateway/bin/health-check

docker/bin/run-trino-gateway

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
set -xeuo pipefail
4+
5+
launcher_opts=(--etc-dir /etc/trino-gateway --config /etc/trino-gateway/config.yaml)
6+
if ! grep -s -q 'node.id' /etc/trino-gateway/node.properties; then
7+
launcher_opts+=("-Dnode.id=${HOSTNAME}")
8+
fi
9+
10+
exec /usr/lib/trino-gateway/bin/launcher run "${launcher_opts[@]}" "$@"

docker/build.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,23 +85,23 @@ check_environment
8585

8686
if [ -n "$TRINO_GATEWAY_VERSION" ]; then
8787
echo "🎣 Downloading Trino Gateway server artifact for release version ${TRINO_GATEWAY_VERSION}"
88-
"${SOURCE_DIR}/mvnw" -C dependency:get -Dtransitive=false -Dartifact="io.trino.gateway:gateway-ha:${TRINO_GATEWAY_VERSION}:jar:jar-with-dependencies"
88+
"${SOURCE_DIR}/mvnw" -C dependency:get -Dtransitive=false -Dartifact="io.trino.gateway:trino-gateway-server:${TRINO_GATEWAY_VERSION}:tar.gz"
8989
local_repo=$("${SOURCE_DIR}/mvnw" -B help:evaluate -Dexpression=settings.localRepository -q -DforceStdout)
90-
trino_gateway_ha="$local_repo/io/trino/gateway/gateway-ha/${TRINO_GATEWAY_VERSION}/gateway-ha-${TRINO_GATEWAY_VERSION}-jar-with-dependencies.jar"
90+
trino_gateway_ha="$local_repo/io/trino/gateway/trino-gateway-server/${TRINO_GATEWAY_VERSION}/trino-gateway-server-${TRINO_GATEWAY_VERSION}.tar.gz"
9191
chmod +x "$trino_gateway_ha"
9292
else
9393
TRINO_GATEWAY_VERSION=$("${SOURCE_DIR}/mvnw" -f "${SOURCE_DIR}/pom.xml" --quiet help:evaluate -Dexpression=project.version -DforceStdout)
94-
echo "🎯 Using currently built artifacts from the gateway-ha module with version ${TRINO_GATEWAY_VERSION}"
95-
trino_gateway_ha="${SOURCE_DIR}/gateway-ha/target/gateway-ha-${TRINO_GATEWAY_VERSION}-jar-with-dependencies.jar"
94+
echo "🎯 Using currently built artifacts with version ${TRINO_GATEWAY_VERSION}"
95+
trino_gateway_ha="${SOURCE_DIR}/trino-gateway-server/target/trino-gateway-server-${TRINO_GATEWAY_VERSION}.tar.gz"
9696
fi
9797

9898
echo "🧱 Preparing the image build context directory"
9999
WORK_DIR="$(mktemp -d)"
100-
GATEWAY_WORK_DIR="${WORK_DIR}/gateway-ha"
101-
mkdir "${GATEWAY_WORK_DIR}"
102-
cp "$trino_gateway_ha" "${GATEWAY_WORK_DIR}/gateway-ha-jar-with-dependencies.jar"
103-
cp -R bin "${GATEWAY_WORK_DIR}"
104-
cp "${SCRIPT_DIR}/Dockerfile" "${WORK_DIR}"
100+
cp "$trino_gateway_ha" "${WORK_DIR}/"
101+
tar -C "${WORK_DIR}" -xzf "${WORK_DIR}/trino-gateway-server-${TRINO_GATEWAY_VERSION}.tar.gz"
102+
rm "${WORK_DIR}/trino-gateway-server-${TRINO_GATEWAY_VERSION}.tar.gz"
103+
cp -R bin "${WORK_DIR}/trino-gateway-server-${TRINO_GATEWAY_VERSION}"
104+
cp -R default "${WORK_DIR}/"
105105

106106
TAG_PREFIX="trino-gateway:${TRINO_GATEWAY_VERSION}"
107107
#version file is used by the Helm chart test
@@ -122,7 +122,8 @@ for arch in "${ARCHITECTURES[@]}"; do
122122
--build-arg TRINO_GATEWAY_BUILD_IMAGE="${TRINO_GATEWAY_BUILD_IMAGE}" \
123123
--platform "linux/$arch" \
124124
-f Dockerfile \
125-
-t "${TAG_PREFIX}-$arch"
125+
-t "${TAG_PREFIX}-$arch" \
126+
--build-arg "TRINO_GATEWAY_VERSION=${TRINO_GATEWAY_VERSION}"
126127
done
127128

128129
echo "🧹 Cleaning up the build context directory"

docker/default/etc/jvm.config

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-server
2+
-XX:InitialRAMPercentage=80
3+
-XX:MaxRAMPercentage=80
4+
-XX:G1HeapRegionSize=32M
5+
-XX:+ExplicitGCInvokesConcurrent
6+
-XX:+HeapDumpOnOutOfMemoryError
7+
-XX:+ExitOnOutOfMemoryError
8+
-XX:-OmitStackTraceInFastThrow
9+
-XX:ReservedCodeCacheSize=256M
10+
-XX:PerMethodRecompilationCutoff=10000
11+
-XX:PerBytecodeRecompilationCutoff=10000
12+
-Djdk.attach.allowAttachSelf=true
13+
-Djdk.nio.maxCachedBufferSize=2000000
14+
-Dfile.encoding=UTF-8
15+
# Allow loading dynamic agent used by JOL
16+
-XX:+EnableDynamicAgentLoading

docker/default/etc/log.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Enable verbose logging from Trino
2+
#io.trino=DEBUG

docker/default/etc/node.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node.environment=docker
2+
node.data-dir=/data/trino-gateway

docker/docker-compose.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ services:
1212
start_period: 20s
1313
ports:
1414
- "8080:8080"
15-
volumes:
16-
- target: /etc/trino-gateway/config.yaml
17-
source: ./config.yaml
18-
type: bind
1915

2016
postgres:
2117
image: ${TRINO_GATEWAY_POSTGRES_IMAGE:-postgres:17-alpine}

docs/development.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ To enable them, set the environment variable `TG_RUN_ORACLE_TESTS=true`. These t
3535
will always be run in GitHub CI.
3636

3737
```shell
38-
cd gateway-ha/target/
39-
java -jar gateway-ha-{{VERSION}}-jar-with-dependencies.jar ../config.yaml
38+
cd trino-gateway-server/target/trino-gateway-server-{{VERSION}}
39+
bin/launcher start --config path/to/config.yaml
4040
```
4141

4242
#### In Docker

docs/docker.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ details found in the `docker-compose.yml` file.
151151

152152
## Configuration
153153

154-
The image uses the configuration file `docker/config.yaml` from the project
155-
checkout, and mounts it at `/etc/trino-gateway/config.yaml`.
154+
The image uses the configuration file `docker/default/etc/config.yaml` from the project checkout.
156155

157156
## Health check
158157

0 commit comments

Comments
 (0)