Skip to content

Commit

Permalink
Dockerize gremlin-server.sh & JanusGraph with docker plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Patrikalakis <amcp@amazon.co.jp>
  • Loading branch information
Alexander Patrikalakis committed Jun 6, 2017
1 parent 6ada268 commit 8ea98ff
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ target/
/output/
/scripts/
/elasticsearch/
/docker/*.zip
# When executing tests in alphabetical order, Maven generates temporary
# files with names like this:
#
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

# Please keep the list sorted.

Amazon
Aurelius
DataStax
Dylan Bethune-Waddell <dylan.bethune.waddell@mail.utoronto.ca>
Expand Down
29 changes: 29 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,35 @@ To build with only the TinkerPop tests\*:
mvn clean install -Dtest.skip.tp=false -DskipTests=true
```

To build and run a docker image with JanusGraph and Gremlin Server, configured
to run the berkeleyje backend with an embedded ElasticSearch instance:

```bash
mvn clean package -Pjanusgraph-release -Dgpg.skip=true -DskipTests=true
cd janusgraph-hbase-parent/janusgraph-hbase-core && mvn install -DskipTests=true && cd ../..
cd janusgraph-dist && mvn install -Pjanusgraph-docker -DskipTests=true docker:build
docker run -d -p 8182:8182 --name janusgraph janusgraph/server:latest
```

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)
==>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.

Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
![JanusGraph logo](janusgraph.png)

JanusGraph is a highly scalable [graph database](http://en.wikipedia.org/wiki/Graph_database) optimized for storing and querying large graphs with billions of vertices and edges distributed across a multi-machine cluster. JanusGraph is a transactional database that can support thousands of concurrent users, complex traversals, and analytic graph queries.
JanusGraph is a highly scalable [graph database](http://en.wikipedia.org/wiki/Graph_database)
optimized for storing and querying large graphs with billions of vertices and edges
distributed across a multi-machine cluster. JanusGraph is a transactional database that
can support thousands of concurrent users, complex traversals, and analytic graph queries.

[![Build Status][travis-shield]][travis-link]
[![Maven][maven-shield]][maven-link]
Expand All @@ -18,7 +21,8 @@ JanusGraph is a highly scalable [graph database](http://en.wikipedia.org/wiki/Gr

## Learn More

The [project homepage](http://janusgraph.org) contains more information on JanusGraph and provides links to documentation, getting-started guides and release downloads.
The [project homepage](http://janusgraph.org) contains more information on JanusGraph and
provides links to documentation, getting-started guides and release downloads.

## Community

Expand Down
13 changes: 13 additions & 0 deletions janusgraph-dist/janusgraph-dist-hadoop-2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM openjdk:8

ENV PATH "$JAVA_HOME/bin:$PATH"
RUN apt-get update -y && apt-get install -y zip
WORKDIR /var

ARG server_zip
ARG server_base
ADD ${server_zip} /var
RUN unzip -q ${server_base}.zip && ln -s ./${server_base} ./janusgraph
WORKDIR /var/janusgraph
EXPOSE 8182
CMD ["./bin/gremlin-server.sh", "./conf/gremlin-server/gremlin-server-berkeleyje.yaml"]
28 changes: 28 additions & 0 deletions janusgraph-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<pkgtools.dir>${project.basedir}/..</pkgtools.dir>

<skipDefaultDistroIT>${it.skip}</skipDefaultDistroIT>
<docker.maven.version>0.4.13</docker.maven.version>
</properties>

<modules>
Expand Down Expand Up @@ -622,6 +623,33 @@
</build>
</profile>

<profile>
<id>janusgraph-docker</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.maven.version}</version>
<configuration>
<dockerDirectory>janusgraph-dist-hadoop-2</dockerDirectory>
<buildArgs>
<server_zip>target/janusgraph-${project.version}-hadoop2.zip</server_zip>
<server_base>janusgraph-${project.version}-hadoop2</server_base>
</buildArgs>
<forceTags>true</forceTags>
<imageName>janusgraph/server</imageName>
<imageTags>
<imageTag>${project.version}</imageTag>
</imageTags>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>

<profile>
<id>janusgraph-release</id>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
host: localhost
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
graph: conf/gremlin-server/janusgraph-berkeleyje-es-server.properties}
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
ssl: {
enabled: false}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 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.directory=db/es
index.search.elasticsearch.client-only=false
index.search.elasticsearch.local-mode=true
10 changes: 6 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,15 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<janusgraph.testdir>${project.build.directory}/janusgraph-test</janusgraph.testdir>
<gpg.skip>false</gpg.skip>
<maven.gpg.version>1.4</maven.gpg.version>
<perf.jvm.opts />
<default.test.jvm.opts>-Xms256m -Xmx768m -XX:+HeapDumpOnOutOfMemoryError -ea ${test.extra.jvm.opts}</default.test.jvm.opts>
<mem.jvm.opts>-Xms256m -Xmx256m -ea -XX:+HeapDumpOnOutOfMemoryError ${test.extra.jvm.opts}</mem.jvm.opts>
<test.extra.jvm.opts />
<test.skip.default>false</test.skip.default>
<test.skip.tp>true</test.skip.tp>
<top.level.basedir>${basedir}</top.level.basedir>
<maven.javadoc.version>2.10.4</maven.javadoc.version>
<compiler.source>1.8</compiler.source>
<compiler.target>1.8</compiler.target>
<test.excluded.groups>org.janusgraph.testcategory.MemoryTests,org.janusgraph.testcategory.PerformanceTests,org.janusgraph.testcategory.BrittleTests</test.excluded.groups>
Expand Down Expand Up @@ -383,7 +385,7 @@
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<version>${maven.javadoc.version}</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
Expand All @@ -407,7 +409,7 @@
</plugin>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
<version>${maven.gpg.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down Expand Up @@ -1113,7 +1115,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<version>${maven.javadoc.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -1123,7 +1125,7 @@
</plugin>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.1</version>
<version>${maven.gpg.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand Down

0 comments on commit 8ea98ff

Please sign in to comment.