Skip to content

Commit

Permalink
Merge pull request #346 from StatCan/trino-cli
Browse files Browse the repository at this point in the history
add: trino wrapper script
  • Loading branch information
rohank07 authored May 4, 2022
2 parents eae5323 + 434c18d commit d028807
Show file tree
Hide file tree
Showing 17 changed files with 144 additions and 49 deletions.
11 changes: 5 additions & 6 deletions docker-bits/4_CLI.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ COPY shell_helpers.sh /tmp/shell_helpers.sh

# Install OpenJDK-8
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
apt-get install -y openjdk-8-jre && \
apt-get clean && \
fix-permissions $CONDA_DIR && \
fix-permissions /home/$NB_USER
Expand All @@ -60,8 +59,8 @@ RUN curl -LO "${KUBECTL_URL}" \
&& echo "${OH_MY_ZSH_SHA} /tmp/oh-my-zsh-install.sh" | sha256sum -c \
&& echo "oh-my-zsh: ok" \
&& \
wget -q "${TRINO_URL}" -O /tmp/trino \
&& echo ${TRINO_SHA} /tmp/trino | sha256sum -c \
wget -q "${TRINO_URL}" -O /tmp/trino-original \
&& echo ${TRINO_SHA} /tmp/trino-original | sha256sum -c \
&& echo "trinocli: ok" \
&& chmod +x /tmp/trino \
&& sudo mv /tmp/trino /usr/local/bin/trino
&& chmod +x /tmp/trino-original \
&& sudo mv /tmp/trino-original /usr/local/bin/trino-original
4 changes: 3 additions & 1 deletion docker-bits/∞_CMD.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ USER root
WORKDIR /home/$NB_USER
EXPOSE 8888
COPY start-custom.sh /usr/local/bin/
COPY mc-tenant-wrapper.sh /usr/local/bin/mc
COPY mc-tenant-wrapper.sh /usr/local/bin/mc
COPY trino-wrapper.sh /usr/local/bin/trino
RUN chmod +x /usr/local/bin/trino

# Add --user to all pip install calls and point pip to Artifactory repository
COPY pip.conf /tmp/pip.conf
Expand Down
4 changes: 3 additions & 1 deletion output/docker-stacks-datascience-notebook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ USER root
WORKDIR /home/$NB_USER
EXPOSE 8888
COPY start-custom.sh /usr/local/bin/
COPY mc-tenant-wrapper.sh /usr/local/bin/mc
COPY mc-tenant-wrapper.sh /usr/local/bin/mc
COPY trino-wrapper.sh /usr/local/bin/trino
RUN chmod +x /usr/local/bin/trino

# Add --user to all pip install calls and point pip to Artifactory repository
COPY pip.conf /tmp/pip.conf
Expand Down
11 changes: 11 additions & 0 deletions output/docker-stacks-datascience-notebook/trino-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Get token from default service account
GET_TOKEN="$(kubectl describe secret default-token | grep 'token:' | sed 's/^.*://')"

#todo: Change server when deployed on dev. Placeholder for now
SERVER=https://trino.example.com

# Trino client pass in server, access token and additional options the user can configures
# todo: remove user option
trino-original --server $SERVER --insecure --access-token $GET_TOKEN --user default "$@"
15 changes: 8 additions & 7 deletions output/jupyterlab-cpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ COPY shell_helpers.sh /tmp/shell_helpers.sh

# Install OpenJDK-8
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
apt-get install -y openjdk-8-jre && \
apt-get clean && \
fix-permissions $CONDA_DIR && \
fix-permissions /home/$NB_USER
Expand All @@ -129,11 +128,11 @@ RUN curl -LO "${KUBECTL_URL}" \
&& echo "${OH_MY_ZSH_SHA} /tmp/oh-my-zsh-install.sh" | sha256sum -c \
&& echo "oh-my-zsh: ok" \
&& \
wget -q "${TRINO_URL}" -O /tmp/trino \
&& echo ${TRINO_SHA} /tmp/trino | sha256sum -c \
wget -q "${TRINO_URL}" -O /tmp/trino-original \
&& echo ${TRINO_SHA} /tmp/trino-original | sha256sum -c \
&& echo "trinocli: ok" \
&& chmod +x /tmp/trino \
&& sudo mv /tmp/trino /usr/local/bin/trino
&& chmod +x /tmp/trino-original \
&& sudo mv /tmp/trino-original /usr/local/bin/trino-original

