This is an automated email from the ASF dual-hosted git repository. yuqi4733 pushed a commit to branch issue_9176 in repository https://gitbox.apache.org/repos/asf/gravitino.git
commit 3fb63a88245071ce6b1fee658a60260e521c11eb Author: yuqi <[email protected]> AuthorDate: Thu Nov 20 15:10:09 2025 +0800 Fix --- .github/workflows/docker-image.yml | 4 ++ dev/docker/lance-rest-server/Dockerfile | 32 +++++++++ .../lance-rest-server-dependency.sh | 35 ++++++++++ dev/docker/lance-rest-server/rewrite_config.py | 75 ++++++++++++++++++++++ .../lance-rest-server/start-lance-rest-server.sh | 32 +++++++++ 5 files changed, 178 insertions(+) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 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" ]; then echo "image_type=iceberg-rest-server" >> $GITHUB_ENV echo "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_ENV elif [ "${{ github.event.inputs.image }}" == "gravitino-mcp-server" ]; then echo "image_type=mcp-server" >> $GITHUB_ENV echo "image_name=${{ github.event.inputs.docker_repo_name }}/gravitino-mcp-server" >> $GITHUB_ENV diff --git a/dev/docker/lance-rest-server/Dockerfile b/dev/docker/lance-rest-server/Dockerfile new file mode 100644 index 0000000000..b765e0bf39 --- /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-iceberg-rest-server /root/gravitino-lance-rest-server + +EXPOSE 9001 + +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.sh new file mode 100755 index 0000000000..71719ae005 --- /dev/null +++ b/dev/docker/lance-rest-server/lance-rest-server-dependency.sh @@ -0,0 +1,35 @@ +#!/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 \ No newline at end of file diff --git a/dev/docker/lance-rest-server/rewrite_config.py b/dev/docker/lance-rest-server/rewrite_config.py new file mode 100755 index 0000000000..fc4fc8495b --- /dev/null +++ b/dev/docker/lance-rest-server/rewrite_config.py @@ -0,0 +1,75 @@ +#!/usr/bin/env 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. + +import os + +env_map = { + "LANCE_REST_NAMESPACE_BACKEND": "namespace-backend", + "LANCE_REST_GRAVITINO_URI": "gravitino.uri", + "LANCE_REST_GRAVITINO_METALAKE_NAME": "gravitino.metalake-name", +} + +init_config = { + "namespace-backend": "gravitino", + "gravitino.uri": "http://localhost:8090", + "gravitino.metalake-name": "metalake", + "host": "0.0.0.0", + "port": "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.sh new file mode 100755 index 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 run
