Skip to content

Commit 33a742e

Browse files
authored
Merge pull request #36 from unicef/feature/download-jars-in-dockerfile
Docker build improvements: Download jars in Drill dockerfile and signature check in Drill and Zookeeper dockerfiles
2 parents c75737b + 748947b commit 33a742e

File tree

10 files changed

+206
-62
lines changed

10 files changed

+206
-62
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This extension has been created to fit the needs of [UNICEF's magasin](https://g
1313

1414
| Chart Version | Drill Version | Zookeeper Version | Release Date | Release notes |
1515
|---------------|---------------|-------------------|--------------------|------------------------|
16+
| 0.9.0 | 1.21.2 | 3.9.3 | 2024-12-02 | [Release notes v0.9.0](https://github.com/unicef/magasin-drill/releases/tag/releases%2Fv0.9.0) |
1617
| 0.8.0 | 1.21.2 | 3.9.2 | 2024-09-04 | [Release notes v0.8.0](https://github.com/unicef/magasin-drill/releases/tag/releases%2Fv0.8.0) |
1718
| 0.7.2 | 1.21.2 | 3.9.2 | 2024-08-07 | [Release notes v0.7.2](https://github.com/unicef/magasin-drill/releases/tag/releases%2Fv0.7.2) |
1819
| 0.7.1 | 1.21.1 | 3.9.1 | 2024-02-05 | [Release notes v0.7.1](https://github.com/unicef/magasin-drill/releases/tag/releases%2Fv0.7.1) |

charts/drill/Chart.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
apiVersion: v2
22
name: drill
3-
version: 0.8.0
4-
appVersion: 1.21.2-3.9.2
5-
description: Helm charts for deploying Apache Drill on a Kubernetes cluster
3+
version: 0.9.0
4+
appVersion: 1.21.2-3.9.3
5+
description: Helm charts for deploying Apache Drill and Zookeeper on a Kubernetes cluster
66
type: application
77
keywords:
88
- apache

charts/drill/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ drill:
1919
# Total CPU for each Drill pod
2020
cpu: 4000m
2121
# Drill image with tag
22-
image: merlos/drill:1.21.2
22+
image: merlos/drill:1.21.2-2024-12
2323
# Drill's HTTP port
2424
httpPort: 8047
2525
# User Server port. The Bit Server Port and Data Server ports are +1 and +2
@@ -140,7 +140,7 @@ zookeeper:
140140
# Total CPU for each ZooKeeper pod
141141
cpu: 500m
142142
# ZooKeeper image with tag
143-
image: merlos/zookeeper:3.9.2
143+
image: merlos/zookeeper:3.9.3
144144
# set annotations to ZooKeeper pods
145145
podAnnotations: {}
146146
# responsible: devops

docker/README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,40 @@ The `build.sh` script in the `docker/zookeeper` folder builds the zookeeper imag
99
It takes two arguments:
1010

1111
```shell
12-
./build.sh -r <registry> -v <zookeeper-version>
12+
./build.sh -r <registry> -v <zookeeper-version> [-t <tag>] [-p]
1313
```
14-
Where `registry` is the URL of the registry (for example, an Azure registry whatever.acr.io). It can also be a Docker Hub username.
14+
Where `registry` is the URL of the registry (for example, an Azure registry whatever.acr.io). For Docker Hub, just use your username.
1515

16-
The project version is the version of Zookeeper that you want to setup in the image. For instance "3.9.1", The list of versions is here: https://archive.apache.org/dist/zookeeper/
16+
The project version is the version of Zookeeper that you want to setup in the image. For instance "3.9.3", The list of versions is here: https://archive.apache.org/dist/zookeeper/
1717

1818
Example:
1919
```shell
2020
cd docker/zookeeper
21-
./build.sh -r merlos -v 3.9.1
21+
./build.sh -r merlos -v 3.9.3
2222
```
2323

24-
Alternatively it accepts `-p` to push the image to the registry `-t`` to create a different tag.
24+
By default it does not push the image to the registry. You can add `-p` to push the image to the registry.
25+
26+
By default it creates the same tag as the version. You can use `-t` to create a different tag. For instance:
2527

2628
```shell
27-
./build.sh -r merlos -v 3.9.1 -t 3.9.1-deb -p
29+
./build.sh -r merlos -v 3.9.3 -t 3.9.3-deb -p
2830
```
2931

3032
In this image:
3133
* zookeeper is run by the user `zk`
32-
* zookeper is installed in `/opt/zookeeper`
34+
* zookeeper is installed in `/opt/zookeeper`
3335
* Data is kept in `/var/lib/zookeeper`
3436
* Output logs are kept in `/var/log/zookeeper/`
3537

36-
37-
You have som images available in https://hub.docker.com/r/merlos/zookeeper
38+
You have some images available in https://hub.docker.com/r/merlos/zookeeper
3839

3940
### Build Drill
4041

4142
Similarly, the folder `docker/drill` contains the `build.sh` script that builds, tags and uploads a docker image. It also takes two arguments:
4243

4344
```shell
44-
./build.sh <registry> <drill-version>
45+
./build.sh -r <registry> -v <drill-version> [-t <tag>] [-p]
4546
```
4647

4748
The list of drill versions are in this link https://archive.apache.org/dist/drill/.
@@ -50,15 +51,15 @@ Example:
5051

5152
```shell
5253
cd docker/drill
53-
./build.sh -r merlos -v 1.21.1
54+
./build.sh -r merlos -v 1.21.2
5455
```
5556

56-
Where merlos is a user in dockerhub and 1.21.1 is the version of Drill. For versions older than 1.19.0 you may need to tweak the
57+
Where merlos is a user in dockerhub and 1.21.2 is the version of Drill.
5758

5859
Similarly to the zookeper script, it also accepts `-t` and `-p`.
5960

6061
```shell
61-
./build.sh -r merlos -v 1.21.1 -t 1.21.1-deb -p
62+
./build.sh -r merlos -v 1.21.2 -t 1.21.2-deb -p
6263
```
6364

6465
In this image:
@@ -67,5 +68,4 @@ In this image:
6768
* Output logs are kept in `/var/log/drill/`
6869
* Copies the two jars included in the `jar/` folder (azure-storage and handoop-azure)
6970

70-
71-
You have some images available on https://hub.docker.com/r/merlos/drill/tags
71+
You have some images available already on https://hub.docker.com/r/merlos/drill/tags

docker/drill/Dockerfile

Lines changed: 97 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,72 @@
1+
# Stage 1: DRILL download and verification
2+
FROM debian:stable-slim AS verifier
3+
4+
ARG VERSION
5+
ARG MIRROR=https://archive.apache.org
6+
7+
ENV PROJECT=drill
8+
9+
# Install necessary tools
10+
RUN apt-get update && \
11+
apt-get install -y wget gpg gpgv && \
12+
rm -rf /var/lib/apt/lists/*
13+
14+
# Download Drill, sha512 checksum, GPG signature and PGP keys
15+
RUN wget ${MIRROR}/dist/${PROJECT}/$VERSION/apache-${PROJECT}-${VERSION}.tar.gz -P /tmp/
16+
RUN wget ${MIRROR}/dist/${PROJECT}/$VERSION/apache-${PROJECT}-${VERSION}.tar.gz.sha512 -P /tmp/
17+
RUN wget ${MIRROR}/dist/${PROJECT}/$VERSION/apache-${PROJECT}-${VERSION}.tar.gz.asc -P /tmp/
18+
RUN wget ${MIRROR}/dist/${PROJECT}/KEYS -P /tmp/
19+
20+
# Create the drill pgp keyring
21+
RUN gpg --no-default-keyring --keyring /tmp/${PROJECT}-keyring.gpg --import /tmp/KEYS
22+
23+
# Verify SHA512 checksum
24+
RUN cd /tmp && echo "$(cat apache-${PROJECT}-${VERSION}.tar.gz.sha512) apache-${PROJECT}-${VERSION}.tar.gz" | sha512sum -c -
25+
26+
# Verify GPG signature
27+
RUN gpgv --keyring /tmp/${PROJECT}-keyring.gpg /tmp/apache-${PROJECT}-${VERSION}.tar.gz.asc /tmp/apache-${PROJECT}-${VERSION}.tar.gz
28+
29+
# Extract Drill
30+
RUN mkdir -p /tmp/apache-${PROJECT}
31+
RUN tar -xzvf /tmp/apache-${PROJECT}-$VERSION.tar.gz -C/tmp/apache-${PROJECT}/ --strip=1
32+
33+
# remove the tar file
34+
RUN rm -f /tmp/apache-${PROJECT}-$VERSION.tar.gz
35+
36+
# Test Drill
37+
RUN ls -la /tmp/apache-drill
38+
39+
40+
41+
#
42+
# Stage 2: Setup & dependency download
43+
#
144
FROM debian:stable-slim
245

346
ARG VERSION
447
RUN echo $VERSION
5-
ARG MIRROR=https://archive.apache.org
6-
RUN echo $MIRROR
48+
49+
LABEL maintainer="merlos"
50+
LABEL description="Apache Drill Docker Image (by https://magasin.unicef.io)"
51+
52+
# Set environment variables
53+
ENV DRILL_VERSION=$VERSION
54+
ENV AZURE_STORAGE_VERSION=8.6.6
55+
ENV HADOOP_AZURE_VERSION=3.4.1
756

857
# Install Pre-Requisite Packages
9-
RUN apt-get update
10-
RUN apt-get upgrade -y
11-
RUN apt-get install -y openjdk-17-jre jed procps stress
58+
RUN apt-get update && \
59+
apt-get upgrade -y && \
60+
apt-get install -y \
61+
openjdk-17-jre \
62+
jed \
63+
procps \
64+
stress \
65+
wget \
66+
figlet && \
67+
rm -rf /var/lib/apt/lists/*
1268

1369
# Display project name in bash
14-
RUN apt-get install -y figlet
1570
RUN echo "figlet Drill && echo \"\nDockerized for magasin (https://github.com/unicef/magasin) \n\n\"" > /etc/bash.bashrc
1671

1772
# Clean apt cache
@@ -25,34 +80,54 @@ RUN mkdir /opt/drill && chown drill /opt/drill
2580
RUN mkdir /var/lib/drill && chown drill /var/lib/drill && chgrp drill /var/lib/drill && chmod 700 /var/lib/drill
2681
RUN mkdir /var/log/drill && chown drill /var/log/drill && chgrp drill /var/log/drill && chmod 700 /var/log/drill
2782

28-
# Install Drill
29-
ADD ${MIRROR}/dist/drill/$VERSION/apache-drill-${VERSION}.tar.gz /tmp/apache-drill-$VERSION.tar.gz
30-
RUN tar -xzf /tmp/apache-drill-$VERSION.tar.gz -C/opt/drill --strip=1
31-
RUN rm -f /tmp/apache-drill-$VERSION.tar.gz
83+
# Copy the verified Drill files from the verifier stage
84+
COPY --from=verifier /tmp/apache-drill /opt/drill
3285

33-
# Change conf folder owner as some files are required to be created tmporarily.
86+
# Change conf folder owner as some files are required to be created temporarily.
3487
RUN chgrp -v -R drill /opt/drill
3588
RUN chown -R drill /opt/drill/conf
3689

37-
# Expose ports: Drill web UI, user port, control port and Data port
38-
# https://drill.apache.org/docs/ports-and-bind-addresses-used-by-drill/
39-
EXPOSE 8047 31010 31011 31012
90+
# Set user to test the service
91+
USER drill
4092

41-
# Test Drill
42-
#RUN echo "select * from sys.version;" > /tmp/version.sql
43-
#RUN /opt/drill/bin/sqlline -u jdbc:drill:zk=local --verbose --run=/tmp/version.sql
93+
# Test Drill before changing the default conf
94+
RUN echo "select * from sys.version;" > /tmp/version.sql
95+
RUN /opt/drill/bin/sqlline -u jdbc:drill:zk=local --verbose --run=/tmp/version.sql
96+
RUN rm -f /tmp/version.sql
97+
98+
# Set root
99+
USER root
44100

45101
# Copy Scripts
46102
COPY distrib-env.sh drill-distrib.conf /opt/drill/conf/
47103
COPY isLive.sh isReady.sh preStop.sh /opt/drill/bin/
48104
COPY start.sh /opt/drill/start.sh
49105

50-
# Copy local jars
51-
COPY jars/* /opt/drill/jars/3rdparty/
106+
# Download 3rd party dependencies
107+
# Available versions in https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-azure/
108+
RUN wget https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-azure/${HADOOP_AZURE_VERSION}/hadoop-azure-${HADOOP_AZURE_VERSION}.jar -P /opt/drill/jars/3rdparty
109+
# Ensure the integrity of the downloaded file (sha1)
110+
RUN wget https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-azure/${HADOOP_AZURE_VERSION}/hadoop-azure-${HADOOP_AZURE_VERSION}.jar.sha1 -P /opt/drill/jars/3rdparty
111+
RUN cd /opt/drill/jars/3rdparty && echo $(cat hadoop-azure-${HADOOP_AZURE_VERSION}.jar.sha1) hadoop-azure-${HADOOP_AZURE_VERSION}.jar | sha1sum -c -
112+
113+
114+
# Available versions in https://repo1.maven.org/maven2/com/microsoft/azure/azure-storage/
115+
RUN wget https://repo1.maven.org/maven2/com/microsoft/azure/azure-storage/${AZURE_STORAGE_VERSION}/azure-storage-${AZURE_STORAGE_VERSION}.jar -P /opt/drill/jars/3rdparty
116+
# Ensure the integrity of the downloaded file (sha1)
117+
RUN wget https://repo1.maven.org/maven2/com/microsoft/azure/azure-storage/${AZURE_STORAGE_VERSION}/azure-storage-${AZURE_STORAGE_VERSION}.jar.sha1 -P /opt/drill/jars/3rdparty
118+
RUN cd /opt/drill/jars/3rdparty && echo $(cat azure-storage-${AZURE_STORAGE_VERSION}.jar.sha1) azure-storage-${AZURE_STORAGE_VERSION}.jar | sha1sum -c -
52119

53-
# Set user to run the service
120+
121+
# Expose ports: Drill web UI, user port, control port and Data port
122+
# https://drill.apache.org/docs/ports-and-bind-addresses-used-by-drill/
123+
EXPOSE 8047 31010 31011 31012
124+
125+
126+
RUN chown -R drill /tmp/drill
127+
RUN chgrp -R drill /tmp/drill
128+
129+
# Set the user to run the container
54130
USER drill
55131

56132
# Start Drill
57-
ENTRYPOINT /opt/drill/start.sh
58-
133+
ENTRYPOINT ["/opt/drill/start.sh"]
-803 KB
Binary file not shown.
-154 KB
Binary file not shown.

docker/drill/start.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
#!/usr/bin/env bash
22

3+
4+
figlet -f slant "Drill"
5+
6+
echo "Docker Image build information"
7+
echo "---------------------------------"
8+
echo DRILL_VERSION= $DRILL_VERSION
9+
echo AZURE_STORAGE_VERSION= $AZURE_STORAGE_VERSION
10+
echo HADOOP_AZURE_VERSION= $HADOOP_AZURE_VERSION
11+
echo "---------------------------------"
12+
313
# Be verbose
4-
set -x
14+
#set -x
515
DRILL_HOME="/opt/drill"
616
DRILL_ENV_FILE="${DRILL_HOME}/conf/distrib-env.sh"
717
DRILL_CONF_FILE="${DRILL_HOME}/conf/drill-distrib.conf"
818
DRILL_CONF_OVERRIDE_FILE="${DRILL_HOME}/conf/drill-override.conf"
919

20+
echo "Setting up memory..."
1021
# Configuring Drill memory
1122
DRILL_MAX_MEMORY_VALUE=`echo ${DRILL_MAX_MEMORY} | tr -dc '0-9'`
1223
sed -i "s/__DRILL_MAX_MEMORY_VALUE__/${DRILL_MAX_MEMORY_VALUE}/g" ${DRILL_ENV_FILE}
@@ -43,7 +54,7 @@ fi
4354
${DRILL_HOME}/bin/drillbit.sh status
4455

4556
# Stop being verbose
46-
set +x
57+
#set +x
4758

4859
# Keep container alive
4960
while true; do sleep 5; done

0 commit comments

Comments
 (0)