Skip to content

Commit dbffc4a

Browse files
committed
Add launcher and create tar for trino-gateway
1 parent c59bb7d commit dbffc4a

28 files changed

+243
-78
lines changed

docker/Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@ RUN \
4040
microdnf install -y tar less shadow-utils && \
4141
groupadd trino --gid 1000 && \
4242
useradd trino --uid 1000 --gid 1000 --create-home && \
43-
mkdir -p /usr/lib/trino-gateway /etc/trino-gateway && \
44-
chown -R "trino:trino" /usr/lib/trino-gateway /etc/trino-gateway
43+
mkdir -p /usr/lib/trino-gateway /data/trino-gateway && \
44+
chown -R "trino:trino" /usr/lib/trino-gateway /data/trino-gateway
4545

46-
COPY --chown=trino:trino gateway-ha /usr/lib/trino-gateway
46+
ARG TRINO_GATEWAY_VERSION
47+
COPY --chown=trino:trino trino-gateway-server-${TRINO_GATEWAY_VERSION} /usr/lib/trino-gateway
48+
COPY --chown=trino:trino default/etc /etc/trino-gateway
4749

4850
EXPOSE 8080
4951
USER trino:trino
50-
CMD java -jar /usr/lib/trino-gateway/gateway-ha-jar-with-dependencies.jar "/etc/trino-gateway/config.yaml"
52+
CMD ["/usr/lib/trino-gateway/bin/run-trino-gateway"]
5153

5254
HEALTHCHECK --interval=10s --timeout=5s --start-period=10s \
5355
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: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,24 +95,24 @@ function temurin_jdk_link() {
9595
check_environment
9696

9797
if [ -n "$TRINO_GATEWAY_VERSION" ]; then
98-
echo "🎣 Downloading Trino Gateway server artifact for release version ${TRINO_GATEWAY_VERSION}"
99-
"${SOURCE_DIR}/mvnw" -C dependency:get -Dtransitive=false -Dartifact="io.trino.gateway:gateway-ha:${TRINO_GATEWAY_VERSION}:jar:jar-with-dependencies"
98+
echo "🎣 Downloading Gateway server artifact for release version ${TRINO_GATEWAY_VERSION}"
99+
"${SOURCE_DIR}/mvnw" -C dependency:get -Dtransitive=false -Dartifact="io.trino.gateway:trino-gateway-server:${TRINO_GATEWAY_VERSION}:tar.gz"
100100
local_repo=$("${SOURCE_DIR}/mvnw" -B help:evaluate -Dexpression=settings.localRepository -q -DforceStdout)
101-
trino_gateway_ha="$local_repo/io/trino/gateway/gateway-ha/${TRINO_GATEWAY_VERSION}/gateway-ha-${TRINO_GATEWAY_VERSION}-jar-with-dependencies.jar"
101+
trino_gateway_ha="$local_repo/io/trino/gateway/trino-gateway-server/${TRINO_GATEWAY_VERSION}/trino-gateway-server-${TRINO_GATEWAY_VERSION}.tar.gz"
102102
chmod +x "$trino_gateway_ha"
103103
else
104104
TRINO_GATEWAY_VERSION=$("${SOURCE_DIR}/mvnw" -f "${SOURCE_DIR}/pom.xml" --quiet help:evaluate -Dexpression=project.version -DforceStdout)
105-
echo "🎯 Using currently built artifacts from the gateway-ha module with version ${TRINO_GATEWAY_VERSION}"
106-
trino_gateway_ha="${SOURCE_DIR}/gateway-ha/target/gateway-ha-${TRINO_GATEWAY_VERSION}-jar-with-dependencies.jar"
105+
echo "🎯 Using currently built artifacts with version ${TRINO_GATEWAY_VERSION}"
106+
trino_gateway_ha="${SOURCE_DIR}/trino-gateway-server/target/trino-gateway-server-${TRINO_GATEWAY_VERSION}.tar.gz"
107107
fi
108108

109109
echo "🧱 Preparing the image build context directory"
110110
WORK_DIR="$(mktemp -d)"
111-
GATEWAY_WORK_DIR="${WORK_DIR}/gateway-ha"
112-
mkdir "${GATEWAY_WORK_DIR}"
113-
cp "$trino_gateway_ha" "${GATEWAY_WORK_DIR}/gateway-ha-jar-with-dependencies.jar"
114-
cp -R bin "${GATEWAY_WORK_DIR}"
115-
cp "${SCRIPT_DIR}/Dockerfile" "${WORK_DIR}"
111+
cp "$trino_gateway_ha" "${WORK_DIR}/"
112+
tar -C "${WORK_DIR}" -xzf "${WORK_DIR}/trino-gateway-server-${TRINO_GATEWAY_VERSION}.tar.gz"
113+
rm "${WORK_DIR}/trino-gateway-server-${TRINO_GATEWAY_VERSION}.tar.gz"
114+
cp -R bin "${WORK_DIR}/trino-gateway-server-${TRINO_GATEWAY_VERSION}"
115+
cp -R default "${WORK_DIR}/"
116116

117117
TAG_PREFIX="trino-gateway:${TRINO_GATEWAY_VERSION}"
118118
#version file is used by the Helm chart test
@@ -131,7 +131,8 @@ for arch in "${ARCHITECTURES[@]}"; do
131131
--build-arg TRINO_GATEWAY_BASE_IMAGE="${TRINO_GATEWAY_BASE_IMAGE}" \
132132
--platform "linux/$arch" \
133133
-f Dockerfile \
134-
-t "${TAG_PREFIX}-$arch"
134+
-t "${TAG_PREFIX}-$arch" \
135+
--build-arg "TRINO_GATEWAY_VERSION=${TRINO_GATEWAY_VERSION}"
135136
done
136137

137138
echo "🧹 Cleaning up the build context directory"
File renamed without changes.

docker/default/etc/jvm.config

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
# Reduce starvation of threads by GClocker, recommend to set about the number of cpu cores (JDK-8192647)
15+
-XX:+UnlockDiagnosticVMOptions
16+
-XX:GCLockerRetryAllocationCount=32
17+
# Allow loading dynamic agent used by JOL
18+
-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}

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)