This is an automated email from the ASF dual-hosted git repository.
ming 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 b980df869 fix(chore): remove zgc in dockerfile for ARM env (#2421)
b980df869 is described below
commit b980df86977bb1702a99933558fdce989256c274
Author: Dandelion <[email protected]>
AuthorDate: Fri Jan 26 16:48:41 2024 +0800
fix(chore): remove zgc in dockerfile for ARM env (#2421)
* remove zgc
* Apply suggestions from code review
Co-authored-by: imbajin <[email protected]>
* add comment for hugegraph-server.sh
* fix enable-auth.sh
* init store in entrypoint
* use flag file to skip re-init
* delete tar.gz
* simply dockerfile
* mvn optimize
* simply dockerfile
* add init log in docker
---------
Co-authored-by: imbajin <[email protected]>
---
hugegraph-server/Dockerfile | 19 +++++++------
.../hugegraph-dist/docker/docker-entrypoint.sh | 31 +++++++++++++---------
.../src/assembly/static/bin/enable-auth.sh | 26 +++++++++---------
.../src/assembly/static/bin/hugegraph-server.sh | 1 +
.../hugegraph-dist/src/assembly/static/bin/util.sh | 3 +++
5 files changed, 46 insertions(+), 34 deletions(-)
diff --git a/hugegraph-server/Dockerfile b/hugegraph-server/Dockerfile
index 45a725786..8eef58c5f 100644
--- a/hugegraph-server/Dockerfile
+++ b/hugegraph-server/Dockerfile
@@ -23,13 +23,13 @@ COPY . /pkg
WORKDIR /pkg
ARG MAVEN_ARGS
-RUN mvn package $MAVEN_ARGS -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true
&& pwd && ls -l
+RUN mvn package $MAVEN_ARGS -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true
&& pwd && ls -l && rm ./hugegraph-server/*.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
-# TODO: get the version from the pom.xml
-ENV version=1.2.0
-COPY --from=build /pkg/hugegraph-server/apache-hugegraph-incubating-$version/
/hugegraph-server
+
+COPY --from=build /pkg/hugegraph-server/apache-hugegraph-incubating-*/
/hugegraph-server/
LABEL maintainer="HugeGraph Docker Maintainers <[email protected]>"
# TODO: use g1gc or zgc as default
@@ -39,7 +39,7 @@ ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions
-XX:+UseContainerSupport -XX:Max
#COPY . /hugegraph/hugegraph-server
WORKDIR /hugegraph-server/
-# 1. Install environment
+# 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 \
@@ -48,15 +48,14 @@ RUN set -x \
curl \
lsof \
vim \
+ cron \
&& apt-get clean \
- && rm -rf /var/lib/apt/lists/*
-
-# 2. Init HugeGraph Sever
-RUN set -e \
+ && 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
-# 3. Init docker script
+# 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 .
diff --git a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh
b/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh
index 716dbf8c9..aa503f356 100644
--- a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh
+++ b/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh
@@ -16,24 +16,31 @@
# under the License.
#
-# wait for storage like cassandra
-./bin/wait-storage.sh
+# create a folder to save the docker-related file
+DOCKER_FOLDER='./docker'
+mkdir -p $DOCKER_FOLDER
-# set auth if needed
-if [[ $AUTH == "true" ]]; then
- # set password if use do not provide
+INIT_FLAG_FILE="init_complete"
+
+if [ ! -f "${DOCKER_FOLDER}/${INIT_FLAG_FILE}" ]; then
+ # wait for storage backend
+ ./bin/wait-storage.sh
if [ -z "$PASSWORD" ]; then
- echo "you have not set the password, we will use the default password"
- PASSWORD="hugegraph"
+ echo "init hugegraph with non-auth mode"
+ ./bin/init-store.sh
+ else
+ echo "init hugegraph with auth mode"
+ ./bin/enable-auth.sh
+ echo "$PASSWORD" | ./bin/init-store.sh
fi
- echo "init hugegraph with auth"
- ./bin/enable-auth.sh
- echo "$PASSWORD" | ./bin/init-store.sh
+ # create a flag file to avoid re-init when restarting
+ touch ${DOCKER_FOLDER}/${INIT_FLAG_FILE}
else
- ./bin/init-store.sh
+ echo "Hugegraph Initialization already done. Skipping re-init..."
fi
# start hugegraph
-./bin/start-hugegraph.sh -j "$JAVA_OPTS" -g zgc
+# remove "-g zgc" now, which is only available on ARM-Mac with java > 13
+./bin/start-hugegraph.sh -j "$JAVA_OPTS"
tail -f /dev/null
diff --git
a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/enable-auth.sh
b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/enable-auth.sh
index 924bf58f7..2f975872c 100644
--- a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/enable-auth.sh
+++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/enable-auth.sh
@@ -36,19 +36,21 @@ GRAPH_CONF="hugegraph.properties"
# make a backup
BAK_CONF="$TOP/conf-bak"
-mkdir -p "$BAK_CONF"
-cp "${CONF}/${GREMLIN_SERVER_CONF}" "${BAK_CONF}/${GREMLIN_SERVER_CONF}.bak"
-cp "${CONF}/${REST_SERVER_CONF}" "${BAK_CONF}/${REST_SERVER_CONF}.bak"
-cp "${CONF}/graphs/${GRAPH_CONF}" "${BAK_CONF}/${GRAPH_CONF}.bak"
+if [ ! -d "$BAK_CONF" ]; then
+ mkdir -p "$BAK_CONF"
+ cp "${CONF}/${GREMLIN_SERVER_CONF}"
"${BAK_CONF}/${GREMLIN_SERVER_CONF}.bak"
+ cp "${CONF}/${REST_SERVER_CONF}" "${BAK_CONF}/${REST_SERVER_CONF}.bak"
+ cp "${CONF}/graphs/${GRAPH_CONF}" "${BAK_CONF}/${GRAPH_CONF}.bak"
-sed -i -e '$a\authentication: {' \
- -e '$a\ authenticator:
org.apache.hugegraph.auth.StandardAuthenticator,' \
- -e '$a\ authenticationHandler:
org.apache.hugegraph.auth.WsAndHttpBasicAuthHandler,' \
- -e '$a\ config: {tokens: conf/rest-server.properties}' \
- -e '$a\}' ${CONF}/${GREMLIN_SERVER_CONF}
+ sed -i -e '$a\authentication: {' \
+ -e '$a\ authenticator:
org.apache.hugegraph.auth.StandardAuthenticator,' \
+ -e '$a\ authenticationHandler:
org.apache.hugegraph.auth.WsAndHttpBasicAuthHandler,' \
+ -e '$a\ config: {tokens: conf/rest-server.properties}' \
+ -e '$a\}' ${CONF}/${GREMLIN_SERVER_CONF}
-sed -i -e
'$a\auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator' \
- -e '$a\auth.graph_store=hugegraph' ${CONF}/${REST_SERVER_CONF}
+ sed -i -e
'$a\auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator' \
+ -e '$a\auth.graph_store=hugegraph' ${CONF}/${REST_SERVER_CONF}
-sed -i
's/gremlin.graph=org.apache.hugegraph.HugeFactory/gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy/g'
${CONF}/graphs/${GRAPH_CONF}
+ sed -i
's/gremlin.graph=org.apache.hugegraph.HugeFactory/gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy/g'
${CONF}/graphs/${GRAPH_CONF}
+fi
diff --git
a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh
b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh
index a64398683..24b10a8e9 100644
---
a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh
+++
b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh
@@ -127,6 +127,7 @@ if [[ $JAVA_VERSION -gt 9 ]]; then
fi
# Using G1GC as the default garbage collector (Recommended for large memory
machines)
+# mention: zgc is only available on ARM-Mac with java > 13
case "$GC_OPTION" in
g1|G1|g1gc)
echo "Using G1GC as the default garbage collector"
diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh
b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh
index 47d18e995..5f7489e60 100755
--- a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh
+++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh
@@ -139,6 +139,9 @@ function wait_for_startup() {
process_status "$server_name" "$pid" >/dev/null
if [ $? -eq 1 ]; then
echo "Starting $server_name failed"
+ if [ -e "$error_file_name" ]; then
+ rm "$error_file_name"
+ fi
return 1
fi