World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#9176] feat(docker): Support Lance REST docker image. (#9206)
Mini Yu6395b6aa47f1
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.ymlindex f08b7f9934..b27627e59a 100644--- a/.github/workflows/docker-image.yml+++ b/.github/workflows/docker-image.yml@@ -20,6 +20,7 @@ on:- 'gravitino-playground:ranger'- 'gravitino-iceberg-rest-server'- 'gravitino-mcp-server'+ - 'gravitino-lance-rest-server'docker_repo_name:description: 'Docker repository name (default is apache)'required: false@@ -92,6 +93,9 @@ jobs:elif [ "${{ github.event.inputs.image }}" == "gravitino-iceberg-rest-server" ]; thenecho "image_type=iceberg-rest-server" >> $GITHUB_ENVecho "image_name=${{ github.event.inputs.docker_repo_name }}/gravitino-iceberg-rest" >> $GITHUB_ENV+ elif [ "${{ github.event.inputs.image }}" == "gravitino-lance-rest-server" ]; then+ echo "image_type=lance-rest-server" >> $GITHUB_ENV+ echo "image_name=${{ github.event.inputs.docker_repo_name }}/gravitino-lance-rest" >> $GITHUB_ENVelif [ "${{ github.event.inputs.image }}" == "gravitino-mcp-server" ]; thenecho "image_type=mcp-server" >> $GITHUB_ENVecho "image_name=${{ github.event.inputs.docker_repo_name }}/gravitino-mcp-server" >> $GITHUB_ENVdiff --git a/dev/docker/build-docker.sh b/dev/docker/build-docker.shindex 9b4758e1ba..d1c084185a 100755--- a/dev/docker/build-docker.sh+++ b/dev/docker/build-docker.sh@@ -27,7 +27,7 @@ usage() {cat << EOFUsage:-./build-docker.sh --platform [all|linux/amd64|linux/arm64] --type [gravitino|hive|kerberos-hive|trino|doris|ranger|iceberg-rest-server|mcp-server] --image {image_name} --tag {tag_name} --latest+./build-docker.sh --platform [all|linux/amd64|linux/arm64] --type [gravitino|hive|kerberos-hive|trino|doris|ranger|iceberg-rest-server|lance-rest-server|mcp-server] --image {image_name} --tag {tag_name} --latestNotice: You shouldn't use 'all' for the platform if you don't use the Github action to publish the Docker image.EOF@@ -117,6 +117,8 @@ elif [ "${component_type}" == "iceberg-rest-server" ]; then. ${script_dir}/iceberg-rest-server/iceberg-rest-server-dependency.shelif [ "${component_type}" == "mcp-server" ]; then. ${script_dir}/mcp-server/mcp-server-dependency.sh+elif [ "${component_type}" == "lance-rest-server" ]; then+ . ${script_dir}/lance-rest-server/lance-rest-server-dependency.shelseecho "ERROR : ${component_type} is not a valid component type"usagediff --git a/dev/docker/lance-rest-server/Dockerfile b/dev/docker/lance-rest-server/Dockerfilenew file mode 100644index 0000000000..ec80243330--- /dev/null+++ b/dev/docker/lance-rest-server/Dockerfile@@ -0,0 +1,32 @@+#+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.+#+FROM eclipse-temurin:17.0.16_8-jdk-jammy++LABEL maintainer="[email protected]"++RUN apt-get update && apt-get install -y \+ python-is-python3++WORKDIR /root/gravitino-lance-rest-server++COPY packages/gravitino-lance-rest-server /root/gravitino-lance-rest-server++EXPOSE 9101++ENTRYPOINT ["/bin/bash", "/root/gravitino-lance-rest-server/bin/start-lance-rest-server.sh"]diff --git a/dev/docker/lance-rest-server/lance-rest-server-dependency.sh b/dev/docker/lance-rest-server/lance-rest-server-dependency.shnew file mode 100755index 0000000000..5017260782--- /dev/null+++ b/dev/docker/lance-rest-server/lance-rest-server-dependency.sh@@ -0,0 +1,39 @@+#!/bin/bash+#+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.+#+set -ex+lance_rest_server_dir="$(dirname "${BASH_SOURCE-$0}")"+lance_rest_server_dir="$(cd "${lance_rest_server_dir}">/dev/null; pwd)"+gravitino_home="$(cd "${lance_rest_server_dir}/../../..">/dev/null; pwd)"++# Prepare the Lance REST server packages+cd ${gravitino_home}+./gradlew clean assembleLanceRESTServer -x test++# Removed old packages+rm -rf "${lance_rest_server_dir}/packages"+mkdir -p "${lance_rest_server_dir}/packages"++cd distribution+tar xfz gravitino-lance-rest-server-*.tar.gz+cp -r gravitino-lance-rest-server*-bin ${lance_rest_server_dir}/packages/gravitino-lance-rest-server++cd ${lance_rest_server_dir}+cp start-lance-rest-server.sh ${lance_rest_server_dir}/packages/gravitino-lance-rest-server/bin/+cp rewrite_config.py ${lance_rest_server_dir}/packages/gravitino-lance-rest-server/bin/\ No newline at end of filediff --git a/dev/docker/lance-rest-server/rewrite_config.py b/dev/docker/lance-rest-server/rewrite_config.pynew file mode 100755index 0000000000..b165b0faa1--- /dev/null+++ b/dev/docker/lance-rest-server/rewrite_config.py@@ -0,0 +1,77 @@+#!/usr/bin/env python+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.++import os++env_map = {+ "LANCE_REST_NAMESPACE_BACKEND": "namespace-backend",+ "LANCE_REST_GRAVITINO_URI": "gravitino.uri",+ "LANCE_REST_GRAVITINO_METALAKE_NAME": "gravitino.metalake-name",+ "LANCE_REST_HOST": "host",+ "LANCE_REST_PORT": "httpPort"+}++init_config = {+ "namespace-backend": "gravitino",+ "gravitino.uri": "http://localhost:8090",+ "gravitino.metalake-name": "metalake",+ "host": "0.0.0.0",+ "httpPort": "9101"+}+++def parse_config_file(file_path):+ config_map = {}+ with open(file_path, "r") as file:+ for line in file:+ stripped_line = line.strip()+ if stripped_line and not stripped_line.startswith("#"):+ key, value = stripped_line.split("=", 1)+ key = key.strip()+ value = value.strip()+ config_map[key] = value+ return config_map+++config_prefix = "gravitino.lance-rest."+++def update_config(config, key, value):+ config[config_prefix + key] = value+++config_file_path = "conf/gravitino-lance-rest-server.conf"+config_map = parse_config_file(config_file_path)++# Set from init_config only if the key doesn't exist+for k, v in init_config.items():+ full_key = config_prefix + k+ if full_key not in config_map:+ update_config(config_map, k, v)++for k, v in env_map.items():+ if k in os.environ:+ update_config(config_map, v, os.environ[k])++if os.path.exists(config_file_path):+ os.remove(config_file_path)++with open(config_file_path, "w") as file:+ for key, value in config_map.items():+ line = "{} = {}\n".format(key, value)+ file.write(line)diff --git a/dev/docker/lance-rest-server/start-lance-rest-server.sh b/dev/docker/lance-rest-server/start-lance-rest-server.shnew file mode 100755index 0000000000..5d95c5b1ce--- /dev/null+++ b/dev/docker/lance-rest-server/start-lance-rest-server.sh@@ -0,0 +1,32 @@+#!/bin/bash+#+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.+#++set -ex+bin_dir="$(dirname "${BASH_SOURCE-$0}")"+lance_rest_server_dir="$(cd "${bin_dir}/../">/dev/null; pwd)"++cd ${lance_rest_server_dir}++python bin/rewrite_config.py++JAVA_OPTS+=" -XX:-UseContainerSupport"+export JAVA_OPTS++exec ./bin/gravitino-lance-rest-server.sh rundiff --git a/docs/docker-image-details.md b/docs/docker-image-details.mdindex 1ec780ce92..a870886cb2 100644--- a/docs/docker-image-details.md+++ b/docs/docker-image-details.md@@ -121,6 +121,25 @@ Changelog- Supports associate&disassociate tag, policy to metadata- Supports submit&cancel jobs.+## Apache Gravitino Lance REST server Docker image++You can deploy the standalone Gravitino Lance REST server with the Docker image.++```shell+docker run --rm -d -p 9102:9102 -e LANCE_REST_GRAVITINO_METALAKE_NAME=test -e LANCE_REST_PORT=9102 apache/gravitino-lance-rest:latest+```++Currently, Gravitino Lance REST server supports setting the following environment variables+- LANCE_REST_GRAVITINO_METALAKE_NAME: It will overwrite the configuration "gravitino.lance-rest.gravitino.metalake-name" in configuration file `conf/gravitino-lance-rest-server.conf`. **You should set it to your Gravitino metalake name.**+- LANCE_REST_NAMESPACE_BACKEND: It will overwrite the configuration "gravitino.lance-rest.namespace-backend" in configuration file `conf/gravitino-lance-rest-server.conf`. The default value is "gravitino" and you should not change it as of now.+- LANCE_REST_GRAVITINO_URI: It will overwrite the configuration "gravitino.lance-rest.gravitino-uri" in configuration file `conf/gravitino-lance-rest-server.conf`. The default value is "http://localhost:8090" and you can change it to your Gravitino server address.+- LANCE_REST_HOST: It will overwrite the configuration "gravitino.lance-rest.host" in configuration file `conf/gravitino-lance-rest-server.conf`. The default value is `0.0.0.0`.+- LANCE_REST_PORT: It will overwrite the configuration "gravitino.lance-rest.httpPort" in configuration file `conf/gravitino-lance-rest-server.conf`. The default value is `9101`.++It's not advised to change `LANCE_REST_NAMESPACE_BACKEND`, `LANCE_REST_HOST` and `LANCE_REST_PORT` if you are not familiar with Gravitino Lance REST server and no special requirements.+++## Playground Docker imageYou can use the [playground](https://github.com/apache/gravitino-playground) to experience the whole Gravitino system with other components.