Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

MrSaints/docker-gremlin-neo4j

Repository files navigation

docker-gremlin-neo4j

Build Status
gremlin-console-neo4j
gremlin-server-neo4j

A work in progress. Use at your own discretion.

An unofficial set of lightweight Docker, and Docker Compose files for working with Apache TinkerPop™ Gremlin Console, Gremlin Server, and Neo4j.

  • org.apache.tinkerpop neo4j-gremlin is installed out-of-the-box for both the Gremlin Console, and the Server image (currently version 3.2.1)
  • tinkerpop.neo4j, and tinkerpop.gephi plugins are also enabled for the Gremlin Console image by default (i.e. no :plugin use needed)

Disclaimer

Binding to 0.0.0.0:

By default, most Gremlin Server configuration files will set the host binding to localhost. The Gremlin Server image in this repository uses a custom configuration file (gremlin-server-custom.yml) in order to bind to 0.0.0.0 so that Docker containers may communicate with instantiations of it. i.e. any 'host' can connect to it.

Embedded mode:

Both Gremlin, and Neo4j run in embedded mode. That is, neither can be operating on the same database at the same time, and only one JVM process may access it at any given time.

To perform concurrent reads on the same database, Gremlin, and Neo4j must be configured for high availability support. The Docker images in this repository are not currently configured for the aforementioned purpose.

You can ignore this if both services are operating on different databases.

Neo4j 3:

At the time of writing, Gremlin has difficulties operating on a database generated by Neo4j 3. As such, the Docker Compose file uses Neo4j 2.3.

TODO

  • Clean up docker-compose.yml
  • Improve configuration
  • Make the Gremlin Server image useful
  • Tag images

Install

You can skip this step if you are working with Docker Compose.

docker pull mrsaints/gremlin-console-neo4j
docker pull mrsaints/gremlin-server-neo4j

Usage

Docker

To be added.

Docker Compose

As mentioned in the disclaimer, you should not run multiple instances of Gremlin or Neo4j if they are operating on the same database. Otherwise, you will end up with errors related to 'lock' / 'locking'.

The default docker-compose.yml configuration for services below will mount the ./data/ (relative) directory in this repository to /data/ (absolute) directory in the instantiated Docker container. i.e. all the services can / will access, and persist data into the same directory.

Gremlin Console only:

docker-compose run --rm gremlin-console

You can also launch the console in interactive mode with a custom Groovy script by setting the command configuration in docker-compose.yml:

command: "/bin/bash /gremlin-console/bin/gremlin.sh -i init.groovy"

Ensure that init.groovy is available in the container. The easiest way to do so is to mount the file from your host machine to the container (look for volumes in docker-compose.yml).

The above is useful if you would like to bootstrap / prepare your console environment, and avoid typing the same commands every time you instantiate the console.

See Docker Compose docs for more information.

Gremlin Console with Server:

docker-compose run --rm gremlin-console-with-server

Gremlin Server only:

docker-compose run --rm --service-ports gremlin-server

Neo4j only:

docker-compose run --rm --service-ports neo4j-server

Development

The Docker images are automatically built, and pushed to Docker Hub via Travis CI. See .travis.yml for more information.

grapeConfig.xml is needed by the Gremlin Console, and Server to install the neo4j-gremlin plugin.

Build Docker images:

See the respective files below for more information.

./bin/build-gremlin-console-neo4j.sh
./bin/build-gremlin-server-neo4j.sh

Useful Console Commands

Connect to remote Docker Compose service:

The following command assumes that the console container, and the server container are linked. It should not be a problem if launched with the gremlin-console-all service.

:remote connect tinkerpop.server conf/remote-docker-compose.yml
:remote console

Connect to host machine Gephi:

The following command assumes that you have Gephi installed on your host machine along with the Graph Streaming plugin (see TinkerPop™ Gephi docs for more information).

:remote connect tinkerpop.gephi <workspace> <host> <port>
  • Replace <workspace> with your current Gephi workspace (normally it is workspace1)
  • Replace <host> with the internal IP address of your host machine (you can find this using ifconfig on Unix)
  • Replace <port> with the port of the Graph Streaming plugin (this can be omitted as the default 8080 is normally appropriate)

Load Neo4j graph:

graph = Neo4jGraph.open("/data/databases/graph.db/")
g = graph.traversal()
g.V().count()
  • To persist the database, ensure that the /data/ directory is mounted between the host, and the container (this is handled by Docker Compose through volumes)
  • To use an existing Neo4j database, set the path in Neo4jGraph.open(<path>) to the directory containing neostore (e.g. /data/databases/graph.db/)
  • To create, and use a new Neo4j database, set the path to any new / unused directory (e.g. /data/gremlin-neo4j/)

About

An unofficial set of lightweight Docker, and Docker Compose files for working with Apache TinkerPop™ Gremlin Console, Gremlin Server, and Neo4j.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published