###############################
### docker-bits/5_DB-Drivers.Dockerfile
Expand Down Expand Up @@ -296,7 +295,9 @@ USER root
WORKDIR /home/$NB_USER
EXPOSE 8888
COPY start-custom.sh /usr/local/bin/
COPY mc-tenant-wrapper.sh /usr/local/bin/mc
COPY mc-tenant-wrapper.sh /usr/local/bin/mc
COPY trino-wrapper.sh /usr/local/bin/trino
RUN chmod +x /usr/local/bin/trino

# Add --user to all pip install calls and point pip to Artifactory repository
COPY pip.conf /tmp/pip.conf
Expand Down
11 changes: 11 additions & 0 deletions output/jupyterlab-cpu/trino-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Get token from default service account
GET_TOKEN="$(kubectl describe secret default-token | grep 'token:' | sed 's/^.*://')"

#todo: Change server when deployed on dev. Placeholder for now
SERVER=https://trino.example.com

# Trino client pass in server, access token and additional options the user can configures
# todo: remove user option
trino-original --server $SERVER --insecure --access-token $GET_TOKEN --user default "$@"
15 changes: 8 additions & 7 deletions output/jupyterlab-pytorch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ COPY shell_helpers.sh /tmp/shell_helpers.sh

# Install OpenJDK-8
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
apt-get install -y openjdk-8-jre && \
apt-get clean && \
fix-permissions $CONDA_DIR && \
fix-permissions /home/$NB_USER
Expand All @@ -226,11 +225,11 @@ RUN curl -LO "${KUBECTL_URL}" \
&& echo "${OH_MY_ZSH_SHA} /tmp/oh-my-zsh-install.sh" | sha256sum -c \
&& echo "oh-my-zsh: ok" \
&& \
wget -q "${TRINO_URL}" -O /tmp/trino \
&& echo ${TRINO_SHA} /tmp/trino | sha256sum -c \
wget -q "${TRINO_URL}" -O /tmp/trino-original \
&& echo ${TRINO_SHA} /tmp/trino-original | sha256sum -c \
&& echo "trinocli: ok" \
&& chmod +x /tmp/trino \
&& sudo mv /tmp/trino /usr/local/bin/trino
&& chmod +x /tmp/trino-original \
&& sudo mv /tmp/trino-original /usr/local/bin/trino-original

###############################
### docker-bits/5_DB-Drivers.Dockerfile
Expand Down Expand Up @@ -393,7 +392,9 @@ USER root
WORKDIR /home/$NB_USER
EXPOSE 8888
COPY start-custom.sh /usr/local/bin/
COPY mc-tenant-wrapper.sh /usr/local/bin/mc
COPY mc-tenant-wrapper.sh /usr/local/bin/mc
COPY trino-wrapper.sh /usr/local/bin/trino
RUN chmod +x /usr/local/bin/trino

# Add --user to all pip install calls and point pip to Artifactory repository
COPY pip.conf /tmp/pip.conf
Expand Down
11 changes: 11 additions & 0 deletions output/jupyterlab-pytorch/trino-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Get token from default service account
GET_TOKEN="$(kubectl describe secret default-token | grep 'token:' | sed 's/^.*://')"

#todo: Change server when deployed on dev. Placeholder for now
SERVER=https://trino.example.com

# Trino client pass in server, access token and additional options the user can configures
# todo: remove user option
trino-original --server $SERVER --insecure --access-token $GET_TOKEN --user default "$@"
15 changes: 8 additions & 7 deletions output/jupyterlab-tensorflow/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ COPY shell_helpers.sh /tmp/shell_helpers.sh

