forked from hugegraph/hugegraph-sync
fix(chore): remove zgc in dockerfile for ARM env (#2421)
* remove zgc * Apply suggestions from code review Co-authored-by: imbajin <jin@apache.org> * 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 <jin@apache.org>
This commit is contained in:
parent
1dd0580d30
commit
b980df8697
|
|
@ -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 <dev@hugegraph.apache.org>"
|
||||
|
||||
# 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 .
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue