This is an automated email from the ASF dual-hosted git repository. vgalaxies pushed a commit to branch pd-store-docker in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git
commit 247f5b11c157b3c2e41c4335ee97b8175ab10f10 Author: VGalaxies <[email protected]> AuthorDate: Sun Apr 21 18:59:04 2024 +0800 init --- README.md | 2 +- {hugegraph-server => hugegraph-pd}/Dockerfile | 32 ++++++++-------------- .../hg-pd-dist}/docker/docker-entrypoint.sh | 28 ++----------------- hugegraph-server/Dockerfile | 4 +-- hugegraph-server/hugegraph-dist/docker/README.md | 6 ++-- .../hugegraph-dist/docker/docker-entrypoint.sh | 2 +- {hugegraph-server => hugegraph-store}/Dockerfile | 32 ++++++++-------------- .../hg-store-dist}/docker/docker-entrypoint.sh | 28 ++----------------- 8 files changed, 33 insertions(+), 101 deletions(-) diff --git a/README.md b/README.md index 61930248a..cf64cd674 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ achieved through [Gremlin](https://tinkerpop.apache.org/gremlin.html)(a powerful We can use `docker run -itd --name=graph -p 8080:8080 hugegraph/hugegraph` to quickly start an inner HugeGraph server with `RocksDB` (in backgrounds) for **test/dev**. You can visit [doc page](https://hugegraph.apache.org/docs/quickstart/hugegraph-server/#3-deploy) or -the [README](hugegraph-server/hugegraph-dist/docker/READEME.md) for more details. ([Docker Compose](./hugegraph-server/hugegraph-dist/docker/example)) +the [README](hugegraph-server/hugegraph-dist/docker/README.md) for more details. ([Docker Compose](./hugegraph-server/hugegraph-dist/docker/example)) > Note: > diff --git a/hugegraph-server/Dockerfile b/hugegraph-pd/Dockerfile similarity index 63% copy from hugegraph-server/Dockerfile copy to hugegraph-pd/Dockerfile index 8eef58c5f..e1b2b1282 100644 --- a/hugegraph-server/Dockerfile +++ b/hugegraph-pd/Dockerfile @@ -15,29 +15,22 @@ # 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 +# Dockerfile for HugeGraph PD +# 1st stage: build source code (refer to hugegraph-server/Dockerfile) # 2nd stage: runtime env -# Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java > 13 +# 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-incubating-*/ /hugegraph-server/ +COPY --from=build /pkg/hugegraph-pd/dist/hugegraph-pd-*/ /hugegraph-pd/ 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" + HUGEGRAPH_HOME="hugegraph-pd" -#COPY . /hugegraph/hugegraph-server -WORKDIR /hugegraph-server/ +#COPY . /hugegraph/hugegraph-pd +WORKDIR /hugegraph-pd/ # 1. Install environment and init HugeGraph Sever RUN set -x \ @@ -52,16 +45,13 @@ RUN set -x \ && 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 + && pwd && cd /hugegraph-pd/ # 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 +COPY hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh . +RUN chmod 755 ./docker-entrypoint.sh -EXPOSE 8080 +EXPOSE 8620 VOLUME /hugegraph-server ENTRYPOINT ["/usr/bin/dumb-init", "--"] diff --git a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh similarity index 50% copy from hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh copy to hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh index efd6a4f8e..fd894d551 100644 --- a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh +++ b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh @@ -16,31 +16,7 @@ # limitations under the License. # -# create a folder to save the docker-related file -DOCKER_FOLDER='./docker' -mkdir -p $DOCKER_FOLDER - -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 "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 - # create a flag file to avoid re-init when restarting - touch ${DOCKER_FOLDER}/${INIT_FLAG_FILE} -else - echo "Hugegraph Initialization already done. Skipping re-init..." -fi - -# start hugegraph -# remove "-g zgc" now, which is only available on ARM-Mac with java > 13 -./bin/start-hugegraph.sh -j "$JAVA_OPTS" +# start hugegraph pd +./bin/start-hugegraph-pd.sh -j "$JAVA_OPTS" tail -f /dev/null diff --git a/hugegraph-server/Dockerfile b/hugegraph-server/Dockerfile index 8eef58c5f..ed6f3c40b 100644 --- a/hugegraph-server/Dockerfile +++ b/hugegraph-server/Dockerfile @@ -34,7 +34,7 @@ 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" + HUGEGRAPH_HOME="hugegraph-server" #COPY . /hugegraph/hugegraph-server WORKDIR /hugegraph-server/ @@ -59,7 +59,7 @@ RUN set -x \ 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 +RUN chmod 755 ./docker-entrypoint.sh EXPOSE 8080 VOLUME /hugegraph-server diff --git a/hugegraph-server/hugegraph-dist/docker/README.md b/hugegraph-server/hugegraph-dist/docker/README.md index b9547d498..00cf3d638 100644 --- a/hugegraph-server/hugegraph-dist/docker/README.md +++ b/hugegraph-server/hugegraph-dist/docker/README.md @@ -4,7 +4,7 @@ > > 1. The docker image of hugegraph is a convenience release, not official > distribution artifacts from ASF. You can find more details from [ASF Release > Distribution > Policy](https://infra.apache.org/release-distribution.html#dockerhub). > -> 2. Recommend to use `release tag`(like `1.2.0`) for the stable version. Use `latest` tag to experience the newest functions in development. +> 2. Recommend to use `release tag` (like `1.3.0`) for the stable version. Use `latest` tag to experience the newest functions in development. ## 1. Deploy @@ -35,7 +35,7 @@ If you want to customize the preloaded data, please mount the groovy scripts (no 1. Using docker run - Use `docker run -itd --name=graph -p 8080:8080 -e PRELOAD=true -v /path/to/yourScript:/hugegraph/scripts/example.groovy hugegraph/hugegraph` + Use `docker run -itd --name=graph -p 8080:8080 -e PRELOAD=true -v /absolute/path/to/your/script:/hugegraph-server/scripts/example.groovy hugegraph/hugegraph` to start hugegraph server. 2. Using docker compose @@ -50,7 +50,7 @@ If you want to customize the preloaded data, please mount the groovy scripts (no environment: - PRELOAD=true volumes: - - /path/to/yourscript:/hugegraph/scripts/example.groovy + - /absolute/path/to/your/script:/hugegraph-server/scripts/example.groovy ports: - 8080:8080 ``` diff --git a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh b/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh index efd6a4f8e..60cd4bc16 100644 --- a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh +++ b/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh @@ -39,7 +39,7 @@ else echo "Hugegraph Initialization already done. Skipping re-init..." fi -# start hugegraph +# start hugegraph-server # remove "-g zgc" now, which is only available on ARM-Mac with java > 13 ./bin/start-hugegraph.sh -j "$JAVA_OPTS" diff --git a/hugegraph-server/Dockerfile b/hugegraph-store/Dockerfile similarity index 63% copy from hugegraph-server/Dockerfile copy to hugegraph-store/Dockerfile index 8eef58c5f..0e7a33396 100644 --- a/hugegraph-server/Dockerfile +++ b/hugegraph-store/Dockerfile @@ -15,29 +15,22 @@ # 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 +# Dockerfile for HugeGraph Store +# 1st stage: build source code (refer to hugegraph-server/Dockerfile) # 2nd stage: runtime env -# Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java > 13 +# 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-incubating-*/ /hugegraph-server/ +COPY --from=build /pkg/hugegraph-store/dist/hugegraph-store-*/ /hugegraph-store/ 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" + HUGEGRAPH_HOME="hugegraph-store" -#COPY . /hugegraph/hugegraph-server -WORKDIR /hugegraph-server/ +#COPY . /hugegraph/hugegraph-store +WORKDIR /hugegraph-store/ # 1. Install environment and init HugeGraph Sever RUN set -x \ @@ -52,16 +45,13 @@ RUN set -x \ && 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 + && pwd && cd /hugegraph-store/ # 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 +COPY hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh . +RUN chmod 755 ./docker-entrypoint.sh -EXPOSE 8080 +EXPOSE 8620 VOLUME /hugegraph-server ENTRYPOINT ["/usr/bin/dumb-init", "--"] diff --git a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh b/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh similarity index 50% copy from hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh copy to hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh index efd6a4f8e..5aa77621d 100644 --- a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh +++ b/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh @@ -16,31 +16,7 @@ # limitations under the License. # -# create a folder to save the docker-related file -DOCKER_FOLDER='./docker' -mkdir -p $DOCKER_FOLDER - -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 "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 - # create a flag file to avoid re-init when restarting - touch ${DOCKER_FOLDER}/${INIT_FLAG_FILE} -else - echo "Hugegraph Initialization already done. Skipping re-init..." -fi - -# start hugegraph -# remove "-g zgc" now, which is only available on ARM-Mac with java > 13 -./bin/start-hugegraph.sh -j "$JAVA_OPTS" +# start hugegraph store +./bin/start-hugegraph-store.sh -j "$JAVA_OPTS" tail -f /dev/null