# Install OpenJDK-8
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
apt-get install -y openjdk-8-jre && \
apt-get clean && \
fix-permissions $CONDA_DIR && \
fix-permissions /home/$NB_USER
Expand All @@ -221,11 +220,11 @@ RUN curl -LO "${KUBECTL_URL}" \
&& echo "${OH_MY_ZSH_SHA} /tmp/oh-my-zsh-install.sh" | sha256sum -c \
&& echo "oh-my-zsh: ok" \
&& \
wget -q "${TRINO_URL}" -O /tmp/trino \
&& echo ${TRINO_SHA} /tmp/trino | sha256sum -c \
wget -q "${TRINO_URL}" -O /tmp/trino-original \
&& echo ${TRINO_SHA} /tmp/trino-original | sha256sum -c \
&& echo "trinocli: ok" \
&& chmod +x /tmp/trino \
&& sudo mv /tmp/trino /usr/local/bin/trino
&& chmod +x /tmp/trino-original \
&& sudo mv /tmp/trino-original /usr/local/bin/trino-original

###############################
### docker-bits/5_DB-Drivers.Dockerfile
Expand Down Expand Up @@ -388,7 +387,9 @@ USER root
WORKDIR /home/$NB_USER
EXPOSE 8888
COPY start-custom.sh /usr/local/bin/
COPY mc-tenant-wrapper.sh /usr/local/bin/mc
COPY mc-tenant-wrapper.sh /usr/local/bin/mc
COPY trino-wrapper.sh /usr/local/bin/trino
RUN chmod +x /usr/local/bin/trino

# Add --user to all pip install calls and point pip to Artifactory repository
COPY pip.conf /tmp/pip.conf
Expand Down
11 changes: 11 additions & 0 deletions output/jupyterlab-tensorflow/trino-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Get token from default service account
GET_TOKEN="$(kubectl describe secret default-token | grep 'token:' | sed 's/^.*://')"

#todo: Change server when deployed on dev. Placeholder for now
SERVER=https://trino.example.com

# Trino client pass in server, access token and additional options the user can configures
# todo: remove user option
trino-original --server $SERVER --insecure --access-token $GET_TOKEN --user default "$@"
11 changes: 5 additions & 6 deletions output/remote-desktop/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ COPY shell_helpers.sh /tmp/shell_helpers.sh

# Install OpenJDK-8
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
apt-get install -y openjdk-8-jre && \
apt-get clean && \
fix-permissions $CONDA_DIR && \
fix-permissions /home/$NB_USER
Expand All @@ -131,11 +130,11 @@ RUN curl -LO "${KUBECTL_URL}" \
&& echo "${OH_MY_ZSH_SHA} /tmp/oh-my-zsh-install.sh" | sha256sum -c \
&& echo "oh-my-zsh: ok" \
&& \
wget -q "${TRINO_URL}" -O /tmp/trino \
&& echo ${TRINO_SHA} /tmp/trino | sha256sum -c \
wget -q "${TRINO_URL}" -O /tmp/trino-original \
&& echo ${TRINO_SHA} /tmp/trino-original | sha256sum -c \
&& echo "trinocli: ok" \
&& chmod +x /tmp/trino \
&& sudo mv /tmp/trino /usr/local/bin/trino
&& chmod +x /tmp/trino-original \
&& sudo mv /tmp/trino-original /usr/local/bin/trino-original

###############################
### docker-bits/6_remote-desktop.Dockerfile
Expand Down
11 changes: 11 additions & 0 deletions output/remote-desktop/trino-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Get token from default service account
GET_TOKEN="$(kubectl describe secret default-token | grep 'token:' | sed 's/^.*://')"

#todo: Change server when deployed on dev. Placeholder for now
SERVER=https://trino.example.com

# Trino client pass in server, access token and additional options the user can configures
# todo: remove user option
trino-original --server $SERVER --insecure --access-token $GET_TOKEN --user default "$@"
15 changes: 8 additions & 7 deletions output/rstudio/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ COPY shell_helpers.sh /tmp/shell_helpers.sh

# Install OpenJDK-8
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
apt-get install -y openjdk-8-jre && \
apt-get clean && \
fix-permissions $CONDA_DIR && \
fix-permissions /home/$NB_USER
Expand All @@ -129,11 +128,11 @@ RUN curl -LO "${KUBECTL_URL}" \
&& echo "${OH_MY_ZSH_SHA} /tmp/oh-my-zsh-install.sh" | sha256sum -c \
&& echo "oh-my-zsh: ok" \
&& \
wget -q "${TRINO_URL}" -O /tmp/trino \
&& echo ${TRINO_SHA} /tmp/trino | sha256sum -c \
wget -q "${TRINO_URL}" -O /tmp/trino-original \
&& echo ${TRINO_SHA} /tmp/trino-original | sha256sum -c \
&& echo "trinocli: ok" \
&& chmod +x /tmp/trino \
&& sudo mv /tmp/trino /usr/local/bin/trino
&& chmod +x /tmp/trino-original \
&& sudo mv /tmp/trino-original /usr/local/bin/trino-original

