diff --git a/titandb/Dockerfile b/titandb/Dockerfile new file mode 100644 index 00000000..1c603dfb --- /dev/null +++ b/titandb/Dockerfile @@ -0,0 +1,54 @@ +FROM itzg/ubuntu-openjdk-7 + +MAINTAINER itzg + +ENV APT_GET_UPDATE 2014-07-19 + +RUN apt-get update +RUN apt-get install -y wget unzip + +ENV TITAN_VER 0.4.4 +ENV TITAN_STORAGE all +ENV REXSTER_VER 2.4.0 + +RUN wget -O /tmp/titan.zip http://s3.thinkaurelius.com/downloads/titan/titan-$TITAN_STORAGE-$TITAN_VER.zip +RUN wget -O /tmp/rexster.zip http://tinkerpop.com/downloads/rexster/rexster-server-$REXSTER_VER.zip + +WORKDIR /opt + +RUN unzip /tmp/titan.zip +RUN rm /tmp/titan.zip + +RUN unzip /tmp/rexster.zip +RUN rm /tmp/rexster.zip + +RUN ln -s titan-$TITAN_STORAGE-$TITAN_VER titan +RUN ln -s rexster-server-$REXSTER_VER rexster-server + +RUN mkdir /opt/rexster-server/ext/titan +RUN ln -s /opt/titan-$TITAN_STORAGE-$TITAN_VER/lib/* /opt/rexster-server/ext/titan +RUN wget -O /opt/rexster-server/ext/titan/titan-rexter-$TITAN_VER.jar \ + http://central.maven.org/maven2/com/thinkaurelius/titan/titan-rexster/$TITAN_VER/titan-rexster-$TITAN_VER.jar + +# Clean up distro area +RUN rm /opt/rexster-server/ext/titan/log4j* /opt/rexster-server/ext/titan/slf4j* +RUN rm /opt/rexster-server/lib/lucene-core* + +ADD gremlin /usr/local/bin/gremlin +ADD rexster /usr/local/bin/rexster + +WORKDIR titan + +ADD titan.properties /opt/titan/conf/titan.properties +ADD init-graph-storage.groovy /tmp/init-graph-storage.groovy + +VOLUME ["/data", "/config", "/scripts"] +RUN ln -s /data /opt/titan/db + +RUN gremlin -e /tmp/init-graph-storage.groovy && rm /tmp/init-graph-storage.groovy + +EXPOSE 8182 8184 + +ADD rexster.xml /config/rexster.xml + +CMD ["/usr/local/bin/rexster", "-s", "-c", "/config/rexster.xml"] diff --git a/titandb/gremlin b/titandb/gremlin new file mode 100755 index 00000000..2d4c05a6 --- /dev/null +++ b/titandb/gremlin @@ -0,0 +1,3 @@ +#!/bin/sh + +/opt/titan/bin/gremlin.sh $* diff --git a/titandb/init-graph-storage.groovy b/titandb/init-graph-storage.groovy new file mode 100644 index 00000000..cc44a104 --- /dev/null +++ b/titandb/init-graph-storage.groovy @@ -0,0 +1,12 @@ +import com.thinkaurelius.titan.core.TitanFactory +import com.thinkaurelius.titan.core.TitanGraph +import com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration +import org.apache.commons.configuration.BaseConfiguration +import org.apache.commons.configuration.Configuration + +// Setup a blank one + +TitanGraph g = TitanFactory.open('conf/titan.properties') +g.shutdown() + + diff --git a/titandb/rexster b/titandb/rexster new file mode 100755 index 00000000..c702e3d0 --- /dev/null +++ b/titandb/rexster @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ -n "$PUBLISH_ADDR" ]; then + echo "Enabling Doghouse access at http://$PUBLISH_ADDR:8182/doghouse" + sed -i "s#.*#http://$PUBLISH_ADDR#" /config/rexster.xml +fi + +if [ -n "$SCRIPT" ]; then + echo "Running Gremlin script $SCRIPT from /scripts..." + gremlin -e /scripts/$SCRIPT +fi + +echo "Starting Rexster..." +/opt/rexster-server/bin/rexster.sh $* diff --git a/titandb/rexster.xml b/titandb/rexster.xml new file mode 100644 index 00000000..1730a82b --- /dev/null +++ b/titandb/rexster.xml @@ -0,0 +1,28 @@ + + + + http://localhost + + + + titan + com.thinkaurelius.titan.tinkerpop.rexster.TitanGraphConfiguration + /data/persistit + false + + persistit + /data/persistit + 5000 + elasticsearch + true + false + /data/es + + + + tp:gremlin + + + + + diff --git a/titandb/scripts/GraphOfTheGods.groovy b/titandb/scripts/GraphOfTheGods.groovy new file mode 100644 index 00000000..25d2f8f8 --- /dev/null +++ b/titandb/scripts/GraphOfTheGods.groovy @@ -0,0 +1,7 @@ +import com.thinkaurelius.titan.core.TitanFactory +import com.thinkaurelius.titan.example.GraphOfTheGodsFactory + +def g = TitanFactory.open('conf/titan.properties') +GraphOfTheGodsFactory.load(g) + +g.shutdown() diff --git a/titandb/titan.properties b/titandb/titan.properties new file mode 100644 index 00000000..dc5254fc --- /dev/null +++ b/titandb/titan.properties @@ -0,0 +1,8 @@ +storage.backend=persistit +storage.directory=/data/persistit +storage.buffercount=5000 + +storage.index.search.backend=elasticsearch +storage.index.search.local-mode=true +storage.index.search.client-only=false +storage.index.search.directory=/data/es