diff --git a/docker/docker-compose-3pd-3store-3server.yml b/docker/docker-compose-3pd-3store-3server.yml index fc7930351b..3565542df7 100644 --- a/docker/docker-compose-3pd-3store-3server.yml +++ b/docker/docker-compose-3pd-3store-3server.yml @@ -71,6 +71,7 @@ x-server-common: &server-common STORE_REST: store0:8520 HG_SERVER_BACKEND: hstore HG_SERVER_PD_PEERS: pd0:8686,pd1:8686,pd2:8686 + STDOUT_MODE: "true" healthcheck: test: ["CMD-SHELL", "curl -fsS http://localhost:8080/versions >/dev/null || exit 1"] interval: 10s @@ -96,6 +97,7 @@ services: HG_PD_INITIAL_STORE_LIST: store0:8500,store1:8500,store2:8500 HG_PD_DATA_PATH: /hugegraph-pd/pd_data HG_PD_INITIAL_STORE_COUNT: 3 + STDOUT_MODE: "true" ports: ["8620:8620", "8686:8686"] volumes: - hg-pd0-data:/hugegraph-pd/pd_data @@ -114,6 +116,7 @@ services: HG_PD_INITIAL_STORE_LIST: store0:8500,store1:8500,store2:8500 HG_PD_DATA_PATH: /hugegraph-pd/pd_data HG_PD_INITIAL_STORE_COUNT: 3 + STDOUT_MODE: "true" ports: ["8621:8620", "8687:8686"] volumes: - hg-pd1-data:/hugegraph-pd/pd_data @@ -132,6 +135,7 @@ services: HG_PD_INITIAL_STORE_LIST: store0:8500,store1:8500,store2:8500 HG_PD_DATA_PATH: /hugegraph-pd/pd_data HG_PD_INITIAL_STORE_COUNT: 3 + STDOUT_MODE: "true" ports: ["8622:8620", "8688:8686"] volumes: - hg-pd2-data:/hugegraph-pd/pd_data @@ -148,6 +152,7 @@ services: HG_STORE_REST_PORT: "8520" HG_STORE_RAFT_ADDRESS: store0:8510 HG_STORE_DATA_PATH: /hugegraph-store/storage + STDOUT_MODE: "true" ports: ["8500:8500", "8510:8510", "8520:8520"] volumes: - hg-store0-data:/hugegraph-store/storage @@ -163,6 +168,7 @@ services: HG_STORE_REST_PORT: "8520" HG_STORE_RAFT_ADDRESS: store1:8510 HG_STORE_DATA_PATH: /hugegraph-store/storage + STDOUT_MODE: "true" ports: ["8501:8500", "8511:8510", "8521:8520"] volumes: - hg-store1-data:/hugegraph-store/storage @@ -178,6 +184,7 @@ services: HG_STORE_REST_PORT: "8520" HG_STORE_RAFT_ADDRESS: store2:8510 HG_STORE_DATA_PATH: /hugegraph-store/storage + STDOUT_MODE: "true" ports: ["8502:8500", "8512:8510", "8522:8520"] volumes: - hg-store2-data:/hugegraph-store/storage diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml index aa0736a38b..221f6288d9 100644 --- a/docker/docker-compose.dev.yml +++ b/docker/docker-compose.dev.yml @@ -42,6 +42,7 @@ services: HG_PD_RAFT_PEERS_LIST: pd:8610 HG_PD_INITIAL_STORE_LIST: store:8500 HG_PD_DATA_PATH: /hugegraph-pd/pd_data + STDOUT_MODE: "true" ports: - "8620:8620" volumes: @@ -71,6 +72,7 @@ services: HG_STORE_REST_PORT: "8520" HG_STORE_RAFT_ADDRESS: store:8510 HG_STORE_DATA_PATH: /hugegraph-store/storage + STDOUT_MODE: "true" ports: - "8520:8520" volumes: @@ -96,6 +98,7 @@ services: environment: HG_SERVER_BACKEND: hstore HG_SERVER_PD_PEERS: pd:8686 + STDOUT_MODE: "true" ports: - "8080:8080" healthcheck: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 953c438f58..88ec809bfc 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -41,6 +41,7 @@ services: HG_PD_RAFT_PEERS_LIST: pd:8610 HG_PD_INITIAL_STORE_LIST: store:8500 HG_PD_DATA_PATH: /hugegraph-pd/pd_data + STDOUT_MODE: "true" ports: - "8620:8620" volumes: @@ -69,6 +70,7 @@ services: HG_STORE_REST_PORT: "8520" HG_STORE_RAFT_ADDRESS: store:8510 HG_STORE_DATA_PATH: /hugegraph-store/storage + STDOUT_MODE: "true" ports: - "8520:8520" volumes: @@ -93,6 +95,7 @@ services: environment: HG_SERVER_BACKEND: hstore HG_SERVER_PD_PEERS: pd:8686 + STDOUT_MODE: "true" ports: - "8080:8080" healthcheck: diff --git a/hugegraph-pd/Dockerfile b/hugegraph-pd/Dockerfile index 812e05e7d9..3c00093925 100644 --- a/hugegraph-pd/Dockerfile +++ b/hugegraph-pd/Dockerfile @@ -35,7 +35,8 @@ LABEL maintainer="HugeGraph Docker Maintainers " # TODO: use g1gc or zgc as default ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:MaxRAMPercentage=50 -XshowSettings:vm" \ - HUGEGRAPH_HOME="hugegraph-pd" + HUGEGRAPH_HOME="hugegraph-pd" \ + STDOUT_MODE="true" #COPY . /hugegraph/hugegraph-pd WORKDIR /hugegraph-pd/ diff --git a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh index b5d5346f34..3bbdb1cf09 100755 --- a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh +++ b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh @@ -168,8 +168,13 @@ echo "Starting HugeGraphPDServer..." JVM_OPTIONS="-Dlog4j.configurationFile=${CONF}/log4j2.xml -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager" # Turn on security check -exec ${JAVA} -Dname="HugeGraphPD" ${JVM_OPTIONS} ${JAVA_OPTIONS} -jar \ - -Dspring.config.location=${CONF}/application.yml ${LIB}/hg-pd-service-*.jar >> ${OUTPUT} 2>&1 & +if [[ "${STDOUT_MODE:-false}" == "true" ]]; then + exec ${JAVA} -Dname="HugeGraphPD" ${JVM_OPTIONS} ${JAVA_OPTIONS} -jar \ + -Dspring.config.location=${CONF}/application.yml ${LIB}/hg-pd-service-*.jar & +else + exec ${JAVA} -Dname="HugeGraphPD" ${JVM_OPTIONS} ${JAVA_OPTIONS} -jar \ + -Dspring.config.location=${CONF}/application.yml ${LIB}/hg-pd-service-*.jar >> ${OUTPUT} 2>&1 & +fi PID="$!" # Write pid to file diff --git a/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml b/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml index a804948703..e0b5d9dc98 100644 --- a/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml +++ b/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml @@ -115,6 +115,7 @@ + diff --git a/hugegraph-server/Dockerfile b/hugegraph-server/Dockerfile index f7613f8485..be316b852d 100644 --- a/hugegraph-server/Dockerfile +++ b/hugegraph-server/Dockerfile @@ -36,7 +36,8 @@ LABEL maintainer="HugeGraph Docker Maintainers " # TODO: use g1gc or zgc as default # Note: --add-exports is required for Java 11+ to access jdk.internal.reflect for auth proxy ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:MaxRAMPercentage=50 -XshowSettings:vm --add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED" \ - HUGEGRAPH_HOME="hugegraph-server" + HUGEGRAPH_HOME="hugegraph-server" \ + STDOUT_MODE="true" #COPY . /hugegraph/hugegraph-server WORKDIR /hugegraph-server/ 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 857b9b5356..c5f84d4933 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 @@ -183,6 +183,11 @@ if [ "${OPEN_TELEMETRY}" == "true" ]; then fi # Turn on security check -exec ${JAVA} -Dname="HugeGraphServer" ${JVM_OPTIONS} ${JAVA_OPTIONS} -cp ${CLASSPATH}: \ - org.apache.hugegraph.dist.HugeGraphServer ${GREMLIN_SERVER_CONF} ${REST_SERVER_CONF} \ - >> ${OUTPUT} 2>&1 +if [[ "${STDOUT_MODE:-false}" == "true" ]]; then + exec ${JAVA} -Dname="HugeGraphServer" ${JVM_OPTIONS} ${JAVA_OPTIONS} -cp ${CLASSPATH}: \ + org.apache.hugegraph.dist.HugeGraphServer ${GREMLIN_SERVER_CONF} ${REST_SERVER_CONF} +else + exec ${JAVA} -Dname="HugeGraphServer" ${JVM_OPTIONS} ${JAVA_OPTIONS} -cp ${CLASSPATH}: \ + org.apache.hugegraph.dist.HugeGraphServer ${GREMLIN_SERVER_CONF} ${REST_SERVER_CONF} \ + >> ${LOGS}/hugegraph-server-stdout.log 2>&1 +fi diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh index 30c2764989..297ed47ca3 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh @@ -99,17 +99,14 @@ if [[ $PRELOAD == "true" ]]; then sed -i -e '/registerBackends/d; /serverStarted/d' "${SCRIPTS}/${EXAMPLE_SCRIPT}" fi -# TODO: show the output message in hugegraph-server.sh when start the server if [[ $DAEMON == "true" ]]; then echo "Starting HugeGraphServer in daemon mode..." "${BIN}"/hugegraph-server.sh "${CONF}/${GREMLIN_SERVER_CONF}" "${CONF}"/rest-server.properties \ - "${OPEN_SECURITY_CHECK}" "${USER_OPTION}" "${GC_OPTION}" "${OPEN_TELEMETRY}" \ - >>"${LOGS}"/hugegraph-server.log 2>&1 & + "${OPEN_SECURITY_CHECK}" "${USER_OPTION}" "${GC_OPTION}" "${OPEN_TELEMETRY}" & else echo "Starting HugeGraphServer in foreground mode..." "${BIN}"/hugegraph-server.sh "${CONF}/${GREMLIN_SERVER_CONF}" "${CONF}"/rest-server.properties \ - "${OPEN_SECURITY_CHECK}" "${USER_OPTION}" "${GC_OPTION}" "${OPEN_TELEMETRY}" \ - >>"${LOGS}"/hugegraph-server.log 2>&1 + "${OPEN_SECURITY_CHECK}" "${USER_OPTION}" "${GC_OPTION}" "${OPEN_TELEMETRY}" fi PID="$!" @@ -119,7 +116,11 @@ echo "$PID" > "$PID_FILE" trap 'kill $PID; exit' SIGHUP SIGINT SIGQUIT SIGTERM wait_for_startup ${PID} 'HugeGraphServer' "$REST_SERVER_URL/graphs" "${SERVER_STARTUP_TIMEOUT_S}" || { - echo "See $LOGS/hugegraph-server.log for HugeGraphServer log output." >&2 + if [[ "${STDOUT_MODE:-false}" == "true" ]]; then + echo "See 'docker logs' for HugeGraphServer log output." >&2 + else + echo "See $LOGS/hugegraph-server.log for HugeGraphServer log output." >&2 + fi if [[ $DAEMON == "true" ]]; then exit 1 fi diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml index f1dd7e8395..cd2d9da569 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xml @@ -104,6 +104,7 @@ + @@ -129,6 +130,7 @@ + diff --git a/hugegraph-store/Dockerfile b/hugegraph-store/Dockerfile index e14a310338..902043fb55 100644 --- a/hugegraph-store/Dockerfile +++ b/hugegraph-store/Dockerfile @@ -35,7 +35,8 @@ LABEL maintainer="HugeGraph Docker Maintainers " # TODO: use g1gc or zgc as default ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:MaxRAMPercentage=50 -XshowSettings:vm" \ - HUGEGRAPH_HOME="hugegraph-store" + HUGEGRAPH_HOME="hugegraph-store" \ + STDOUT_MODE="true" #COPY . /hugegraph/hugegraph-store WORKDIR /hugegraph-store/ 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 d8b965a07d..17245e8b49 100755 --- 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 @@ -221,9 +221,16 @@ fi echo "Starting HG-StoreServer..." -exec ${JAVA} -Dname="HugeGraphStore" ${JVM_OPTIONS} ${JAVA_OPTIONS} -jar \ - -Dspring.config.location=${CONF}/application.yml \ - ${LIB}/hg-store-node-*.jar >> ${OUTPUT} 2>&1 & +# Turn on security check +if [[ "${STDOUT_MODE:-false}" == "true" ]]; then + exec ${JAVA} -Dname="HugeGraphStore" ${JVM_OPTIONS} ${JAVA_OPTIONS} -jar \ + -Dspring.config.location=${CONF}/application.yml \ + ${LIB}/hg-store-node-*.jar & +else + exec ${JAVA} -Dname="HugeGraphStore" ${JVM_OPTIONS} ${JAVA_OPTIONS} -jar \ + -Dspring.config.location=${CONF}/application.yml \ + ${LIB}/hg-store-node-*.jar >> ${OUTPUT} 2>&1 & +fi PID="$!" # Write pid to file diff --git a/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml b/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml index 388d09e2fd..f0cf11fc3d 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml +++ b/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml @@ -117,6 +117,7 @@ +