From 89b4b8ec235cd2a0add497188f27cf519d86f80f Mon Sep 17 00:00:00 2001 From: Andreas Schmitz Date: Wed, 7 Jun 2023 09:14:02 +0200 Subject: [PATCH] Add GNOS 4 Dockerfile --- .gitignore | 1 + Dockerfile | 22 +++ Gn.js | 81 ++++++++++ WEB-INF/config-db/jdbc.properties | 8 +- WEB-INF/config.properties | 32 ++-- catalog/style/srv_custom_style.less | 6 +- .../default/less/gn_variables_default.less | 4 + docker-compose.yml | 58 +++++++ log4j2.xml | 141 ++++++++++++++++++ 9 files changed, 331 insertions(+), 22 deletions(-) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 Gn.js create mode 100644 docker-compose.yml create mode 100644 log4j2.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..be37536 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +postgresql_data diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cc2f1d7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM geonetwork:4.2.4 + +USER root +RUN apt -y update && apt -y upgrade && apt -y install vim && apt clean +USER jetty + +COPY WEB-INF/config-db/jdbc.properties /var/lib/jetty/webapps/geonetwork/WEB-INF/config-db/jdbc.properties +COPY WEB-INF/config-node/srv.xml /var/lib/jetty/webapps/geonetwork/WEB-INF/config-node/srv.xml +COPY WEB-INF/config.properties /var/lib/jetty/webapps/geonetwork/WEB-INF/config.properties +COPY catalog/components/search/mdview/partials/contact.html /var/lib/jetty/webapps/geonetwork/catalog/components/search/mdview/partials/contact.html +COPY catalog/locales/de-core.json /var/lib/jetty/webapps/geonetwork/catalog/locales/de-core.json +COPY catalog/locales/de-custom.json /var/lib/jetty/webapps/geonetwork/catalog/locales/de-custom.json +COPY catalog/style/srv_custom_style.less /var/lib/jetty/webapps/geonetwork/catalog/style/srv_custom_style.less +COPY catalog/style/gn_icons.less /var/lib/jetty/webapps/geonetwork/catalog/style/gn_icons.less +COPY catalog/views/default/less/gn_results_default.less /var/lib/jetty/webapps/geonetwork/catalog/views/default/less/gn_results_default.less +COPY catalog/views/default/less/gn_topics_default.less /var/lib/jetty/webapps/geonetwork/catalog/views/default/less/gn_topics_default.less +COPY catalog/views/default/less/gn_variables_default.less /var/lib/jetty/webapps/geonetwork/catalog/views/default/less/gn_variables_default.less +COPY catalog/views/default/templates/advancedSearchForm/defaultAdvancedSearchForm.html /var/lib/jetty/webapps/geonetwork/catalog/views/default/templates/advancedSearchForm/defaultAdvancedSearchForm.html +COPY catalog/views/default/templates/footer.html /var/lib/jetty/webapps/geonetwork/catalog/views/default/templates/footer.html +COPY catalog/views/default/templates/results.html /var/lib/jetty/webapps/geonetwork/catalog/views/default/templates/results.html +COPY Gn.js /var/lib/jetty/webapps/geonetwork/catalog/js/Gn.js +COPY log4j2.xml /var/lib/jetty/webapps/geonetwork/WEB-INF/classes/ diff --git a/Gn.js b/Gn.js new file mode 100644 index 0000000..a827c1e --- /dev/null +++ b/Gn.js @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2001-2016 Food and Agriculture Organization of the + * United Nations (FAO-UN), United Nations World Food Programme (WFP) + * and United Nations Environment Programme (UNEP) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + * Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2, + * Rome - Italy. email: geonetwork@osgeo.org + */ + +// Define root geonetwork namespace +var geonetwork = {}; + +(function () { + goog.provide("gn"); + + goog.require("gn_locale"); + goog.require("gn_count_watchers"); + goog.require("gn_polyfills"); + + /** + * Main gn module. + * + * Must be included by all uis. + * Is used in wro4j for $templatecache. + * Must contains only what is mendatory in all uis: + * - locale management + * + * @type {module|*} + */ + var module = angular.module("gn", ["gn_locale", "gn_config", "cfp.hotkeys"]); + + // See https://docs.angularjs.org/guide/migration#commit-aa077e8 + module.config([ + "$locationProvider", + function ($locationProvider) { + // Configure existing providers + $locationProvider.hashPrefix(""); + } + ]); + + window.addEventListener('hashchange', function() { + if (window.location.hash.startsWith('#/metadata')) { + this.window.setTimeout(function() { + var parents = document.querySelectorAll('.gn-metadata-display'); + parents.forEach(function(parent) { + parent.querySelectorAll('a').forEach(function(a) { + var sameOrigin = a.href.startsWith('#') || a.href.startsWith(window.location.origin); + if (sameOrigin) { + delete a.target; + } else { + a.target = '_blank'; + } + }); + }); + }, 1000); + } + if (window.location.hash.startsWith('#/search')) { + var nodes = document.querySelectorAll('[data-ng-click="next()"],[data-ng-click="previous()"]'); + nodes.forEach(function(node) { + node.addEventListener('click', function() { + window.scrollTo(0, 0); + }); + }); + } + }); + +})(); diff --git a/WEB-INF/config-db/jdbc.properties b/WEB-INF/config-db/jdbc.properties index 62e695c..4d3ecf6 100644 --- a/WEB-INF/config-db/jdbc.properties +++ b/WEB-INF/config-db/jdbc.properties @@ -21,10 +21,10 @@ # Rome - Italy. email: geonetwork@osgeo.org # -jdbc.username=geonetwork -jdbc.password=gdibe_gn -jdbc.database=geonetwork -jdbc.host=10.10.114.113 +jdbc.username=postgres +jdbc.password=postgres +jdbc.database=gnos +jdbc.host=postgres jdbc.port=5432 jdbc.connectionProperties=#{systemEnvironment['GEONETWORK_DB_CONNECTION_PROPERTIES']} jdbc.basic.removeAbandoned=true diff --git a/WEB-INF/config.properties b/WEB-INF/config.properties index 6491732..b08ae52 100644 --- a/WEB-INF/config.properties +++ b/WEB-INF/config.properties @@ -9,13 +9,16 @@ usersavedselection.watchlist.frequency=0 0 4 * * ? usersavedselection.watchlist.searchurl=catalog.search#/search?_uuid={{filter}} # Define the link to each record sent by email by the watchlist notifier -usersavedselection.watchlist.recordurl=api/records/{{index:_uuid}} +usersavedselection.watchlist.recordurl=api/records/{{index:uuid}} -es.url= +es.protocol=http +es.port=9200 +es.host=elasticsearch +es.url=${es.protocol}://${es.host}:${es.port} es.username= es.password= -es.index.features= -es.index.features.type= +es.index.features=gn-features +es.index.features.type=features # Define the number of decimals to apply when converting geometries to GeoJSON # Too high value means more volume. Adapt the value depending on the precision # of the WFS harvested which usually allows to define a number of decimals @@ -24,13 +27,15 @@ es.index.features.numberOfDecimals=8 # Force reduction of geometry precision based on the number of decimals es.index.features.applyPrecisionModel=true es.index.features.featureCommitInterval=250 -es.index.records= -es.index.records.type= -es.index.records_public= -es.index.searchlogs= -es.index.searchlogs.type= +es.index.records=gn-records +es.index.records.type=records +es.index.records_public=${es.index.records_public} +es.index.searchlogs=gn-searchlogs +es.index.searchlogs.type=searchlogs -kb.url= +kb.url=http://kibana:5601 + +es.index.checker.interval=0/5 * * * * ? jms.url=tcp://localhost:61616 @@ -40,12 +45,9 @@ api.params.maxPageSize=20000 api.params.maxUploadSize=100000000 urlChecker.UserAgent=GeoNetwork Link Checker +thesaurus.cache.maxsize=400000 -map.bbox.background.service=https://sgx.geodatenzentrum.de/wms_basemapde?SERVICE=WMS&REQUEST=GetMap&VERSION=1.1.0&LAYERS=de_basemapde_web_raster_grau&STYLES=inspire_common:DEFAULT&SRS=25833&BBOX={minx},{miny},{maxx},{maxy}&WIDTH={width}&HEIGHT={height}&FORMAT=image/png - -#map.bbox.background.service=https://isk.geobasis-bb.de/mapproxy/webatlasde/service/wms?SERVICE=WMS&REQUEST=GetMap&VERSION=1.1.0&LAYERS=WebAtlasDE_BEBB_grau&STYLES=default&SRS={srs}&BBOX={minx},{miny},{maxx},{maxy}&WIDTH={width}&HEIGHT={height}&FORMAT=image/png - -#map.bbox.background.service=https://ows.terrestris.de/osm/service?SERVICE=WMS&REQUEST=GetMap&VERSION=1.1.0&LAYERS=OSM-WMS&STYLES=default&SRS={srs}&BBOX={minx},{miny},{maxx},{maxy}&WIDTH={width}&HEIGHT={height}&FORMAT=image/png +map.bbox.background.service=https://sgx.geodatenzentrum.de/wms_basemapde?SERVICE=WMS&REQUEST=GetMap&VERSION=1.1.0&LAYERS=de_basemapde_web_raster_grau&STYLES=inspire_common:DEFAULT&SRS={srs}&BBOX={minx},{miny},{maxx},{maxy}&WIDTH={width}&HEIGHT={height}&FORMAT=image/png # Set to false to enable the services to draw map extents (region.getmap and {metadatauuid}/extents.png) accepting # urls for map services to provide the background layers. Otherwise the only allowed options are from the settings diff --git a/catalog/style/srv_custom_style.less b/catalog/style/srv_custom_style.less index 4f3dcb6..26c827d 100644 --- a/catalog/style/srv_custom_style.less +++ b/catalog/style/srv_custom_style.less @@ -120,7 +120,7 @@ background-color: white; } .table-striped > tbody > tr:nth-of-type(2n+1) { - background-color: white + background-color: white } .gn-bottom-bar { height: 50px; @@ -148,7 +148,7 @@ background-color: white; } .navbar-default { - border-color:black; + border-color: black; } .gn-bottom-bar a:hover { color: white !important; @@ -171,5 +171,5 @@ .navbar-default .navbar-nav > li > a:focus, .navbar-default .navbar-nav > .open > a:focus, .navbar-default .navbar-nav > .active > a:focus { background-color: transparent; text-decoration: underline; + list-style-type: none !important; } -.list-style-type: none !important; diff --git a/catalog/views/default/less/gn_variables_default.less b/catalog/views/default/less/gn_variables_default.less index 00b23e6..f093617 100644 --- a/catalog/views/default/less/gn_variables_default.less +++ b/catalog/views/default/less/gn_variables_default.less @@ -77,3 +77,7 @@ // metadata page @gn-md-view-background-color: @body-bg; +@gn-search-button-border-color: @btn-default-border; +@gn-outline: 2px auto @brand-primary; +@gn-search-button-border-color: @btn-default-border; +@gn-resultcard-title-border-color: @panel-default-border; diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..666efe7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,58 @@ +version: '3' +services: + gnos: + container_name: gnos + build: + dockerfile: Dockerfile + context: ./ + restart: always + depends_on: + - postgres + ports: + - 8080:8080 + environment: + DATA_DIR: /var/lib/geonetwork_data + ES_HOST: elasticsearch + ES_PROTOCOL: http + ES_PORT: 9200 + + KB_URL: http://kibana:5601 + volumes: + - ./gn-public-data:/var/lib/geonetwork-data:z + - ./logs/:/var/lib/jetty/logs/:z + elasticsearch: + image: nexus.terrestris.de/elasticsearch:7.11.1 + container_name: elasticsearch + ulimits: + memlock: + soft: -1 + hard: -1 + nofile: + soft: 65536 + hard: 65536 + environment: + ES_JAVA_OPTS: "-Xms1G -Xmx1G" + discovery.type: single-node + volumes: + - ./esdata-public:/var/lib/elasticsearch/data:z + kibana: + image: nexus.terrestris.de/kibana:7.11.1 + container_name: kibana + environment: + SERVER_NAME: 'kibana' + ELASTICSEARCH_HOSTS: '["http://elasticsearch:9200"]' + SERVER_BASEPATH: '/geonetwork/dashboards' + SERVER_REWRITEBASEPATH: 'false' + KIBANA_INDEX: .dashboards + XPACK_MONITORING_UI_CONTAINER_ELASTICSEARCH_ENABLED: 'true' + postgres: + image: library/postgres:15 + container_name: postgres + restart: always + volumes: + - ./postgresql_data:/var/lib/postgresql/data:z + - ./dumps:/dumps:z + ports: + - 5555:5432 + environment: + POSTGRES_HOST_AUTH_METHOD: trust diff --git a/log4j2.xml b/log4j2.xml new file mode 100644 index 0000000..faabe52 --- /dev/null +++ b/log4j2.xml @@ -0,0 +1,141 @@ + + + + ./logs + + + + + + + ${sys:log_dir:-log_dir}/geonetwork.log + ${sys:log_dir:-log_dir}/geonetwork.log-%i.log + + + + + + + + + + + + + %date{ISO8601}{${ctx:timeZone}} %-5level [%logger] - %message%n + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +