From c42909aa326bbca827858bcddc95a32a89b0324c Mon Sep 17 00:00:00 2001 From: Aakash Nand <14219201+aakashnand@users.noreply.github.com> Date: Mon, 29 Jan 2024 17:26:51 +0900 Subject: [PATCH] Upgrade trino to 436 and docker image to v4 --- .github/workflows/build-push-docker-image.yml | 2 +- .gitignore | 2 ++ docker-compose.yml | 15 ++++++++------- ranger-admin/Dockerfile | 9 +++++---- ranger-admin/docker-entrypoint.sh | 19 ++++++++++++++++--- trino/docker-entrypoint.sh | 16 +++++++++++++--- 6 files changed, 45 insertions(+), 18 deletions(-) create mode 100644 .gitignore diff --git a/.github/workflows/build-push-docker-image.yml b/.github/workflows/build-push-docker-image.yml index 3daba70..e4d5b9f 100644 --- a/.github/workflows/build-push-docker-image.yml +++ b/.github/workflows/build-push-docker-image.yml @@ -29,4 +29,4 @@ jobs: with: context: ./ranger-admin/ push: true - tags: aakashnand/trino-ranger-demo:v3.0 + tags: aakashnand/trino-ranger-demo:v4.0 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7bd80db --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.env +env diff --git a/docker-compose.yml b/docker-compose.yml index 8638a5e..e63bb20 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,7 @@ services: environment: discovery.type: single-node xpack.security.enabled: "false" + ES_JAVA_OPTS: -Xms500m -Xmx500m ports: - 9200:9200 networks: @@ -26,10 +27,11 @@ services: volumes: - ranger-pg-data:/var/lib/postgresql/data ranger-admin: - image: aakashnand/trino-ranger-demo:v3.0 + image: aakashnand/trino-ranger-demo:v4.0 + #build: ranger-admin container_name: ranger-admin hostname: ranger-admin - entrypoint: /root/docker-entrypoint.sh + entrypoint: /root/ranger-admin/docker-entrypoint.sh deploy: resources: limits: @@ -43,13 +45,12 @@ services: networks: - trino-ranger-demo volumes: - - ./ranger-admin/install.properties:/root/install.properties - - ./ranger-admin/docker-entrypoint.sh:/root/docker-entrypoint.sh + - ./ranger-admin:/root/ranger-admin trino: - image: trinodb/trino:406 - hostname: my-localhost-trino + image: trinodb/trino:436 + hostname: localhost-trino user: root - container_name: my-localhost-trino + container_name: localhost-trino entrypoint: /root/docker-entrypoint.sh networks: - trino-ranger-demo diff --git a/ranger-admin/Dockerfile b/ranger-admin/Dockerfile index acd4590..1e85925 100644 --- a/ranger-admin/Dockerfile +++ b/ranger-admin/Dockerfile @@ -4,11 +4,12 @@ RUN apt-get update ENV TZ=Asia/Tokyo RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ENV DEBIAN_FRONTEND noninteractive -RUN apt-get -y install sudo wget bc python apt-transport-https gnupg +RUN apt-get -y install ca-certificates curl sudo wget bc apt-transport-https gnupg python-is-python3 python3-venv +RUN curl -s https://repos.azul.com/azul-repo.key | sudo gpg --dearmor -o /usr/share/keyrings/azul.gpg +RUN echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" | sudo tee /etc/apt/sources.list.d/zulu.list RUN wget -O /root/postgresql.jar https://jdbc.postgresql.org/download/postgresql-42.2.23.jar RUN sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9 -RUN curl -O https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-2_all.deb -RUN sudo apt-get -y install ./zulu-repo_1.0.0-2_all.deb && sudo apt-get -y update && sudo apt-get -y install zulu11-jdk +RUN sudo apt-get -y update && sudo apt-get -y install zulu11-jdk WORKDIR /root -ADD https://github.com/aakashnand/trino-ranger-demo/releases/download/trino-ranger-demo-v1.0/ranger-2.1.0-admin.tar.gz /root +ADD https://github.com/aakashnand/trino-ranger-demo/releases/download/trino-ranger-demo-v1.0/ranger-3.0.0-SNAPSHOT-admin.tar.gz /root ENV JAVA_HOME=/usr/lib/jvm/zulu11 diff --git a/ranger-admin/docker-entrypoint.sh b/ranger-admin/docker-entrypoint.sh index 0f7fe63..d16e1b6 100755 --- a/ranger-admin/docker-entrypoint.sh +++ b/ranger-admin/docker-entrypoint.sh @@ -1,11 +1,24 @@ #!/bin/bash -RANGER_VERSION=2.1.0 +RANGER_VERSION=3.0.0-SNAPSHOT + +TAR_FILE=ranger-${RANGER_VERSION}-admin.tar.gz +DOWNLOAD_URL=https://github.com/aakashnand/trino-ranger-demo/releases/download/trino-ranger-demo-v1.0/${TAR_FILE} + +# Check if the tar file exists +if [ -f "$TAR_FILE" ]; then + echo "Tar file $TAR_FILE already exists." +else + echo "Tar file $TAR_FILE does not exist. Downloading from $DOWNLOAD_URL..." + wget $DOWNLOAD_URL -O $TAR_FILE + echo "Download completed." +fi -#wget https://github.com/aakashnand/trino-ranger-demo/releases/download/trino-ranger-demo-v1.0/ranger-${RANGER_VERSION}-admin.tar.gz && \ tar xvf ranger-${RANGER_VERSION}-admin.tar.gz && \ cd /root/ranger-${RANGER_VERSION}-admin/ && \ -cp /root/install.properties /root/ranger-${RANGER_VERSION}-admin/ && \ +cp /root/ranger-admin/install.properties /root/ranger-${RANGER_VERSION}-admin/ && \ ./setup.sh && \ ranger-admin start && \ +python -m venv /root/ranger-admin/.env && source /root/ranger-admin/.env/bin/activate && pip install -r /root/ranger-admin/requirement.txt +python /root/ranger-admin/trino_service_setup.py && \ tail -f /root/ranger-${RANGER_VERSION}-admin/ews/logs/ranger-admin-*-.log diff --git a/trino/docker-entrypoint.sh b/trino/docker-entrypoint.sh index 7d42d65..0db3179 100755 --- a/trino/docker-entrypoint.sh +++ b/trino/docker-entrypoint.sh @@ -1,7 +1,17 @@ #!/bin/bash -RANGER_VERSION=ranger-3.0.0-SNAPSHOT-trino-plugin-405-406 -cd /root && \ -curl https://github.com/aakashnand/trino-ranger-demo/releases/download/trino-ranger-demo-v1.0/${RANGER_VERSION}.tar.gz --output ${RANGER_VERSION}.tar.gz -L && +microdnf install gzip -y +RANGER_VERSION=ranger-3.0.0-SNAPSHOT-trino-plugin-436 +TAR_FILE=/root/${RANGER_VERSION}.tar.gz +cd /root +# Check if the tar file exists +if [ -f "$TAR_FILE" ]; then + echo "Tar file $TAR_FILE already exists." +else + echo "Tar file $TAR_FILE does not exist. Downloading from $DOWNLOAD_URL..." + curl -k https://github.com/aakashnand/trino-ranger-demo/releases/download/trino-ranger-demo-v1.0/${RANGER_VERSION}.tar.gz --output ${RANGER_VERSION}.tar.gz -L + echo "Download completed." +fi + mkdir -p /root/${RANGER_VERSION} && \ tar xvf ${RANGER_VERSION}.tar.gz -C /root/${RANGER_VERSION} --strip-components 1 && \ yes | cp -rf /root/install.properties /root/${RANGER_VERSION}/ && \