diff --git a/titan-gremlin/Dockerfile b/titan-gremlin/Dockerfile index c94336a8..0c569c19 100644 --- a/titan-gremlin/Dockerfile +++ b/titan-gremlin/Dockerfile @@ -2,12 +2,13 @@ FROM itzg/ubuntu-openjdk-7 MAINTAINER itzg -RUN apt-get install -y wget unzip +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget unzip +ENV TITAN_VERSION 0.5.4 -RUN wget -q -O /tmp/titan.zip http://s3.thinkaurelius.com/downloads/titan/titan-0.5.0-hadoop2.zip -RUN unzip /tmp/titan.zip -d /opt && rm /tmp/titan.zip +RUN wget -q -O /tmp/titan.zip http://s3.thinkaurelius.com/downloads/titan/titan-$TITAN_VERSION-hadoop2.zip +RUN unzip -q /tmp/titan.zip -d /opt && rm /tmp/titan.zip -ENV TITAN_HOME /opt/titan-0.5.0-hadoop2 +ENV TITAN_HOME /opt/titan-$TITAN_VERSION-hadoop2 WORKDIR $TITAN_HOME VOLUME ["/conf","/data"] diff --git a/titan-gremlin/README.md b/titan-gremlin/README.md index 3af4f137..a4e532f7 100644 --- a/titan-gremlin/README.md +++ b/titan-gremlin/README.md @@ -1,5 +1,7 @@ Runs the Gremlin console from the Titan Graph Database "all" distribution. +# Basic Usage + To start the Gremlin console with the default configuration files available: docker run -it itzg/titan-gremlin @@ -12,3 +14,34 @@ attach a host directory to the container's `/conf` such as After running once your host directory will be populated with the distribution-default configuration files. Modify those or add to them and they will available during the next use of gremlin. + +# Connecting to Cassandra and Elasticsearch Containers + +First start containers for Cassandra and Elasticsearch, where the `--name` you choose +can be arbitrary or left off to use a generated name. +_Note: Cassandra's Thrift port is exposed to allow for external usage, such as Titan Browser._ + + docker run -d --name cass -p 9160:9160 spotify/cassandra + docker run -d --name es itzg/elasticsearch + +Now start Gremlin linking the containers to the respective aliases + +* `--link :cass` +* `--link :es` + +such as + + docker run -it --rm --link cass:cass --link es:es itzg/titan-gremlin + +and with that you can follow the +[Graph of the Gods example](http://s3.thinkaurelius.com/docs/titan/current/getting-started.html), such as + + gremlin> GraphOfTheGodsFactory.load(g) + gremlin> saturn = g.V.has('name','saturn').next() + ==>v[256] + gremlin> saturn.map() + ==>name=saturn + ==>age=10000 + gremlin> saturn.in('father').in('father').name + ==>hercules + diff --git a/titan-gremlin/start-gremlin.sh b/titan-gremlin/start-gremlin.sh index efbb2c12..521bd4fa 100755 --- a/titan-gremlin/start-gremlin.sh +++ b/titan-gremlin/start-gremlin.sh @@ -1,7 +1,47 @@ #!/bin/bash +args= + if [ $(ls /conf|wc -l) = 0 ]; then cp -r $TITAN_HOME/conf/* /conf fi -$TITAN_HOME/bin/gremlin.sh +rm -f /tmp/titan.properties + +if [ -n "$CASS_PORT_9160_TCP_ADDR" ]; then + shortcut=/tmp/titan.properties + cat >> /tmp/titan.properties <> /tmp/titan.properties <> /tmp/titan.properties <> /tmp/titan.properties < /tmp/init.groovy <