This is an automated email from the ASF dual-hosted git repository.
fanng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new 6395b6aa47 [#9176] feat(docker): Support Lance REST docker image.
(#9206)
6395b6aa47 is described below
commit 6395b6aa47f1ce7c57f2af204e9e725c9e87f869
Author: Mini Yu <[email protected]>
AuthorDate: Wed Nov 26 10:23:03 2025 +0800
[#9176] feat(docker): Support Lance REST docker image. (#9206)
### What changes were proposed in this pull request?
Support building a new Docker image named `gravitino-lance-rest`.
### Why are the changes needed?
To release the Lance REST service.
Fix: #9176
### Does this PR introduce _any_ user-facing change?
N/A
### How was this patch tested?
Test locally.
---
.github/workflows/docker-image.yml | 4 ++
dev/docker/build-docker.sh | 4 +-
dev/docker/lance-rest-server/Dockerfile | 32 +++++++++
.../lance-rest-server-dependency.sh | 39 +++++++++++
dev/docker/lance-rest-server/rewrite_config.py | 77 ++++++++++++++++++++++
.../lance-rest-server/start-lance-rest-server.sh | 32 +++++++++
docs/docker-image-details.md | 19 ++++++
7 files changed, 206 insertions(+), 1 deletion(-)
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/build-docker.sh b/dev/docker/build-docker.sh
index 9b4758e1ba..d1c084185a 100755
--- a/dev/docker/build-docker.sh
+++ b/dev/docker/build-docker.sh
@@ -27,7 +27,7 @@ usage() {
cat << EOF
Usage:
-./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} --latest
Notice: 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.sh
elif [ "${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.sh
else
echo "ERROR : ${component_type} is not a valid component type"
usage
diff --git a/dev/docker/lance-rest-server/Dockerfile
b/dev/docker/lance-rest-server/Dockerfile
new file mode 100644
index 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.sh
new file mode 100755
index 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 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..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.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
diff --git a/docs/docker-image-details.md b/docs/docker-image-details.md
index 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 image
You can use the [playground](https://github.com/apache/gravitino-playground)
to experience the whole Gravitino system with other components.