World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#2221] feat(docker): Gravitino Doris Docker image (#2264)
Kang8ba098ae5f6c
diff --git a/dev/docker/build-docker.sh b/dev/docker/build-docker.shindex 01dd9fe931..be00d27f73 100755--- a/dev/docker/build-docker.sh+++ b/dev/docker/build-docker.sh@@ -8,7 +8,16 @@ script_dir="$(dirname "${BASH_SOURCE-$0}")"script_dir="$(cd "${script_dir}">/dev/null; pwd)"# Build docker image for multi-arch# shellcheck disable=SC2089-USAGE="Usage: ./build-docker.sh --platform [all|linux/amd64|linux/arm64] --type [gravitino|hive|trino] --image {image_name} --tag {tag_name} --latest\nNotice: You shouldn't use 'all' for the platform if you don't use the Github action to publish the Docker image."++usage() {+ cat << EOF+Usage:++./build-docker.sh --platform [all|linux/amd64|linux/arm64] --type [gravitino|hive|trino|doris] --image {image_name} --tag {tag_name} --latest++Notice: You shouldn't use 'all' for the platform if you don't use the Github action to publish the Docker image.+EOF+}# Get platform typeif [[ "$1" == "--platform" ]]; then@@ -18,7 +27,7 @@ if [[ "$1" == "--platform" ]]; thenecho "INFO : platform type is ${platform_type}"elseecho "ERROR : ${platform_type} is not a valid platform type"- echo ${USAGE}+ usageexit 1fishift@@ -33,7 +42,7 @@ if [[ "$1" == "--type" ]]; thenshiftelseecho "ERROR : must specify component type"- echo ${USAGE}+ usageexit 1fi@@ -44,7 +53,7 @@ if [[ "$1" == "--image" ]]; thenshiftelseecho "ERROR : must specify image name"- echo ${USAGE}+ usageexit 1fi@@ -69,9 +78,12 @@ elif [ "${component_type}" == "trino" ]; then. ${script_dir}/trino/trino-dependency.shelif [ "${component_type}" == "gravitino" ]; then. ${script_dir}/gravitino/gravitino-dependency.sh+elif [ "${component_type}" == "doris" ]; then+ . ${script_dir}/doris/doris-dependency.sh --platform ${platform_type}+ build_args="--build-arg DORIS_PACKAGE_NAME=${DORIS_PACKAGE_NAME} --build-arg DORIS_FILE_NAME=${DORIS_FILE_NAME}"elseecho "ERROR : ${component_type} is not a valid component type"- echo ${USAGE}+ usageexit 1fidiff --git a/dev/docker/doris/Dockerfile b/dev/docker/doris/Dockerfilenew file mode 100644index 0000000000..acf42ad69e--- /dev/null+++ b/dev/docker/doris/Dockerfile@@ -0,0 +1,59 @@+#+# Copyright 2024 Datastrato Pvt Ltd.+# This software is licensed under the Apache License version 2.+#+FROM ubuntu:22.04+LABEL maintainer="[email protected]"++ARG DORIS_PACKAGE_NAME+ARG DORIS_FILE_NAME+ARG TARGET_ARCH++WORKDIR /++################################################################################+# update and install basic tools+RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \+ patchelf gdb binutils binutils-common mysql-client \+ curl wget less vim htop iproute2 numactl jq iotop sysstat tzdata xz-utils \+ tcpdump iputils-ping dnsutils strace lsof blktrace \+ bpfcc-tools linux-headers-realtime linux-tools-realtime silversearcher-ag \+ net-tools openjdk-8-jdk && \+ rm -rf /var/lib/apt/lists/*++################################################################################+# set environment variables+ENV JAVA_HOME=/usr/local/jdk+ENV DORIS_HOME=/opt/apache-doris+ENV DORIS_FE_HOME=${DORIS_HOME}/fe+ENV DORIS_BE_HOME=${DORIS_HOME}/be++ENV PATH=${JAVA_HOME}/bin:${DORIS_FE_HOME}/bin:${DORIS_BE_HOME}/bin:${PATH}++################################################################################+# setup java++RUN ARCH=$(uname -m) && \+ if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then \+ ln -s /usr/lib/jvm/java-8-openjdk-arm64 ${JAVA_HOME}; \+ else \+ ln -s /usr/lib/jvm/java-8-openjdk-amd64 ${JAVA_HOME}; \+ fi++#################################################################################+## add files++ADD packages/${DORIS_FILE_NAME} /opt+RUN ln -s /opt/${DORIS_PACKAGE_NAME} ${DORIS_HOME}++COPY start.sh ${DORIS_HOME}++################################################################################+# set WORKDIR/EXPOSE/CMD++WORKDIR ${DORIS_HOME}++EXPOSE 8030+EXPOSE 9030++CMD ["bash", "start.sh"]\ No newline at end of filediff --git a/dev/docker/doris/doris-dependency.sh b/dev/docker/doris/doris-dependency.shnew file mode 100755index 0000000000..043af530e6--- /dev/null+++ b/dev/docker/doris/doris-dependency.sh@@ -0,0 +1,77 @@+#!/bin/bash+#+# Copyright 2024 Datastrato Pvt Ltd.+# This software is licensed under the Apache License version 2.+#++doris_dir="$(dirname "${BASH_SOURCE-$0}")"+doris_dir="$(cd "${doris_dir}">/dev/null; pwd)"++TARGET_ARCH=""++# Get platform type+if [[ "$1" == "--platform" ]]; then+ shift+ platform_type="$1"+ if [[ "${platform_type}" == "linux/amd64" ]]; then+ echo "INFO : doris build platform type is ${platform_type}"+ TARGET_ARCH="x64"+ elif [[ "${platform_type}" == "linux/arm64" ]]; then+ echo "INFO : doris build platform type is ${platform_type}"+ TARGET_ARCH="arm64"+ elif [[ "${platform_type}" == "all" ]]; then+ echo "ERROR : doris not support ${platform_type}"+ exit 1+ else+ echo "ERROR : ${platform_type} is not a valid platform type for doris"+ usage+ exit 1+ fi+ shift+else+ echo "ERROR: must specify platform for doris"+ exit 1+fi++# Environment variables definition+DORIS_VERSION="1.2.7.1"++DORIS_PACKAGE_NAME="apache-doris-${DORIS_VERSION}-bin-${TARGET_ARCH}"+DORIS_FILE_NAME="${DORIS_PACKAGE_NAME}.tar.xz"+DORIS_DOWNLOAD_URL="https://apache-doris-releases.oss-accelerate.aliyuncs.com/${DORIS_FILE_NAME}"+SHA512SUMS_URL="${DORIS_DOWNLOAD_URL}.sha512"++# Prepare download packages+if [[ ! -d "${doris_dir}/packages" ]]; then+ mkdir -p "${doris_dir}/packages"+fi++if [[ ! -f "${doris_dir}/packages/${DORIS_FILE_NAME}" ]]; then+ curl -s -o "${doris_dir}/packages/${DORIS_FILE_NAME}" ${DORIS_DOWNLOAD_URL}+fi++# download sha512sum file+if [[ ! -f "${doris_dir}/packages/${DORIS_FILE_NAME}.sha512" ]]; then+ curl -s -o "${doris_dir}/packages/${DORIS_FILE_NAME}.sha512" ${SHA512SUMS_URL}+fi+++cd "${doris_dir}/packages" || exit 1++# check sha512sum, if check file failed, exit 1++if command -v shasum &>/dev/null; then+ shasum -c "${DORIS_FILE_NAME}.sha512"+elif command -v sha512sum &>/dev/null; then+ sha512sum -c "${DORIS_FILE_NAME}.sha512"+else+ cat << EOF+ WARN: cannot find shasum or sha512sum command, skip sha512sum check, please check the sha512sum by yourself.+ if build Docker image failed, maybe the package is broken.+EOF+fi++if [ $? -ne 0 ]; then+ echo "ERROR: sha512sum check failed"+ exit 1+fi\ No newline at end of filediff --git a/dev/docker/doris/start.sh b/dev/docker/doris/start.shnew file mode 100644index 0000000000..7ed373159f--- /dev/null+++ b/dev/docker/doris/start.sh@@ -0,0 +1,48 @@+#!/bin/bash+#+# Copyright 2024 Datastrato Pvt Ltd.+# This software is licensed under the Apache License version 2.+#++DORIS_HOME="$(dirname "${BASH_SOURCE-$0}")"+DORIS_HOME="$(cd "${DORIS_HOME}">/dev/null; pwd)"+DORIS_FE_HOME="${DORIS_HOME}/fe/"+DORIS_BE_HOME="${DORIS_HOME}/be/"++# comment a code snippet about max_map_count, it's not necessary for IT environment++DORIS_BE_SCRIPT="${DORIS_BE_HOME}/bin/start_be.sh"++sed -i '/Please set vm.max_map_count/,/exit 1/{s/exit 1/#exit 1\n echo "skip this"/}' ${DORIS_BE_SCRIPT}+sed -i '/Please set the maximum number of open file descriptors/,/exit 1/{s/exit 1/#exit 1\n echo "skip this"/}' ${DORIS_BE_SCRIPT}++# update fe.conf & be.conf, set priority_networks+CONTAINER_IP=$(hostname -i)+PRIORITY_NETWORKS=$(echo "${CONTAINER_IP}" | awk -F '.' '{print$1"."$2"."$3".0/24"}')+echo "add priority_networks = ${PRIORITY_NETWORKS} to fe.conf & be.conf"+echo "priority_networks = ${PRIORITY_NETWORKS}" >> ${DORIS_FE_HOME}/conf/fe.conf+echo "priority_networks = ${PRIORITY_NETWORKS}" >> ${DORIS_BE_HOME}/conf/be.conf++# start doris fe and be+${DORIS_FE_HOME}/bin/start_fe.sh --daemon+${DORIS_BE_HOME}/bin/start_be.sh --daemon++# wait for the fe to start+for i in {1..10}; do+ sleep 5+ # check http://localhost:8030/api/bootstrap return contains content '"msg":"success"' to see if the fe is ready+ url="http://localhost:8030/api/bootstrap"+ response=$(curl --silent --request GET $url)++ if echo "$response" | grep -q "\"msg\":\"success\""; then+ break+ else+ echo "waiting for the fe to start"+ fi+done++# add the be to the fe+mysql -h127.0.0.1 -P9030 -uroot -e "ALTER SYSTEM ADD BACKEND '${CONTAINER_IP}:9050'"++# persist the container+tail -f /dev/null\ No newline at end of filediff --git a/docs/docker-image-details.md b/docs/docker-image-details.mdindex 8562c32dcf..6c3436a5f8 100644--- a/docs/docker-image-details.md+++ b/docs/docker-image-details.md@@ -153,3 +153,18 @@ Changelog- Based on `trinodb/trino:426` and removed some unused plugins from it.- Expose ports:- `8080` Trino JDBC port++## Gravitino CI Doris image++You can use this image to test Apache Doris.++Changelog++- gravitino-ci-doris:0.1.0+ - Docker image `datastrato/gravitino-ci-doris:0.1.0`+ - Start Doris BE & FE in one container+ - Please set table properties `"replication_num" = "1"` when creating a table in Doris, because the default replication number is 3, but the Doris container only has one BE.+ - Username: `root`, Password: N/A (password is empty)+ - Expose ports:+ - `8030` Doris FE HTTP port+ - `9030` Doris FE MySQL server port