janusgraph-docker icon indicating copy to clipboard operation
janusgraph-docker copied to clipboard

Document schema loading

Open FlorianHockmann opened this issue 6 years ago • 4 comments

The docker image now supports the execution of Groovy files on startup, but the docs currently only show an example to execute Gremlin traversals, e.g., to load initial data. It's also possible to access the management API, for example to create a schema. This can be done with the remote Gremlin Console. We should explain this use case as it's probably not clear to most new users.

See this thread on janusgraph-users for more information.

FlorianHockmann avatar Nov 15 '19 12:11 FlorianHockmann

This could be made easier when we have a dedicated image for the console: #100.

FlorianHockmann avatar Jun 16 '22 10:06 FlorianHockmann

Hi @FlorianHockmann (and others),

I have a usecase where we would like to:

  • Setup schemas for known vertices
  • Be able to apply schema "migrations" if needs arise without reloading the graph
  • Have a server (in java) in front of janusgraph

Today, we manage this via a set of groovy scripts along with some logic how to apply these scripts in order, by keeping track of them using a separate graph. I.e. we keep state of the migrations in janusgraph itself, and on every deploy of our server, we check the current migration state and apply potential new migrations to the graph.

I would really love if we could manage this in a different way - either via init scripts (so we deploy the migrations together with Janusgraph) or via in-code that is a bit more typesafe than submitting file content as string. I'm unsure when the initscripts are executed (on every startup / only once for first startup if clean slate / new script present?)

Obviously, I might be missing something here :) But I think this feature really sounds interesting, if it was more clear how it can be used.

For context, I have been a bit inspired how C# / Entity Framework manages metadata state via code. I miss something similar, but I'm also in doubt if it's already possible to do.

anders-rydbirk avatar Jun 27 '23 13:06 anders-rydbirk

Hi @anders-rydbirk,

interesting to hear about your use case, but that sounds quite advanced and out of scope for this specific issue here that just wants to document how a Groovy schema script can be executed with the Docker image.

Schema migrations are of course an interesting and important topic in general, but I'm not sure whether we will be able to handle them inside of JanusGraph directly any time soon since it most likely includes iterating over all vertices. If you want to request that as a specific feature, then please create it in the main JanusGraph repository.

Regarding init scripts: If you are talking about scripts placed under /docker-entrypoint-initdb.d/ as described in the README, then they are executed every time the container starts.

If you have any further / follow-up questions or would like to discuss this some more, then please use one of our community channels, like Discord, the janusgraph-users mailing list or GitHub discussions.

FlorianHockmann avatar Jun 28 '23 10:06 FlorianHockmann

Hi @FlorianHockmann,

Yeah, I think that's also the realisation I arrived at. I ended up making our setup a bit less complicated, which ended up removing the need for having a bespoke graph to keep state of migrations.

Appreciate the details on scripts - and the care you put in this.

anders-rydbirk avatar Jun 30 '23 12:06 anders-rydbirk