phenoscape / owlery

Owlery is a set of REST web services which allow querying of an OWL reasoner containing a configured set of ontologies.
MIT License
16 stars 11 forks source link

Document a fully working docker run command with configuration file provided at runtime #29

Closed matentzn closed 6 years ago

matentzn commented 6 years ago

It would be great if you could provide an example on how we can, using the phenoscape/owlery base image from dockerhub, simply fire up an owlery server with an ontology provided as a URL at runtime (rather than inheriting the container and overriding the config file). Something along these lines:

docker run -p 80:8080 -e url=http://urlofconfigfileorevenbetterjusttheontologyitself.txt phenoscape/owlery
balhoff commented 6 years ago

@hlapp could you comment whether this should already work, or if it is easy to support?

hlapp commented 6 years ago

@matentzn this is supported out of the box, there's no need to build another container on top of it. See Runtime Customization in the README accompanying the Dockerfile.

Note, however, that in principle Owlery is configured through the application.conf file, not command line parameters or environment variables. Owlery expects to find the config file, and the container provides no default; you must map one into the container. You could in principle give a minimum application.conf and then use trailing -Dproperty.name=value parameters in the docker run command line to add ontologies to be loaded. (Alternatively, you could use the --env JAVA_OPTS="-Dproperty.name=value" mechanism to override the default setting (but then be sure to include the increased memory, the default is JAVA_OPTS="-Xmx8G". See README documentation.) Either way, this will be hairy since Owlery expects the ontologies that are to be loaded to be given as an array of dictionaries. (This has nothing to do with the container, it's because of how Owlery wants to be configured.)

matentzn commented 6 years ago

Hey Hilmar, Jim, much thanks for the clarification. Hairy is fine! The reason for this use case is that we are generating an ontology on the fly, and we then want to fire up an owlery server loading it. I must admit that I saw your documentation before, but I don't know unfortunately what you mean by the phrase: you must map one into the container. As far as I can see, your container does not provide any mount points for volumes? I would be very happy if you could provide me with a working example run command for this case:

O=/my/local/path/generatedontology.owl sed -i '/ontologypath/${O}/g' application.conf docker run -p 80:8080 X phenoscape/owlery

Greatly appreciated!

hlapp commented 6 years ago

@matentzn as per documentation, the config file is expected at /srv/conf/application.conf within the container. Note that containers don't "provide" mount points - you can map host volumes to any path in the container. These are the --volume or --mount options to docker run. I'd suggest you consult the corresponding Docker documentation, which spells it out pretty well. There are many options to do this, and what is best depends on your local setup and use case, so it's worth understanding in full how this works in Docker.

matentzn commented 6 years ago

Okay thanks:) I will close the issue now.