###############################
### docker-bits/5_DB-Drivers.Dockerfile
Expand Down Expand Up @@ -217,7 +216,9 @@ USER root
WORKDIR /home/$NB_USER
EXPOSE 8888
COPY start-custom.sh /usr/local/bin/
COPY mc-tenant-wrapper.sh /usr/local/bin/mc
COPY mc-tenant-wrapper.sh /usr/local/bin/mc
COPY trino-wrapper.sh /usr/local/bin/trino
RUN chmod +x /usr/local/bin/trino

# Add --user to all pip install calls and point pip to Artifactory repository
COPY pip.conf /tmp/pip.conf
Expand Down
11 changes: 11 additions & 0 deletions output/rstudio/trino-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Get token from default service account
GET_TOKEN="$(kubectl describe secret default-token | grep 'token:' | sed 's/^.*://')"

#todo: Change server when deployed on dev. Placeholder for now
SERVER=https://trino.example.com

# Trino client pass in server, access token and additional options the user can configures
# todo: remove user option
trino-original --server $SERVER --insecure --access-token $GET_TOKEN --user default "$@"
15 changes: 8 additions & 7 deletions output/sas/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ COPY shell_helpers.sh /tmp/shell_helpers.sh

# Install OpenJDK-8
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
apt-get install -y openjdk-8-jre && \
apt-get clean && \
fix-permissions $CONDA_DIR && \
fix-permissions /home/$NB_USER
Expand All @@ -129,11 +128,11 @@ RUN curl -LO "${KUBECTL_URL}" \
&& echo "${OH_MY_ZSH_SHA} /tmp/oh-my-zsh-install.sh" | sha256sum -c \
&& echo "oh-my-zsh: ok" \
&& \
wget -q "${TRINO_URL}" -O /tmp/trino \
&& echo ${TRINO_SHA} /tmp/trino | sha256sum -c \
wget -q "${TRINO_URL}" -O /tmp/trino-original \
&& echo ${TRINO_SHA} /tmp/trino-original | sha256sum -c \
&& echo "trinocli: ok" \
&& chmod +x /tmp/trino \
&& sudo mv /tmp/trino /usr/local/bin/trino
&& chmod +x /tmp/trino-original \
&& sudo mv /tmp/trino-original /usr/local/bin/trino-original

###############################
### docker-bits/5_DB-Drivers.Dockerfile
Expand Down Expand Up @@ -354,7 +353,9 @@ USER root
WORKDIR /home/$NB_USER
EXPOSE 8888
COPY start-custom.sh /usr/local/bin/
COPY mc-tenant-wrapper.sh /usr/local/bin/mc
COPY mc-tenant-wrapper.sh /usr/local/bin/mc
COPY trino-wrapper.sh /usr/local/bin/trino
RUN chmod +x /usr/local/bin/trino

# Add --user to all pip install calls and point pip to Artifactory repository
COPY pip.conf /tmp/pip.conf
Expand Down
11 changes: 11 additions & 0 deletions output/sas/trino-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Get token from default service account
GET_TOKEN="$(kubectl describe secret default-token | grep 'token:' | sed 's/^.*://')"

#todo: Change server when deployed on dev. Placeholder for now
SERVER=https://trino.example.com

# Trino client pass in server, access token and additional options the user can configures
# todo: remove user option
trino-original --server $SERVER --insecure --access-token $GET_TOKEN --user default "$@"
11 changes: 11 additions & 0 deletions resources/common/trino-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Get token from default service account
GET_TOKEN="$(kubectl describe secret default-token | grep 'token:' | sed 's/^.*://')"

#todo: Change server when deployed on dev. Placeholder for now
SERVER=https://trino.example.com

# Trino client pass in server, access token and additional options the user can configures
# todo: remove user option
trino-original --server $SERVER --insecure --access-token $GET_TOKEN --user default "$@"

0 comments on commit d028807

Please sign in to comment.