-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Dockerize gremlin-server.sh with JanusGraph #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,37 @@ To build with only the TinkerPop tests\*: | |
| mvn clean install -Dtest.skip.tp=false -DskipTests=true | ||
| ``` | ||
|
|
||
| ## Building Docker Image for JanusGraph Gremlin Server | ||
|
|
||
| To build and run Docker images with JanusGraph and Gremlin Server, configured | ||
| to run the BerkeleyJE backend and Elasticsearch (requires [Docker Compose](https://docs.docker.com/compose/)): | ||
|
|
||
| ```bash | ||
| mvn clean install -Pjanusgraph-release -Dgpg.skip=true -DskipTests=true && mvn docker:build -Pjanusgraph-docker -pl janusgraph-dist | ||
| docker-compose -f janusgraph-dist/janusgraph-dist-hadoop-2/docker-compose.yml up | ||
| ``` | ||
|
|
||
| Note the above `docker-compose` call launches containers in the foreground and is convenient for monitoring logs but add "-d" to instead run in the background. | ||
|
|
||
| To connect to the server in the same container on the console: | ||
|
|
||
| ```bash | ||
| docker exec -i -t janusgraph /var/janusgraph/bin/gremlin.sh | ||
| ``` | ||
|
|
||
| Then you can interact with the graph on the console through the `:remote` interface: | ||
|
|
||
| ```groovy | ||
| gremlin> :remote connect tinkerpop.server conf/remote.yaml | ||
| ==>Configured localhost/127.0.0.1:8182 | ||
| gremlin> :remote console | ||
| ==>All scripts will now be sent to Gremlin Server - [localhost/127.0.0.1:8182] - type ':remote console' to return to local mode | ||
| gremlin> GraphOfTheGodsFactory.load(graph) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change to |
||
| ==>null | ||
| gremlin> g = graph.traversal() | ||
| ==>graphtraversalsource[standardjanusgraph[berkeleyje:db/berkeley], standard] | ||
| ``` | ||
|
|
||
| ## Building on Eclipse IDE | ||
| Note that this has only been tested on Eclipse Neon.2 Release (4.6.2) with m2e (1.7.0.20160603-1933) and m2e-wtp (1.3.1.20160831-1005) plugin. | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| FROM openjdk:8 | ||
|
|
||
| ARG server_zip | ||
| ADD ${server_zip} /var | ||
|
|
||
| RUN apt-get update -y && apt-get install -y zip && \ | ||
| server_base=`basename ${server_zip} .zip` && \ | ||
| unzip -q /var/${server_base}.zip -d /var && \ | ||
| ln -s /var/${server_base} /var/janusgraph | ||
|
|
||
| WORKDIR /var/janusgraph |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| version: '2' | ||
| services: | ||
| janusgraph: | ||
| image: janusgraph/server:latest | ||
| container_name: janusgraph | ||
| ports: | ||
| - "8182:8182" | ||
| volumes: | ||
| - ./es/wait-for-es.sh:/usr/bin/wait-for-es.sh | ||
| depends_on: | ||
| - "elasticsearch" | ||
| command: ["wait-for-es.sh", "elasticsearch", "./bin/gremlin-server.sh", "./conf/gremlin-server/gremlin-server-berkeleyje.yaml"] | ||
|
|
||
| elasticsearch: | ||
| image: docker.elastic.co/elasticsearch/elasticsearch:5.3.2 | ||
| environment: | ||
| - "ES_JAVA_OPTS=-Xms512m -Xmx512m" | ||
| - "http.host=0.0.0.0" | ||
| - "transport.host=127.0.0.1" | ||
| ports: | ||
| - "9200" | ||
| volumes: | ||
| - ./es/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| cluster.name: "docker-cluster" | ||
| network.host: 0.0.0.0 | ||
|
|
||
| # minimum_master_nodes need to be explicitly set when bound on a public IP | ||
| # set to 1 to allow single node clusters | ||
| # Details: https://github.com/elastic/elasticsearch/pull/17288 | ||
| discovery.zen.minimum_master_nodes: 1 | ||
|
|
||
| xpack.security.enabled : false | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| host="$1" | ||
|
|
||
| shift | ||
| cmd="$@" | ||
|
|
||
| until $(curl --output /dev/null --silent --head --fail http://$host:9200); do | ||
| printf '.' | ||
| sleep 5 | ||
| done | ||
|
|
||
| >&2 echo "Elasticsearch is up" | ||
|
|
||
| exec $cmd | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| host: localhost | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 0.0.0.0 would be nice, so you can expose port 8182 to outside docker container, and connect using websockets for testing clients outside the container.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't catch this before merging. Will start a new PR to address. |
||
| port: 8182 | ||
| scriptEvaluationTimeout: 30000 | ||
| channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer | ||
| graphs: { | ||
| graph: conf/gremlin-server/janusgraph-berkeleyje-es-server.properties} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change to |
||
| plugins: | ||
| - janusgraph.imports | ||
| scriptEngines: { | ||
| gremlin-groovy: { | ||
| imports: [java.lang.Math], | ||
| staticImports: [java.lang.Math.PI], | ||
| scripts: [scripts/empty-sample.groovy]}} | ||
| serializers: | ||
| - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} | ||
| - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: {ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} | ||
| - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }} | ||
| - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} | ||
| - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} | ||
| - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} | ||
| processors: | ||
| - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }} | ||
| - { className: org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor, config: { cacheExpirationTime: 600000, cacheMaxSize: 1000 }} | ||
| metrics: { | ||
| consoleReporter: {enabled: true, interval: 180000}, | ||
| csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv}, | ||
| jmxReporter: {enabled: true}, | ||
| slf4jReporter: {enabled: true, 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 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # JanusGraph configuration sample: BerkeleyDB JE and embedded Elasticsearch | ||
| # | ||
| # This file opens a BDB JE instance in the directory | ||
| # db/berkeley. It also starts a local Elasticsearch | ||
| # service inside the same JVM running JanusGraph, persisted at | ||
| # db/es. | ||
|
|
||
| gremlin.graph=org.janusgraph.core.JanusGraphFactory | ||
| storage.backend=berkeleyje | ||
| storage.directory=db/berkeley | ||
| index.search.backend=elasticsearch | ||
| index.search.hostname=elasticsearch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should continue this out with some Gremlin Console interaction. The BerkeleyJE backend only allows a single connection, so the users cannot do something like
graph = JanusGraphFactory.open('conf/janusgraph-berkeleyje-es.properties')as described in the Getting Started doc.They would need to configure a remote connection through the Gremlin Server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will make these changes now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include:
cd janusgraph-hbase-parent/janusgraph-hbase-core && mvn installand/or upload to:
https://oss.sonatype.org/content/repositories/snapshots/org/janusgraph/janusgraph-hbase-core/0.1.0-SNAPSHOT/janusgraph-hbase-core-0.1.0-SNAPSHOT-tests.jar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pluradj done!