Giter VIP home page Giter VIP logo

janusgraph-docker's Introduction

JanusGraph Docker images

Build Status Docker pulls

This repository contains build scripts and configuration files for the official JanusGraph Docker images, which are published on the Docker Hub.

Usage

Start a JanusGraph Server instance

The default configuration uses the Oracle Berkeley DB Java Edition storage backend and the Apache Lucene indexing backend:

docker run --rm --name janusgraph-default janusgraph/janusgraph:latest

Connecting with Gremlin Console

Start a JanusGraph container and connect to the janusgraph server remotely using Gremlin Console:

$ docker run --rm --link janusgraph-default:janusgraph -e GREMLIN_REMOTE_HOSTS=janusgraph \
    -it janusgraph/janusgraph:latest ./bin/gremlin.sh

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
plugin activated: janusgraph.imports
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.hadoop
plugin activated: tinkerpop.spark
plugin activated: tinkerpop.tinkergraph
gremlin> :remote connect tinkerpop.server conf/remote.yaml
==>Configured janusgraph/172.17.0.2:8182
gremlin> :> g.addV('person').property('name', 'chris')
==>v[4160]
gremlin> :> g.V().values('name')
==>chris

Using Docker Compose

Start a JanusGraph Server instance using docker-compose.yml:

docker-compose -f docker-compose.yml up

Start a JanusGraph container running Gremlin Console in the same network using docker-compose.yml:

docker-compose -f docker-compose.yml run --rm \
    -e GREMLIN_REMOTE_HOSTS=janusgraph janusgraph ./bin/gremlin.sh

Generate Config

JanusGraph-Docker has a single utility method. This method writes the JanusGraph Configuration and show the config afterward.

docker run --rm -it janusgraph/janusgraph:0.4.0 janusgraph show-config

Default config locations are /etc/opt/janusgraph/janusgraph.properties and /etc/opt/janusgraph/gremlin-server.yaml.

Configuration

The JanusGraph image provides multiple methods for configuration, including using environment variables to set options and using bind-mounted configuration.

Docker environment variables

The environment variables supported by the JanusGraph image are summarized below.

Variable Description
JANUS_PROPS_TEMPLATE JanusGraph properties file template (see below). The default properties file template is berkeleyje-lucene.
janusgraph.* Any JanusGraph configuration option to override in the template properties file, specified with an outer janusgraph namespace (e.g., janusgraph.storage.hostname). See JanusGraph Configuration for available options.
gremlinserver.* Any Gremlin Server configuration option to override in the default configuration (YAML) file, specified with an outer gremlinserver namespace (e.g., gremlinserver.threadPoolWorker). See Gremlin Server Configuration for available options.
JANUS_STORAGE_TIMEOUT Timeout (seconds) used when waiting for the storage backend before starting Gremlin Server. Default value is 60 seconds.
GREMLIN_REMOTE_HOSTS Optional hostname for external Gremlin Server instance. Enables a container running Gremlin Console to connect to a remote server using conf/remote.yaml.

Properties template

The JANUS_PROPS_TEMPLATE environment variable is used to define the base JanusGraph properties file. Values in the template properties file are used unless an alternate value for a given property is provided in the environment. The common usage will be to specify a template for the general environment (e.g., cassandra-es) and then provide additional individual configuration to override/extend the template. The available templates depend on the JanusGraph version (see conf/gremlin-server/janusgraph*.properties).

JANUS_PROPS_TEMPLATE Supported Versions
berkeleyje all
berkeleyje-es all
berkeleyje-lucene (default) all
cassandra-es all
cql-es >=0.2.1
Example: Berkeleyje-Lucene

Start a JanusGraph instance using the default berkeleyje-lucene template with custom storage and server settings:

docker run --name janusgraph-default \
    -e janusgraph.storage.berkeleyje.cache-percentage=80 \
    -e gremlinserver.threadPoolWorker=2 \
    janusgraph/janusgraph:latest

Inspect the configuration:

$ docker exec janusgraph-default sh -c 'cat /etc/opt/janusgraph/janusgraph.properties | grep ^[a-z]'
gremlin.graph=org.janusgraph.core.JanusGraphFactory
storage.backend=berkeleyje
storage.directory=/var/lib/janusgraph/data
index.search.backend=lucene
storage.berkeleyje.cache-percentage=80
index.search.directory=/var/lib/janusgraph/index

$ docker exec janusgraph-default grep threadPoolWorker /etc/opt/janusgraph/gremlin-server.yaml
threadPoolWorker: 2
Example: Cassandra-ES with Docker Compose

Start a JanusGraph instance with Cassandra and Elasticsearch using the cassandra-es template through docker-compose-cql-es.yml:

docker-compose -f docker-compose-cql-es.yml up

Inspect the configuration using docker-compose-cql-es.yml:

$ docker-compose -f docker-compose-cql-es.yml exec \
      janusgraph sh -c 'cat /etc/opt/janusgraph/janusgraph.properties | grep ^[a-z]'
gremlin.graph=org.janusgraph.core.JanusGraphFactory
storage.backend=cql
storage.hostname=jce-cassandra
cache.db-cache = true
cache.db-cache-clean-wait = 20
cache.db-cache-time = 180000
cache.db-cache-size = 0.25
index.search.backend=elasticsearch
index.search.hostname=jce-elastic
index.search.elasticsearch.client-only=true
storage.directory=/var/lib/janusgraph/data
index.search.directory=/var/lib/janusgraph/index

Mounted Configuration

By default, the container stores both the janusgraph.properties and gremlin-server.yaml files in the JANUS_CONFIG_DIR directory which maps to /etc/opt/janusgraph. When the container starts, it updates those files using the environment variable values. If you have a specific configuration and do not wish to use environment variables to configure JanusGraph, you can mount a directory containing your own version of those configuration files into the container through a bind mount, e.g., -v /local/path/on/host:/etc/opt/janusgraph:ro. You'll need to bind the files as read-only, however, if you do not wish to have the environment variables override the values in that file.

Example with mounted configuration

Start a JanusGraph instance with mounted configuration using docker-compose-mount.yml:

$ docker-compose -f docker-compose-mount.yml up
janusgraph-mount | chown: changing ownership of '/etc/opt/janusgraph/janusgraph.properties': Read-only file system
...

Community

JanusGraph-Docker uses the same communication channels as JanusGraph in general. Please refer to the Community section in JanusGraph's main repository for more information about these various channels.

Please use GitHub issues only to report bugs or request features.

Contributing

Please see CONTRIBUTING.md in JanusGraph's main repository for more information, including CLAs and best practices for working with GitHub.

License

JanusGraph Docker images are provided under the Apache 2.0 license and documentation is provided under the CC-BY-4.0 license. For details about this dual-license structure, please see LICENSE.txt.

janusgraph-docker's People

Contributors

chrislbs avatar farodin91 avatar florianhockmann avatar mbrukman avatar pluradj avatar sjudeng avatar twilmes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.