Skip to content

Commit

Permalink
Merge pull request #1 from UrbanOS-Public/temurin-jdk
Browse files Browse the repository at this point in the history
Temurin jdk
  • Loading branch information
ian-j-abbott-accenture authored Aug 16, 2024
2 parents 9dd2fb1 + 3e2866c commit 46a43d7
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 29 deletions.
36 changes: 21 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG PROMETHEUS_VERSION=0.20.0
ARG TRINO_VERSION=443
ARG TRINO_VERSION=453

FROM registry.access.redhat.com/ubi8/ubi:latest as downloader
FROM registry.access.redhat.com/ubi9/ubi:latest as downloader

ARG PROMETHEUS_VERSION
ARG TRINO_VERSION
Expand All @@ -22,17 +22,13 @@ COPY bin ${WORK_DIR}/trino-server-${TRINO_VERSION}
COPY default ${WORK_DIR}/

###########################
# Remove all unused plugins
# Only hive, blackhole, jmx, memory, postgresql, tpcds, and tpch are configured plugins.
ARG to_delete="/TO_DELETE"
RUN mkdir ${to_delete} && \
mv ${WORK_DIR}/trino-server-${TRINO_VERSION}/plugin/* ${to_delete} && \
mv ${to_delete}/{hive,blackhole,jmx,memory,postgresql,tpcds,tpch} ${WORK_DIR}/trino-server-${TRINO_VERSION}/plugin/. && \
rm -rf ${to_delete}
# Remove unwanted plugins
RUN rm -rf ${WORK_DIR}/trino-server-${TRINO_VERSION}/plugin/{phoenix5,redshift,pinot}

###########################

# Final container image:
FROM registry.access.redhat.com/ubi8/ubi:latest
FROM registry.access.redhat.com/ubi9/ubi:latest

LABEL io.k8s.display-name="OpenShift Trino" \
io.k8s.description="This is an image used by Cost Management to install and run Trino." \
Expand All @@ -42,13 +38,23 @@ LABEL io.k8s.display-name="OpenShift Trino" \

RUN yum -y update && yum clean all

#ENV DISTRIBUTION_NAME=rhel

RUN touch /etc/yum.repos.d/adoptium.repo

RUN \
echo '[Adoptium]' >> /etc/yum.repos.d/adoptium.repo; \
echo 'name=Adoptium' >> /etc/yum.repos.d/adoptium.repo; \
echo "baseurl=https://packages.adoptium.net/artifactory/rpm/${DISTRIBUTION_NAME:-$(. /etc/os-release; echo $ID)}/\$releasever/\$basearch" >> /etc/yum.repos.d/adoptium.repo; \
echo 'enabled=1' >> /etc/yum.repos.d/adoptium.repo; \
echo 'gpgcheck=1' >> /etc/yum.repos.d/adoptium.repo; \
echo 'gpgkey=https://packages.adoptium.net/artifactory/api/gpg/key/public' >> /etc/yum.repos.d/adoptium.repo

RUN \
# symlink the python3 installed in the container
ln -s /usr/libexec/platform-python /usr/bin/python && \
# add the Azul RPM repository -> needs to match whatever trino requires
yum install -y https://cdn.azul.com/zulu/bin/zulu-repo-1.0.0-1.noarch.rpm && \
set -xeu && \
INSTALL_PKGS="zulu21-jre less jq" && \
INSTALL_PKGS="temurin-22-jdk less jq" && \
yum install -y $INSTALL_PKGS --setopt=tsflags=nodocs --setopt=install_weak_deps=False && \
yum clean all && \
rm -rf /var/cache/yum
Expand All @@ -60,7 +66,7 @@ RUN \
mkdir -p /usr/lib/trino /data/trino/{data,logs,spill} && \
chown -R "trino:trino" /usr/lib/trino /data/trino

ENV JAVA_HOME=/usr/lib/jvm/zulu21 \
ENV JAVA_HOME=/usr/lib/jvm/temurin-22-jdk \
TRINO_HOME=/etc/trino \
TRINO_HISTORY_FILE=/data/trino/.trino_history

Expand All @@ -85,7 +91,7 @@ COPY --from=downloader /tmp/trino-cli-${TRINO_VERSION}-executable.jar /usr/bin/t
COPY --from=downloader --chown=trino:trino /tmp/trino-server-${TRINO_VERSION} /usr/lib/trino
COPY --chown=trino:trino default/etc $TRINO_HOME

EXPOSE 10000
EXPOSE 8080
USER trino:trino
ENV LANG en_US.UTF-8
CMD ["/usr/lib/trino/run-trino"]
42 changes: 32 additions & 10 deletions build_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -exv
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

IMAGE_REPO="quay.io"
ORG="cloudservices"
ORG="urbanos"
APP="ubi-trino"
IMAGE="${IMAGE_REPO}/${ORG}/${APP}"
IMAGE_TAG=$(${SCRIPT_DIR}/get_image_tag.sh)
Expand All @@ -20,8 +20,19 @@ fi
# exit 1
# fi

changed=$(git diff --name-only ^HEAD~1|| egrep -v deploy/clowdapp.yaml) # do not build if only the `deploy/clowdapp.yaml` file has changed
if [ -n "$changed" ]; then
# Create tmp dir to store data in during job run (do NOT store in $WORKSPACE)
export TMP_JOB_DIR=$(mktemp -d -p "$HOME" -t "jenkins-${JOB_NAME}-${BUILD_NUMBER}-XXXXXX")
echo "job tmp dir location: $TMP_JOB_DIR"

function job_cleanup() {
echo "cleaning up job tmp dir: $TMP_JOB_DIR"
rm -fr $TMP_JOB_DIR
}

trap job_cleanup EXIT ERR SIGINT SIGTERM

#changed=$(git diff --name-only ^HEAD~1|| egrep -v deploy/clowdapp.yaml) # do not build if only the `deploy/clowdapp.yaml` file has changed
#if [ -n "$changed" ]; then
# docker is used on the RHEL7 nodes
# DOCKER_CONF="$PWD/.docker"
# mkdir -p "$DOCKER_CONF"
Expand All @@ -32,10 +43,21 @@ if [ -n "$changed" ]; then
# docker --config="$DOCKER_CONF" logout

# podman is used on the RHEL8 nodes
podman login -u="$QUAY_USER" -p="$QUAY_TOKEN" quay.io
# podman login -u="$RH_REGISTRY_USER" -p="$RH_REGISTRY_TOKEN" registry.redhat.io
podman build -t "${IMAGE}:${IMAGE_TAG}" ${SCRIPT_DIR}
podman push "${IMAGE}:${IMAGE_TAG}"
podman tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:latest"
podman push "${IMAGE}:latest"
fi
# podman login -u="$QUAY_USER" -p="$QUAY_TOKEN" quay.io
# # podman login -u="$RH_REGISTRY_USER" -p="$RH_REGISTRY_TOKEN" registry.redhat.io
# podman build -t "${IMAGE}:${IMAGE_TAG}" ${SCRIPT_DIR}
# podman push "${IMAGE}:${IMAGE_TAG}"
# podman tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:latest"
# podman push "${IMAGE}:latest"

DOCKER_CONF="$TMP_JOB_DIR/.docker"
mkdir -p "$DOCKER_CONF"
docker --config="$DOCKER_CONF" login -u="$QUAY_USER" -p="$QUAY_TOKEN" quay.io
docker --config="$DOCKER_CONF" build -t "${IMAGE}:${IMAGE_TAG}" ${SCRIPT_DIR} --progress=plain --no-cache
docker --config="$DOCKER_CONF" push "${IMAGE}:${IMAGE_TAG}"

docker --config="$DOCKER_CONF" tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:latest"
docker --config="$DOCKER_CONF" push "${IMAGE}:latest"

docker --config="$DOCKER_CONF" logout
#fi
2 changes: 1 addition & 1 deletion default/etc/catalog/hive.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ hive.compression-codec=SNAPPY
hive.config.resources=/etc/trino/hadoop-config/core-site.xml
hive.hdfs.authentication.type=NONE
hive.metastore.authentication.type=NONE
hive.metastore.uri=thrift://hive-metastore:10000
hive.metastore.uri=thrift://hive-metastore:8000
hive.parquet.use-column-names=true
hive.s3.path-style-access=true
hive.s3.sse.enabled=true
Expand Down
4 changes: 2 additions & 2 deletions default/etc/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ coordinator=true
spill-enabled=false
spiller-spill-path=/data/trino/spill
node-scheduler.include-coordinator=true
http-server.http.port=10000
http-server.http.port=8080
query.max-memory=5GB
query.max-memory-per-node=1GB

discovery.uri=http://localhost:10000
discovery.uri=http://localhost:8080

# Configurable memory settings:

Expand Down
2 changes: 1 addition & 1 deletion default/etc/jvm.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
-XX:ReservedCodeCacheSize=512M
-XX:PerMethodRecompilationCutoff=10000
-XX:PerBytecodeRecompilationCutoff=10000
-XshowSettings:VM
-XshowSettings:vm
-Dfile.encoding=UTF-8
-Djdk.attach.allowAttachSelf=true
-Djdk.nio.maxCachedBufferSize=2000000
Expand Down

0 comments on commit 46a43d7

Please sign in to comment.