Reputation: 13278
I want to run the janusgraph container ready with some data loaded at the time of initialisation.
I've checked the janusgraph docker documentation - https://github.com/JanusGraph/janusgraph-docker but didn't find any information around initialising the container pre loaded with data.
Is there any easy way to do this. I can write a groovy script or a java class to import the data, I just want to know how do I call this at the time of container creation so that once the container is ready it has the data pre-loaded in it.
Upvotes: 1
Views: 340
Reputation: 2809
Maybe you missed that part of the docs but the README.md
contains a section Initialization that explains how to load data into JanusGraph when the container starts.
You just need to create a Groovy script (the file name needs to end on .groovy
) and put it into the /docker-entrypoint-initdb.d
which lets JanusGraph execute it when the container starts.
A quick example that is taken directly from that section looks like this:
add-vertex-groovy
:g = traversal().withRemote('conf/remote-graph.properties')
// add the traversals to initialize the Graph with your data
g.addV('demigod').property('name', 'hercules').iterate()
Dockerfile
:FROM janusgraph/janusgraph:0.5.2
COPY add-vertex-groovy /docker-entrypoint-initdb.d/
Upvotes: 3