geonetwork / docker-geonetwork

Official Docker image repository for GeoNetwork
38 stars 39 forks source link

Facility to add specific GN configuration (geonet:info) #8

Closed eblondel closed 5 years ago

eblondel commented 6 years ago

I'm using docker-geonetwork through Continuous Integration to perform metadata CRUD operation integration tests, using the Geonetwork API. Interacting with the API requires to have geonet:info retrieved in service responses, disabled by default in the Geonetwork installation. Is there a way I could specify this in docker-geonetwork?

Thanks Emmanuel

Delawen commented 6 years ago

I guess you are not referring to the REST API but to the "soon-to-disappear" old XML API. My suggestion: don't. That API is being replaced by the REST API (more standard, more easy to use, more stable). Whatever you are doing, it will be soon deprecated and not compatible.

On the other hand, even if you want to still use the old API, what is it you are trying to do that requires geonet:info? Are you sure there is not a direct way to do it without having to use that? (Hint: there should be. And if it is something really exotic and there isn't, you should extend the REST API to do it instead of using the geonet:info)

Delawen commented 6 years ago

Said this, for old XML API you can see more things using the debug mode with a "!" at the end of the url. But not sure if that is what you are looking for.

eblondel commented 6 years ago

I need to consider both, for a simple reason many orgs are still using GN from older versions and dependent on this older API for their metadata flows, then I need to rely on geonet: info from performing CRUD ops... a pity this option is set to false by default..

Le 30 nov. 2017 08:52, "María Arias de Reyna" notifications@github.com a écrit :

Said this, for old XML API you can see more things using the debug mode with a "!" at the end of the url. But not sure if that is what you are looking for.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geonetwork/docker-geonetwork/issues/8#issuecomment-348109495, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQ1bBFMIVBYabGkc5TNCnj4Etff3P-Pks5s7l6zgaJpZM4Quyyv .

doublebyte1 commented 6 years ago

Hi @eblondel : if you really think this is a useful feature, you can create a PR for exposing this option in the Dockerfile. The best thing would be to have the option passed as an environment variable, setting "False" as the default value, as this would be the choice for most people. Just give us a shout if you step into any issues while implementing this :-)

juanluisrp commented 5 years ago

@eblondel, I'm not sure if I understand you. Can you provide an example of request using geonet:info, please? And what is the option you are referring to exactly?

eblondel commented 5 years ago

The legacy API (still used programmatically by many users) requires internal metadata id for operations. The only way to get such metadata id is to embedd the geonet:info content in metadata GET xml responses. And for this, this should be enabled in the web-services XML configuration. Right now I don't remember the name of the xml file because this changed with geonetwork versions.

Anyway, this is not a problem anymore. I've switched to another docker geonetwork image provided by a colleague that switches on correctly this setting by default in Geonetwork, required for programmic metadata management.

juanluisrp commented 5 years ago

Just for the record this is still possible with official GN 3.4 image.

You need to overwrite the configuration for xml.metadata.get:

    <service name="xml.metadata.get" xmlapi="true">
      <class name=".services.metadata.Show">
        <param name="skipPopularity" value="y"/>
        <param name="skipInfo" value="y"/>
      </class>
    </service>

and set skipInfo param to "n".

You can do that creating a config override file, for example config-view-service-override.xml: https://gist.github.com/juanluisrp/5f94035027e7c505ff137bed9a03d113#file-config-view-service-override-xml

<overrides xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:noNamespaceSchemaLocation="config-overrides.xsd">
  <file name=".*/WEB-INF/config/config-service-xml-api.xml">
    <replaceAtt xpath="services/service[@name='xml.metadata.get']/class/param[@name='skipInfo']" 
                attName="value" value="n"/>
  </file>
</overrides>

Then you could mount this file into the container and define a system property to add it to GeoNetwork configuration:

docker run  \
-v /path/to/config-view-service-override.xml:/etc/geonetwork/config-view-service-override.xml \
-p "8080:8080" \
geonetwork:3.4 \
bash -c 'export CATALINA_OPTS="$CATALINA_OPTS -Dgeonetwork.jeeves.configuration.overrides.file=/etc/geonetwork/config-view-service-override.xml";/entrypoint.sh catalina.sh run'

More info about configuration override in GeoNetwork: https://geonetwork-opensource.org/manuals/2.10.4/eng/users/admin/advanced-configuration/index.html#configuration-override

eblondel commented 5 years ago

Dear @juanluisrp sorry to come back to you only now, but I didn't work on lot on geonapi this year, until this week. I wanted to thank since I could use your guidelines to set-up a travis.yml (https://github.com/eblondel/geonapi/blob/master/.travis.yml) including a matrix of build environments with different docker images. I still need to find an image for 2.6.x because I want to have geonapi fully functional on all GN versions.

juanluisrp commented 4 years ago

@eblondel there is no possibility to have an unsupported GeoNetwork version in the official Docker images library. However I've created an GeoNetwork 2.6.4 image in my personal Docker Hub space [1]. You can try it if you want. The sources of the image are in https://github.com/juanluisrp/docker-geonetwork-legacy.

[1] https://hub.docker.com/r/juanluisrp/geonetwork-legacy

eblondel commented 4 years ago

Great, thanks a lot @juanluisrp I've applied similar logic above on this legacy geonetwork. Now tests are run on all major versions. https://travis-ci.org/eblondel/geonapi/builds/610288658

juanluisrp commented 4 years ago

I'm not sure, but you probably would need to run bin/catalina.sh run instead of catalina.sh run

docker run -v $TRAVIS_BUILD_DIR/tests/resources/config-view-service-override-legacy.xml:/etc/geonetwork/config-view-service-override.xml -d -p "8080:8080" juanluisrp/geonetwork-legacy:2.6.4 bash -c 'export CATALINA_OPTS="$CATALINA_OPTS -Dgeonetwork.jeeves.configuration.overrides.file=/etc/geonetwork/config-view-service-override.xml";/entrypoint.sh catalina.sh run'

would be

docker run -v $TRAVIS_BUILD_DIR/tests/resources/config-view-service-override-legacy.xml:/etc/geonetwork/config-view-service-override.xml -d -p "8080:8080" juanluisrp/geonetwork-legacy:2.6.4 bash -c 'export CATALINA_OPTS="$CATALINA_OPTS -Dgeonetwork.jeeves.configuration.overrides.file=/etc/geonetwork/config-view-service-override.xml";/entrypoint.sh bin/catalina.sh run'
juanluisrp commented 4 years ago

Added $CATALINA_HOME/bin to PATH so catalina.sh can be called directly.