geonetwork / docker-geonetwork

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

install geonetwork at root #40

Closed pvgenuchten closed 10 months ago

pvgenuchten commented 4 years ago

Currently when you access localhost:port you get some file-not-found error, you have to navigate to /geonetwork to open the application

Instead would be better to install geonetwork at root, by:

In case of context GeoNetwork can be deployed in /opt/webapps/geonetwork

Example of tomcat context:

<Context 
  docBase="/opt/webapps/geonetwork" 
  path="" 
  reloadable="false" 
/>
elasticlabs commented 4 years ago

Hi, since we work with containers, your answer makes sense. However, working inside the appBase directory expose you to unexpected Tomcat automations.

Therefore, I would recommand this approach (working here :https://github.com/elasticlabs/geospatial-metadata-catalogue ):

In the Dockerfile :

[...]
ENV INSTALL_DIR /usr/local/geonetwork
ENV DATA_DIR=/var/lib/geonetwork_data

[...]
http://nightlybuild.geonetwork-opensource.org/3.10.x/geonetwork-3.10.3-SNAPSHOT-2020-06-04.war && \
     mkdir -p $INSTALL_DIR && \
     unzip -e $GN_FILE -d $INSTALL_DIR && \
     rm $GN_FILE

#Copy context file
COPY conf/ROOT.xml $CATALINA_HOME/conf/Catalina/localhost/ROOT.xml

#Set geonetwork data dir
COPY conf/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

CMD ["catalina.sh", "run"]

Associated ROOT.xml file

Match your directory setup. I think it's a better to directly generate ROOT.xml file during the container setup inside the Dockerfile and will do accordingly i a near future.

<Context path="" docBase="/usr/local/geonetwork" />
juanluisrp commented 10 months ago

Since version 4.4.0 you can use WEBAPP_CONTEXT_PATH environment variable to define the context path where GN will be deployed. For example: