This is an automated email from the ASF dual-hosted git repository.
jin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git
The following commit(s) were added to refs/heads/master by this push:
new 7dc6a86a7 chore(dist): intro additional Dockerfile to build the server
image & skip init-hstore backend (#2642)
7dc6a86a7 is described below
commit 7dc6a86a7d5753bc5391b99b33dd1df97c6a0050
Author: V_Galaxy <[email protected]>
AuthorDate: Thu Aug 22 14:04:06 2024 +0800
chore(dist): intro additional Dockerfile to build the server image & skip
init-hstore backend (#2642)
---
hugegraph-server/Dockerfile-hstore | 73 ++++++++++++++++++++++
...graph.properties => hstore.properties.template} | 0
.../static/conf/graphs/hugegraph.properties | 4 +-
.../java/org/apache/hugegraph/cmd/InitStore.java | 9 ++-
.../assembly/static/bin/start-hugegraph-store.sh | 4 +-
pom.xml | 1 +
6 files changed, 86 insertions(+), 5 deletions(-)
diff --git a/hugegraph-server/Dockerfile-hstore
b/hugegraph-server/Dockerfile-hstore
new file mode 100644
index 000000000..47f758b0d
--- /dev/null
+++ b/hugegraph-server/Dockerfile-hstore
@@ -0,0 +1,73 @@
+#
+# 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.
+#
+
+# Dockerfile for HugeGraph Server
+# 1st stage: build source code
+FROM maven:3.9.0-eclipse-temurin-11 AS build
+
+COPY . /pkg
+WORKDIR /pkg
+ARG MAVEN_ARGS
+
+RUN mvn package $MAVEN_ARGS -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true
&& pwd && ls -l && rm \
+ ./hugegraph-server/*.tar.gz && rm ./hugegraph-pd/*.tar.gz && rm
./hugegraph-store/*.tar.gz
+
+# 2nd stage: runtime env
+# Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java >
13
+FROM openjdk:11-slim
+
+COPY --from=build /pkg/hugegraph-server/apache-hugegraph-server-incubating-*/
/hugegraph-server/
+# remove hugegraph.properties and rename hstore.properties.template for
default hstore backend
+RUN cd /hugegraph-server/conf/graphs \
+ && rm hugegraph.properties && mv hstore.properties.template
hugegraph.properties
+
+LABEL maintainer="HugeGraph Docker Maintainers <[email protected]>"
+
+# TODO: use g1gc or zgc as default
+ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport
-XX:MaxRAMPercentage=50 -XshowSettings:vm" \
+ HUGEGRAPH_HOME="hugegraph-server"
+
+#COPY . /hugegraph/hugegraph-server
+WORKDIR /hugegraph-server/
+
+# 1. Install environment and init HugeGraph Sever
+RUN set -x \
+ && apt-get -q update \
+ && apt-get -q install -y --no-install-recommends --no-install-suggests \
+ dumb-init \
+ procps \
+ curl \
+ lsof \
+ vim \
+ cron \
+ && apt-get clean \
+ && rm -rf /var/lib/apt/lists/* \
+ && service cron start \
+ && pwd && cd /hugegraph-server/ \
+ && sed -i "s/^restserver.url.*$/restserver.url=http:\/\/0.0.0.0:8080/g"
./conf/rest-server.properties
+
+# 2. Init docker script
+COPY hugegraph-server/hugegraph-dist/docker/scripts/remote-connect.groovy
./scripts
+COPY hugegraph-server/hugegraph-dist/docker/scripts/detect-storage.groovy
./scripts
+COPY hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh .
+RUN chmod 755 ./docker-entrypoint.sh
+
+EXPOSE 8080
+VOLUME /hugegraph-server
+
+ENTRYPOINT ["/usr/bin/dumb-init", "--"]
+CMD ["./docker-entrypoint.sh"]
diff --git
a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties
b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hstore.properties.template
similarity index 100%
copy from
hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties
copy to
hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hstore.properties.template
diff --git
a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties
b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties
index 1a3532914..66a062191 100644
---
a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties
+++
b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties
@@ -19,13 +19,13 @@ edge.cache_type=l2
#vertex.default_label=vertex
-backend=hstore
+backend=rocksdb
serializer=binary
store=hugegraph
# pd config
-pd.peers=127.0.0.1:8686
+#pd.peers=127.0.0.1:8686
# task config
task.scheduler_type=local
diff --git
a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java
b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java
index 255528932..e3053a209 100644
---
a/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java
+++
b/hugegraph-server/hugegraph-dist/src/main/java/org/apache/hugegraph/cmd/InitStore.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import org.apache.commons.collections.map.MultiValueMap;
import org.apache.hugegraph.HugeFactory;
@@ -77,7 +78,13 @@ public class InitStore {
List<HugeGraph> graphs = new ArrayList<>(graph2ConfigPaths.size());
try {
for (Map.Entry<String, String> entry :
graph2ConfigPaths.entrySet()) {
- graphs.add(initGraph(entry.getValue()));
+ String configPath = entry.getValue();
+ HugeConfig config = new HugeConfig(configPath);
+ if (Objects.equals(config.get(CoreOptions.BACKEND), "hstore"))
{
+ // skip initializing hstore backend
+ continue;
+ }
+ graphs.add(initGraph(configPath));
}
StandardAuthenticator.initAdminUserIfNeeded(restConf);
} finally {
diff --git
a/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh
b/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh
index 67adb70dd..1704aded1 100644
---
a/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh
+++
b/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh
@@ -74,12 +74,12 @@ export FILE_LIMITN=1024
function check_evn_limit() {
local limit_check=$(ulimit -n)
- if [ ${limit_check} -lt ${FILE_LIMITN} ]; then
+ if [[ ${limit_check} != "unlimited" && ${limit_check} -lt ${FILE_LIMITN}
]]; then
echo -e "${BASH_SOURCE[0]##*/}:${LINENO}:\E[1;32m ulimit -n
可以打开的最大文件描述符数太少,需要(${FILE_LIMITN})!! \E[0m"
return 1
fi
limit_check=$(ulimit -u)
- if [ ${limit_check} -lt ${PROC_LIMITN} ]; then
+ if [[ ${limit_check} != "unlimited" && ${limit_check} -lt ${PROC_LIMITN}
]]; then
echo -e "${BASH_SOURCE[0]##*/}:${LINENO}:\E[1;32m ulimit -u
用户最大可用的进程数太少,需要(${PROC_LIMITN})!! \E[0m"
return 2
fi
diff --git a/pom.xml b/pom.xml
index 44be45637..07b2cef50 100644
--- a/pom.xml
+++ b/pom.xml
@@ -151,6 +151,7 @@
<exclude>**/*.conf</exclude>
<exclude>**/*.map</exclude>
<exclude>**/*.properties</exclude>
+ <exclude>**/*.template</exclude>
<exclude>**/bin/hugegraph.service</exclude>
<exclude>**/swagger-ui/**/*</exclude>
<exclude>scripts/dev/reviewers</exclude>