From 882f3b7d6553138fc751daffbfa857fc9136c2b1 Mon Sep 17 00:00:00 2001 From: V_Galaxy Date: Mon, 15 Jul 2024 11:12:25 +0800 Subject: [PATCH] feat(dist): support docker deployment for PD and Store (#2573) Co-authored-by: imbajin --- .github/PULL_REQUEST_TEMPLATE.md | 4 +- .github/workflows/stale.yml | 2 +- BUILDING.md | 37 ++-- CONTRIBUTING.md | 24 +-- README.md | 2 +- docker/configs/application-pd0.yml | 63 ++++++ docker/configs/application-pd1.yml | 63 ++++++ docker/configs/application-pd2.yml | 63 ++++++ docker/configs/application-store0.yml | 57 ++++++ docker/configs/application-store1.yml | 57 ++++++ docker/configs/application-store2.yml | 57 ++++++ .../server1-conf/graphs/hugegraph.properties | 19 ++ .../server1-conf/gremlin-driver-settings.yaml | 25 +++ .../configs/server1-conf/gremlin-server.yaml | 127 ++++++++++++ docker/configs/server1-conf/log4j2.xml | 144 ++++++++++++++ .../configs/server1-conf/remote-objects.yaml | 30 +++ docker/configs/server1-conf/remote.yaml | 25 +++ .../server1-conf/rest-server.properties | 28 +++ .../server2-conf/graphs/hugegraph.properties | 19 ++ .../server2-conf/gremlin-driver-settings.yaml | 25 +++ .../configs/server2-conf/gremlin-server.yaml | 127 ++++++++++++ docker/configs/server2-conf/log4j2.xml | 144 ++++++++++++++ .../configs/server2-conf/remote-objects.yaml | 30 +++ docker/configs/server2-conf/remote.yaml | 25 +++ .../server2-conf/rest-server.properties | 26 +++ .../server3-conf/graphs/hugegraph.properties | 19 ++ .../server3-conf/gremlin-driver-settings.yaml | 25 +++ .../configs/server3-conf/gremlin-server.yaml | 127 ++++++++++++ docker/configs/server3-conf/log4j2.xml | 144 ++++++++++++++ .../configs/server3-conf/remote-objects.yaml | 30 +++ docker/configs/server3-conf/remote.yaml | 25 +++ .../server3-conf/rest-server.properties | 25 +++ docker/docker-compose-3pd-3store-3server.yml | 180 ++++++++++++++++++ docker/docker-compose.yml | 58 ++++++ hugegraph-pd/Dockerfile | 66 +++++++ .../hg-pd-dist/docker/docker-entrypoint.sh | 22 +++ hugegraph-server/Dockerfile | 7 +- .../hugegraph-dist/docker/README.md | 6 +- .../docker/docker-entrypoint.sh | 2 +- hugegraph-store/Dockerfile | 66 +++++++ .../hg-store-dist/docker/docker-entrypoint.sh | 22 +++ 41 files changed, 2005 insertions(+), 42 deletions(-) create mode 100644 docker/configs/application-pd0.yml create mode 100644 docker/configs/application-pd1.yml create mode 100644 docker/configs/application-pd2.yml create mode 100644 docker/configs/application-store0.yml create mode 100644 docker/configs/application-store1.yml create mode 100644 docker/configs/application-store2.yml create mode 100644 docker/configs/server1-conf/graphs/hugegraph.properties create mode 100644 docker/configs/server1-conf/gremlin-driver-settings.yaml create mode 100644 docker/configs/server1-conf/gremlin-server.yaml create mode 100644 docker/configs/server1-conf/log4j2.xml create mode 100644 docker/configs/server1-conf/remote-objects.yaml create mode 100644 docker/configs/server1-conf/remote.yaml create mode 100644 docker/configs/server1-conf/rest-server.properties create mode 100644 docker/configs/server2-conf/graphs/hugegraph.properties create mode 100644 docker/configs/server2-conf/gremlin-driver-settings.yaml create mode 100644 docker/configs/server2-conf/gremlin-server.yaml create mode 100644 docker/configs/server2-conf/log4j2.xml create mode 100644 docker/configs/server2-conf/remote-objects.yaml create mode 100644 docker/configs/server2-conf/remote.yaml create mode 100644 docker/configs/server2-conf/rest-server.properties create mode 100644 docker/configs/server3-conf/graphs/hugegraph.properties create mode 100644 docker/configs/server3-conf/gremlin-driver-settings.yaml create mode 100644 docker/configs/server3-conf/gremlin-server.yaml create mode 100644 docker/configs/server3-conf/log4j2.xml create mode 100644 docker/configs/server3-conf/remote-objects.yaml create mode 100644 docker/configs/server3-conf/remote.yaml create mode 100644 docker/configs/server3-conf/rest-server.properties create mode 100644 docker/docker-compose-3pd-3store-3server.yml create mode 100644 docker/docker-compose.yml create mode 100644 hugegraph-pd/Dockerfile create mode 100644 hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh create mode 100644 hugegraph-store/Dockerfile create mode 100644 hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c71e5e4a6a..fbc6994ee3 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -19,7 +19,7 @@ published) ## Purpose of the PR -- close #xxx +- close #xxx + + + + logs + hugegraph-server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docker/configs/server1-conf/remote-objects.yaml b/docker/configs/server1-conf/remote-objects.yaml new file mode 100644 index 0000000000..94ebc99190 --- /dev/null +++ b/docker/configs/server1-conf/remote-objects.yaml @@ -0,0 +1,30 @@ +# +# 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. +# +hosts: [localhost] +port: 8181 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + # The duplication of HugeGraphIoRegistry is meant to fix a bug in the + # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. + ioRegistries: [ + org.apache.hugegraph.io.HugeGraphIoRegistry, + org.apache.hugegraph.io.HugeGraphIoRegistry + ] + } +} diff --git a/docker/configs/server1-conf/remote.yaml b/docker/configs/server1-conf/remote.yaml new file mode 100644 index 0000000000..2f60ff8379 --- /dev/null +++ b/docker/configs/server1-conf/remote.yaml @@ -0,0 +1,25 @@ +# +# 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. +# +hosts: [localhost] +port: 8181 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/docker/configs/server1-conf/rest-server.properties b/docker/configs/server1-conf/rest-server.properties new file mode 100644 index 0000000000..6e2257ce97 --- /dev/null +++ b/docker/configs/server1-conf/rest-server.properties @@ -0,0 +1,28 @@ +# bind url +restserver.url=http://127.0.0.1:8081 +# gremlin server url, need to be consistent with host and port in gremlin-server.yaml +gremlinserver.url=http://127.0.0.1:8181 + +graphs=./conf/graphs + +# configuration of arthas +arthas.telnet_port=8562 +arthas.http_port=8561 +arthas.ip=127.0.0.1 +arthas.disabled_commands=jad + +# authentication configs +# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or +# 'org.apache.hugegraph.auth.ConfigAuthenticator' +#auth.authenticator= + +# rpc server configs for multi graph-servers or raft-servers +rpc.server_host=127.0.0.1 +rpc.server_port=8091 + +# lightweight load balancing (beta) +server.id=server-1 +server.role=master + +# slow query log +log.slow_query_threshold=1000 diff --git a/docker/configs/server2-conf/graphs/hugegraph.properties b/docker/configs/server2-conf/graphs/hugegraph.properties new file mode 100644 index 0000000000..66cbccb731 --- /dev/null +++ b/docker/configs/server2-conf/graphs/hugegraph.properties @@ -0,0 +1,19 @@ +# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy +gremlin.graph=org.apache.hugegraph.HugeFactory + +# cache config +vertex.cache_type=l2 +edge.cache_type=l2 + +store=hugegraph +backend=hstore +serializer=binary + +# pd config +pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 + +# task config +task.scheduler_type=local +task.schedule_period=10 +task.retry=0 +task.wait_timeout=10 diff --git a/docker/configs/server2-conf/gremlin-driver-settings.yaml b/docker/configs/server2-conf/gremlin-driver-settings.yaml new file mode 100644 index 0000000000..55f38ab97d --- /dev/null +++ b/docker/configs/server2-conf/gremlin-driver-settings.yaml @@ -0,0 +1,25 @@ +# +# 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. +# +hosts: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/docker/configs/server2-conf/gremlin-server.yaml b/docker/configs/server2-conf/gremlin-server.yaml new file mode 100644 index 0000000000..048dded559 --- /dev/null +++ b/docker/configs/server2-conf/gremlin-server.yaml @@ -0,0 +1,127 @@ +# +# 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. +# +# host and port of gremlin server, need to be consistent with host and port in rest-server.properties +host: 127.0.0.1 +port: 8182 + +# timeout in ms of gremlin query +evaluationTimeout: 30000 + +channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer +# don't set graph at here, this happens after support for dynamically adding graph +graphs: { +} +scriptEngines: { + gremlin-groovy: { + staticImports: [ + org.opencypher.gremlin.process.traversal.CustomPredicates.*', + org.opencypher.gremlin.traversal.CustomFunctions.* + ], + plugins: { + org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { + classImports: [ + java.lang.Math, + org.apache.hugegraph.backend.id.IdGenerator, + org.apache.hugegraph.type.define.Directions, + org.apache.hugegraph.type.define.NodeRole, + org.apache.hugegraph.masterelection.GlobalMasterInfo, + org.apache.hugegraph.util.DateUtil, + org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, + org.apache.hugegraph.traversal.algorithm.CountTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser, + org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser, + org.apache.hugegraph.traversal.algorithm.HugeTraverser, + org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser, + org.apache.hugegraph.traversal.algorithm.KneighborTraverser, + org.apache.hugegraph.traversal.algorithm.KoutTraverser, + org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser, + org.apache.hugegraph.traversal.algorithm.PathsTraverser, + org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser, + org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser, + org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SubGraphTraverser, + org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser, + org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, + org.apache.hugegraph.traversal.optimize.ConditionP, + org.apache.hugegraph.traversal.optimize.Text, + org.apache.hugegraph.traversal.optimize.TraversalUtil, + org.opencypher.gremlin.traversal.CustomFunctions, + org.opencypher.gremlin.traversal.CustomPredicate + ], + methodImports: [ + java.lang.Math#*, + org.opencypher.gremlin.traversal.CustomPredicate#*, + org.opencypher.gremlin.traversal.CustomFunctions#* + ] + }, + org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { + files: [scripts/empty-sample.groovy] + } + } + } +} +serializers: + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } +metrics: { + consoleReporter: {enabled: false, interval: 180000}, + csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv}, + jmxReporter: {enabled: false}, + slf4jReporter: {enabled: false, interval: 180000}, + gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, + graphiteReporter: {enabled: false, interval: 180000} +} +maxInitialLineLength: 4096 +maxHeaderSize: 8192 +maxChunkSize: 8192 +maxContentLength: 65536 +maxAccumulationBufferComponents: 1024 +resultIterationBatchSize: 64 +writeBufferLowWaterMark: 32768 +writeBufferHighWaterMark: 65536 +ssl: { + enabled: false +} diff --git a/docker/configs/server2-conf/log4j2.xml b/docker/configs/server2-conf/log4j2.xml new file mode 100644 index 0000000000..f1dd7e8395 --- /dev/null +++ b/docker/configs/server2-conf/log4j2.xml @@ -0,0 +1,144 @@ + + + + + + logs + hugegraph-server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docker/configs/server2-conf/remote-objects.yaml b/docker/configs/server2-conf/remote-objects.yaml new file mode 100644 index 0000000000..39679d8c30 --- /dev/null +++ b/docker/configs/server2-conf/remote-objects.yaml @@ -0,0 +1,30 @@ +# +# 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. +# +hosts: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + # The duplication of HugeGraphIoRegistry is meant to fix a bug in the + # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. + ioRegistries: [ + org.apache.hugegraph.io.HugeGraphIoRegistry, + org.apache.hugegraph.io.HugeGraphIoRegistry + ] + } +} diff --git a/docker/configs/server2-conf/remote.yaml b/docker/configs/server2-conf/remote.yaml new file mode 100644 index 0000000000..55f38ab97d --- /dev/null +++ b/docker/configs/server2-conf/remote.yaml @@ -0,0 +1,25 @@ +# +# 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. +# +hosts: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/docker/configs/server2-conf/rest-server.properties b/docker/configs/server2-conf/rest-server.properties new file mode 100644 index 0000000000..e55fb6b635 --- /dev/null +++ b/docker/configs/server2-conf/rest-server.properties @@ -0,0 +1,26 @@ +# bind url +restserver.url=http://127.0.0.1:8082 +# gremlin server url, need to be consistent with host and port in gremlin-server.yaml +gremlinserver.url=http://127.0.0.1:8182 + +graphs=./conf/graphs + +# configuration of arthas +arthas.telnet_port=8572 +arthas.http_port=8571 +arthas.ip=127.0.0.1 +arthas.disabled_commands=jad + +# authentication configs +# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or +# 'org.apache.hugegraph.auth.ConfigAuthenticator' +#auth.authenticator= + +# rpc server configs for multi graph-servers or raft-servers +rpc.server_host=127.0.0.1 +rpc.server_port=8092 +#rpc.server_timeout=30 + +# lightweight load balancing (beta) +server.id=server-2 +server.role=worker diff --git a/docker/configs/server3-conf/graphs/hugegraph.properties b/docker/configs/server3-conf/graphs/hugegraph.properties new file mode 100644 index 0000000000..66cbccb731 --- /dev/null +++ b/docker/configs/server3-conf/graphs/hugegraph.properties @@ -0,0 +1,19 @@ +# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy +gremlin.graph=org.apache.hugegraph.HugeFactory + +# cache config +vertex.cache_type=l2 +edge.cache_type=l2 + +store=hugegraph +backend=hstore +serializer=binary + +# pd config +pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 + +# task config +task.scheduler_type=local +task.schedule_period=10 +task.retry=0 +task.wait_timeout=10 diff --git a/docker/configs/server3-conf/gremlin-driver-settings.yaml b/docker/configs/server3-conf/gremlin-driver-settings.yaml new file mode 100644 index 0000000000..00ef046699 --- /dev/null +++ b/docker/configs/server3-conf/gremlin-driver-settings.yaml @@ -0,0 +1,25 @@ +# +# 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. +# +hosts: [localhost] +port: 8183 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/docker/configs/server3-conf/gremlin-server.yaml b/docker/configs/server3-conf/gremlin-server.yaml new file mode 100644 index 0000000000..e153926bc9 --- /dev/null +++ b/docker/configs/server3-conf/gremlin-server.yaml @@ -0,0 +1,127 @@ +# +# 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. +# +# host and port of gremlin server, need to be consistent with host and port in rest-server.properties +host: 127.0.0.1 +port: 8183 + +# timeout in ms of gremlin query +evaluationTimeout: 30000 + +channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer +# don't set graph at here, this happens after support for dynamically adding graph +graphs: { +} +scriptEngines: { + gremlin-groovy: { + staticImports: [ + org.opencypher.gremlin.process.traversal.CustomPredicates.*', + org.opencypher.gremlin.traversal.CustomFunctions.* + ], + plugins: { + org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { + classImports: [ + java.lang.Math, + org.apache.hugegraph.backend.id.IdGenerator, + org.apache.hugegraph.type.define.Directions, + org.apache.hugegraph.type.define.NodeRole, + org.apache.hugegraph.masterelection.GlobalMasterInfo, + org.apache.hugegraph.util.DateUtil, + org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, + org.apache.hugegraph.traversal.algorithm.CountTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser, + org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser, + org.apache.hugegraph.traversal.algorithm.HugeTraverser, + org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser, + org.apache.hugegraph.traversal.algorithm.KneighborTraverser, + org.apache.hugegraph.traversal.algorithm.KoutTraverser, + org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser, + org.apache.hugegraph.traversal.algorithm.PathsTraverser, + org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser, + org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser, + org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SubGraphTraverser, + org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser, + org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, + org.apache.hugegraph.traversal.optimize.ConditionP, + org.apache.hugegraph.traversal.optimize.Text, + org.apache.hugegraph.traversal.optimize.TraversalUtil, + org.opencypher.gremlin.traversal.CustomFunctions, + org.opencypher.gremlin.traversal.CustomPredicate + ], + methodImports: [ + java.lang.Math#*, + org.opencypher.gremlin.traversal.CustomPredicate#*, + org.opencypher.gremlin.traversal.CustomFunctions#* + ] + }, + org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { + files: [scripts/empty-sample.groovy] + } + } + } +} +serializers: + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } +metrics: { + consoleReporter: {enabled: false, interval: 180000}, + csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv}, + jmxReporter: {enabled: false}, + slf4jReporter: {enabled: false, interval: 180000}, + gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, + graphiteReporter: {enabled: false, interval: 180000} +} +maxInitialLineLength: 4096 +maxHeaderSize: 8192 +maxChunkSize: 8192 +maxContentLength: 65536 +maxAccumulationBufferComponents: 1024 +resultIterationBatchSize: 64 +writeBufferLowWaterMark: 32768 +writeBufferHighWaterMark: 65536 +ssl: { + enabled: false +} diff --git a/docker/configs/server3-conf/log4j2.xml b/docker/configs/server3-conf/log4j2.xml new file mode 100644 index 0000000000..f1dd7e8395 --- /dev/null +++ b/docker/configs/server3-conf/log4j2.xml @@ -0,0 +1,144 @@ + + + + + + logs + hugegraph-server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docker/configs/server3-conf/remote-objects.yaml b/docker/configs/server3-conf/remote-objects.yaml new file mode 100644 index 0000000000..ce99fcb2f6 --- /dev/null +++ b/docker/configs/server3-conf/remote-objects.yaml @@ -0,0 +1,30 @@ +# +# 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. +# +hosts: [localhost] +port: 8183 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + # The duplication of HugeGraphIoRegistry is meant to fix a bug in the + # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. + ioRegistries: [ + org.apache.hugegraph.io.HugeGraphIoRegistry, + org.apache.hugegraph.io.HugeGraphIoRegistry + ] + } +} diff --git a/docker/configs/server3-conf/remote.yaml b/docker/configs/server3-conf/remote.yaml new file mode 100644 index 0000000000..00ef046699 --- /dev/null +++ b/docker/configs/server3-conf/remote.yaml @@ -0,0 +1,25 @@ +# +# 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. +# +hosts: [localhost] +port: 8183 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/docker/configs/server3-conf/rest-server.properties b/docker/configs/server3-conf/rest-server.properties new file mode 100644 index 0000000000..af1d7301db --- /dev/null +++ b/docker/configs/server3-conf/rest-server.properties @@ -0,0 +1,25 @@ +# bind url +restserver.url=http://127.0.0.1:8083 +# gremlin server url, need to be consistent with host and port in gremlin-server.yaml +gremlinserver.url=http://127.0.0.1:8183 + +graphs=./conf/graphs + +# configuration of arthas +arthas.telnet_port=8582 +arthas.http_port=8581 +arthas.ip=127.0.0.1 +arthas.disabled_commands=jad + +# authentication configs +# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or +# 'org.apache.hugegraph.auth.ConfigAuthenticator' +#auth.authenticator= + +# rpc server configs for multi graph-servers or raft-servers +rpc.server_host=127.0.0.1 +rpc.server_port=8093 + +# lightweight load balancing (beta) +server.id=server-3 +server.role=worker diff --git a/docker/docker-compose-3pd-3store-3server.yml b/docker/docker-compose-3pd-3store-3server.yml new file mode 100644 index 0000000000..f704c1c0f6 --- /dev/null +++ b/docker/docker-compose-3pd-3store-3server.yml @@ -0,0 +1,180 @@ +# +# 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. +# + +# TODO: reuse the configs for same type containers +# User could modify the node nums and the port by themselves +version: "3" + +services: + pd0: + image: hugegraph/pd + container_name: pd0 + hostname: pd0 + network_mode: host + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8620"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/application-pd0.yml:/hugegraph-pd/conf/application.yml + + pd1: + image: hugegraph/pd + container_name: pd1 + hostname: pd1 + network_mode: host + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8621"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/application-pd1.yml:/hugegraph-pd/conf/application.yml + + pd2: + image: hugegraph/pd + container_name: pd2 + hostname: pd2 + network_mode: host + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8622"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/application-pd2.yml:/hugegraph-pd/conf/application.yml + + store0: + image: hugegraph/store + container_name: store0 + hostname: store0 + network_mode: host + depends_on: + pd0: + condition: service_healthy + pd1: + condition: service_healthy + pd2: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8520"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/application-store0.yml:/hugegraph-store/conf/application.yml + + store1: + image: hugegraph/store + container_name: store1 + hostname: store1 + network_mode: host + depends_on: + pd0: + condition: service_healthy + pd1: + condition: service_healthy + pd2: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8521"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/application-store1.yml:/hugegraph-store/conf/application.yml + + store2: + image: hugegraph/store + container_name: store2 + hostname: store2 + network_mode: host + depends_on: + pd0: + condition: service_healthy + pd1: + condition: service_healthy + pd2: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8522"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/application-store2.yml:/hugegraph-store/conf/application.yml + + server1: + image: hugegraph/server + container_name: server1 + hostname: server1 + network_mode: host + depends_on: + store0: + condition: service_healthy + store1: + condition: service_healthy + store2: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8081"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/server1-conf:/hugegraph-server/conf + + server2: + image: hugegraph/server + container_name: server2 + hostname: server2 + network_mode: host + depends_on: + store0: + condition: service_healthy + store1: + condition: service_healthy + store2: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8082"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/server2-conf:/hugegraph-server/conf + + server3: + image: hugegraph/server + container_name: server3 + hostname: server3 + network_mode: host + depends_on: + store0: + condition: service_healthy + store1: + condition: service_healthy + store2: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8083"] + interval: 10s + timeout: 5s + retries: 3 + volumes: + - ./configs/server3-conf:/hugegraph-server/conf diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000000..0c90c1e451 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,58 @@ +# +# 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. +# + +version: "3" + +services: + pd: + image: hugegraph/pd + container_name: pd + hostname: pd + network_mode: host + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8620"] + interval: 10s + timeout: 5s + retries: 3 + + store: + image: hugegraph/store + container_name: store + hostname: store + network_mode: host + depends_on: + pd: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8520"] + interval: 10s + timeout: 5s + retries: 3 + + server: + image: hugegraph/server + container_name: server + hostname: server + network_mode: host + depends_on: + store: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080"] + interval: 10s + timeout: 5s + retries: 3 diff --git a/hugegraph-pd/Dockerfile b/hugegraph-pd/Dockerfile new file mode 100644 index 0000000000..b9cdb2209e --- /dev/null +++ b/hugegraph-pd/Dockerfile @@ -0,0 +1,66 @@ +# +# 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 PD +# 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/dist/*.tar.gz && rm ./hugegraph-store/dist/*.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-pd/dist/hugegraph-pd-*/ /hugegraph-pd/ +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" + +#COPY . /hugegraph/hugegraph-pd +WORKDIR /hugegraph-pd/ + +# 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-pd/ + +# 2. Init docker script +COPY hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh . +RUN chmod 755 ./docker-entrypoint.sh + +EXPOSE 8620 +VOLUME /hugegraph-pd + +ENTRYPOINT ["/usr/bin/dumb-init", "--"] +CMD ["./docker-entrypoint.sh"] diff --git a/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh new file mode 100644 index 0000000000..fd894d5518 --- /dev/null +++ b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# 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. +# + +# 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 8eef58c5f7..deb31fe0a3 100644 --- a/hugegraph-server/Dockerfile +++ b/hugegraph-server/Dockerfile @@ -23,7 +23,8 @@ 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 +RUN mvn package $MAVEN_ARGS -e -B -ntp -DskipTests -Dmaven.javadoc.skip=true && pwd && ls -l && rm \ + ./hugegraph-server/*.tar.gz && rm ./hugegraph-pd/dist/*.tar.gz && rm ./hugegraph-store/dist/*.tar.gz # 2nd stage: runtime env # Note: ZGC (The Z Garbage Collector) is only supported on ARM-Mac with java > 13 @@ -34,7 +35,7 @@ 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" + HUGEGRAPH_HOME="hugegraph-server" #COPY . /hugegraph/hugegraph-server WORKDIR /hugegraph-server/ @@ -59,7 +60,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 b9547d4982..69df6b43ce 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 /path/to/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 + - /path/to/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 efd6a4f8e5..60cd4bc163 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-store/Dockerfile b/hugegraph-store/Dockerfile new file mode 100644 index 0000000000..2fa9e3fc00 --- /dev/null +++ b/hugegraph-store/Dockerfile @@ -0,0 +1,66 @@ +# +# 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 Store +# 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/dist/*.tar.gz && rm ./hugegraph-store/dist/*.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-store/dist/hugegraph-store-*/ /hugegraph-store/ +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" + +#COPY . /hugegraph/hugegraph-store +WORKDIR /hugegraph-store/ + +# 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-store/ + +# 2. Init docker script +COPY hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh . +RUN chmod 755 ./docker-entrypoint.sh + +EXPOSE 8520 +VOLUME /hugegraph-store + +ENTRYPOINT ["/usr/bin/dumb-init", "--"] +CMD ["./docker-entrypoint.sh"] diff --git a/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh b/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh new file mode 100644 index 0000000000..5aa77621dc --- /dev/null +++ b/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# 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. +# + +# start hugegraph store +./bin/start-hugegraph-store.sh -j "$JAVA_OPTS" + +tail -f /dev/null