# HG changeset patch # User Tom Gottfried # Date 1662393332 -7200 # Node ID cfc0aab9947f24a06905cbfdb11d22e33c7d76bc # Parent 1a1e627b14839fe80edd10154e76b7ef1064e3e9 Enable bind-mounting client configuration in docker container diff -r 1a1e627b1483 -r cfc0aab9947f docker/Dockerfile.gwt-client --- a/docker/Dockerfile.gwt-client Tue Aug 30 15:02:10 2022 +0200 +++ b/docker/Dockerfile.gwt-client Mon Sep 05 17:55:32 2022 +0200 @@ -41,6 +41,8 @@ # Configure tomcat RUN sed -i '/Connector port="8080"/a \URIEncoding="UTF-8"' /etc/tomcat/server.xml +RUN ln -sf /opt/d4e/river/gwt-client/config/context.xml /etc/tomcat +VOLUME /opt/d4e/river/gwt-client/config USER tomcat ADD docker/flys_user_file /usr/share/tomcat/ diff -r 1a1e627b1483 -r cfc0aab9947f docker/README --- a/docker/README Tue Aug 30 15:02:10 2022 +0200 +++ b/docker/README Mon Sep 05 17:55:32 2022 +0200 @@ -3,7 +3,7 @@ artifacts/doc/conf/floodmap.xml and artifacts/doc/conf/rivermap.xml _ Change 'example.com' to the hostname of your docker host plus ':8082' in artifacts/doc/conf/conf.xml -_ Add to gwt-client/src/main/webapp/WEB-INF/config.yaml to enable map printing: +_ Add to gwt-client/config/mapfish/config.yaml to enable map printing: - !dnsMatch host: port: 8081 diff -r 1a1e627b1483 -r cfc0aab9947f docker/docker-compose.yml --- a/docker/docker-compose.yml Tue Aug 30 15:02:10 2022 +0200 +++ b/docker/docker-compose.yml Mon Sep 05 17:55:32 2022 +0200 @@ -61,7 +61,7 @@ - mapserv - wiki volumes: - - ../:/opt/d4e/river + - ../gwt-client/config:/opt/d4e/river/gwt-client/config ports: - 8080:8080 networks: diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/config/context.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gwt-client/config/context.xml Mon Sep 05 17:55:32 2022 +0200 @@ -0,0 +1,5 @@ + + + + diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/config/features.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gwt-client/config/features.xml Mon Sep 05 17:55:32 2022 +0200 @@ -0,0 +1,16 @@ + + + + module:winfo + module:minfo + module:new_map + module:new_chart + module:fixanalysis + river:Beispielfluss + + + module:winfo + module:minfo + river:Beispielfluss + + diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/config/mapfish/config.yaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gwt-client/config/mapfish/config.yaml Mon Sep 05 17:55:32 2022 +0200 @@ -0,0 +1,266 @@ +#=========================================================================== +# allowed DPIs +#=========================================================================== +dpis: [254, 190, 127, 72, 56] + +#=========================================================================== +# allowed Formats +#=========================================================================== +formats: ['*'] + +#=========================================================================== +# the allowed scales +#=========================================================================== +scales: + - 500 + - 750 + - 1000 + - 1250 + - 1500 + - 1750 + - 2000 + - 2250 + - 2500 + - 2750 + - 3000 + - 3250 + - 3500 + - 3750 + - 4000 + - 4250 + - 4500 + - 4750 + - 5000 + - 5500 + - 6000 + - 6500 + - 7000 + - 7500 + - 8000 + - 8500 + - 9000 + - 9500 + - 10000 + - 12500 + - 15000 + - 17500 + - 20000 + - 22500 + - 25000 + - 30000 + - 35000 + - 40000 + - 45000 + - 50000 + - 75000 + - 100000 + - 200000 + - 500000 + - 1000000 + - 2000000 + - 4000000 + +outputFilename: 'd4e-${date}.pdf' + +#=========================================================================== +# the list of allowed hosts +#=========================================================================== +hosts: + - !localMatch + dummy: true + - !dnsMatch + host: www.pegelonline.wsv.de + port: 80 + - !dnsMatch + host: tile.openstreetmap.org + port: 80 + # Catch all + #- !dnsMatch + # host: #regex that catches host plus path + # port: 80 + - !dnsMatch + host: osm.intevation.de + port: 80 + +# We need a font with unicode support the defaults only +# have latin1 +fonts: + - /usr/share/fonts/gnu-free/FreeSans.ttf + +layouts: + #=========================================================================== + A4 landscape: + #=========================================================================== + metaData: + title: '${mapTitle}' + author: 'Dive4Elements River' + subject: 'Kartendruck' + keywords: 'map,print' + creator: 'd4e-river' + + #------------------------------------------------------------------------- + mainPage: + # 842 * 595 + pageSize: A4 + landscape: true + marginLeft: 20 + marginRight: 20 + marginTop: 20 + marginBottom: 20 + items: + - !map + absoluteX: 20 + align: left + absoluteY: 575 + width: 587 + height: 555 + spacingAfter: 0 + # The north arrow + - !columns + absoluteX: 627 + absoluteY: 65 + width: 32 + items: + - !image + maxWidth: 20 + maxHeight: 40 + url: '${configDir}/images/north.png' + # The scale text + - !columns + absoluteX: 615 + absoluteY: 30 + width: 45 + items: + - !text + fontSize: 8 + text: '1:${scale}' + align: center + fontEncoding: Identity-H + font: FreeSans + backgroundColor: #FFFFFF + #Flys and BFG Logo + - !columns + absoluteX: 760 + absoluteY: 70 + width: 50 + items: + - !image + maxWidth: 50 + maxHeight: 50 + url: '${configDir}/images/FLYS_Logo.png' + - !columns + absoluteX: 665 + absoluteY: 70 + width: 75 + items: + - !image + maxWidth: 75 + maxHeight: 50 + url: '${configDir}/${logo}' + # Scalebar + - !columns + absoluteX: 455 + absoluteY: 40 + width: 150 + items: + - !scalebar + type: bar + maxSize: 150 + barSize: 5 + barBgColor: white + fontSize: 8 + backgroundColor: #FFFFFF + # The legend + - !columns + absoluteX: 612 + absoluteY: 385 + width: 200 + items: + - !legends + maxHeight: 350 + maxWidth: 0 + maxIconHeight: 0 + inline: true + classIndentation: 10 + layerSpace: 0 + classSpace: 5 + layerFontSize: 0 + classFontSize: 10 + fontEncoding: Identity-H + classFont: FreeSans + layerFont: FreeSans + defaultScale: 0.7 + config: + borderWidthLeft: 1 + borderWidthRight: 1 + borderWidthTop: 1 + borderWidthBottom: 1 + # The stamp background + - !columns + absoluteX: 557 + absoluteY: 575 + width: 260 + items: + - !image + maxWidth: 260 + maxHeight: 190 + url: '${configDir}/images/white.png' + + # Title of the map + - !columns + absoluteX: 562 + absoluteY: 575 + width: 250 + condition: mapTitle + items: + - !text + fontSize: 18 + text: '${mapTitle}' + + # The Stamp + - !columns + absoluteX: 562 + absoluteY: 550 + width: 250 + config: + borderWidth: 1 + items: + - !attributes + source: data + spacingAfter: 0 + columnDefs: + info: + columnWeight: 7 + header: !text + text: info + fontSize: 0 + cell: !columns + config: + cells: + - borderWidth: 0.5 + padding: 5 + items: + - !text + text: '${info}' + fontSize: 10 + fontEncoding: Identity-H + font: FreeSans + fontSize: 10 + backgroundColor: #FFFFFF + value: + columnWeight: 15 + header: !text + text: value + fontSize: 0 + cell: !columns + config: + cells: + - borderWidth: 0.5 + padding: 5 + items: + - !text + text: '${value}' + fontEncoding: Identity-H + font: FreeSans + fontSize: 10 + backgroundColor: #FFFFFF diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/config/mapfish/images/FLYS_Logo.png Binary file gwt-client/config/mapfish/images/FLYS_Logo.png has changed diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/config/mapfish/images/bfg_logo.gif Binary file gwt-client/config/mapfish/images/bfg_logo.gif has changed diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/config/mapfish/images/north.png Binary file gwt-client/config/mapfish/images/north.png has changed diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/config/mapfish/images/white.png Binary file gwt-client/config/mapfish/images/white.png has changed diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/src/main/java/org/dive4elements/river/client/server/BaseServletContextListener.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/BaseServletContextListener.java Tue Aug 30 15:02:10 2022 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/BaseServletContextListener.java Mon Sep 05 17:55:32 2022 +0200 @@ -8,6 +8,7 @@ package org.dive4elements.river.client.server; +import java.io.File; import java.io.IOException; import javax.servlet.ServletContext; @@ -33,12 +34,14 @@ public void contextInitialized(ServletContextEvent sce) { ServletContext sc = sce.getServletContext(); - String filename = sc.getInitParameter("features-file"); + File file = new File(sc.getInitParameter("features-file")); + String path = file.isAbsolute() + ? file.getPath() + : sc.getRealPath(file.getPath()); log.debug("Initializing ServletContext"); try { - XMLFileFeatures features = new XMLFileFeatures( - sc.getRealPath(filename)); + XMLFileFeatures features = new XMLFileFeatures(path); sc.setAttribute(Features.CONTEXT_ATTRIBUTE, features); } catch(IOException e) { log.error(e); diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/src/main/java/org/dive4elements/river/client/server/SamlServlet.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/SamlServlet.java Tue Aug 30 15:02:10 2022 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/SamlServlet.java Mon Sep 05 17:55:32 2022 +0200 @@ -8,6 +8,7 @@ package org.dive4elements.river.client.server; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.StringBufferInputStream; @@ -71,12 +72,14 @@ Assertion assertion = null; try { - String keyfile = - (String)sc.getInitParameter("saml-trusted-public-key"); + File keyfile = new File( + sc.getInitParameter("saml-trusted-public-key")); + String path = keyfile.isAbsolute() + ? keyfile.getPath() + : sc.getRealPath(keyfile.getPath()); int timeEps = Integer.parseInt( sc.getInitParameter("saml-time-tolerance")); - TicketValidator validator = - new TicketValidator(sc.getRealPath(keyfile), timeEps); + TicketValidator validator = new TicketValidator(path, timeEps); InputStream in = new StringBufferInputStream(samlTicketXML); assertion = validator.checkTicket(new Base64InputStream(in)); diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/src/main/java/org/dive4elements/river/client/server/auth/was/Authenticator.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/was/Authenticator.java Tue Aug 30 15:02:10 2022 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/was/Authenticator.java Mon Sep 05 17:55:32 2022 +0200 @@ -8,6 +8,7 @@ package org.dive4elements.river.client.server.auth.was; +import java.io.File; import java.io.IOException; import java.security.GeneralSecurityException; import javax.servlet.ServletContext; @@ -62,12 +63,15 @@ return null; } else { - String trustedKey = - (String)context.getInitParameter("saml-trusted-public-key"); + File trustedKey = new File( + context.getInitParameter("saml-trusted-public-key")); + String path = trustedKey.isAbsolute() + ? trustedKey.getPath() + : context.getRealPath(trustedKey.getPath()); String timeEpsilon = context.getInitParameter( "saml-time-tolerance"); return new Response(entity, username, password, features, - context.getRealPath(trustedKey), timeEpsilon); + path, timeEpsilon); } } catch(GeneralSecurityException e) { diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/src/main/webapp/WEB-INF/config.yaml --- a/gwt-client/src/main/webapp/WEB-INF/config.yaml Tue Aug 30 15:02:10 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,266 +0,0 @@ -#=========================================================================== -# allowed DPIs -#=========================================================================== -dpis: [254, 190, 127, 72, 56] - -#=========================================================================== -# allowed Formats -#=========================================================================== -formats: ['*'] - -#=========================================================================== -# the allowed scales -#=========================================================================== -scales: - - 500 - - 750 - - 1000 - - 1250 - - 1500 - - 1750 - - 2000 - - 2250 - - 2500 - - 2750 - - 3000 - - 3250 - - 3500 - - 3750 - - 4000 - - 4250 - - 4500 - - 4750 - - 5000 - - 5500 - - 6000 - - 6500 - - 7000 - - 7500 - - 8000 - - 8500 - - 9000 - - 9500 - - 10000 - - 12500 - - 15000 - - 17500 - - 20000 - - 22500 - - 25000 - - 30000 - - 35000 - - 40000 - - 45000 - - 50000 - - 75000 - - 100000 - - 200000 - - 500000 - - 1000000 - - 2000000 - - 4000000 - -outputFilename: 'd4e-${date}.pdf' - -#=========================================================================== -# the list of allowed hosts -#=========================================================================== -hosts: - - !localMatch - dummy: true - - !dnsMatch - host: www.pegelonline.wsv.de - port: 80 - - !dnsMatch - host: tile.openstreetmap.org - port: 80 - # Catch all - #- !dnsMatch - # host: #regex that catches host plus path - # port: 80 - - !dnsMatch - host: osm.intevation.de - port: 80 - -# We need a font with unicode support the defaults only -# have latin1 -fonts: - - /usr/share/fonts/gnu-free/FreeSans.ttf - -layouts: - #=========================================================================== - A4 landscape: - #=========================================================================== - metaData: - title: '${mapTitle}' - author: 'Dive4Elements River' - subject: 'Kartendruck' - keywords: 'map,print' - creator: 'd4e-river' - - #------------------------------------------------------------------------- - mainPage: - # 842 * 595 - pageSize: A4 - landscape: true - marginLeft: 20 - marginRight: 20 - marginTop: 20 - marginBottom: 20 - items: - - !map - absoluteX: 20 - align: left - absoluteY: 575 - width: 587 - height: 555 - spacingAfter: 0 - # The north arrow - - !columns - absoluteX: 627 - absoluteY: 65 - width: 32 - items: - - !image - maxWidth: 20 - maxHeight: 40 - url: '${configDir}/../images/north.png' - # The scale text - - !columns - absoluteX: 615 - absoluteY: 30 - width: 45 - items: - - !text - fontSize: 8 - text: '1:${scale}' - align: center - fontEncoding: Identity-H - font: FreeSans - backgroundColor: #FFFFFF - #Flys and BFG Logo - - !columns - absoluteX: 760 - absoluteY: 70 - width: 50 - items: - - !image - maxWidth: 50 - maxHeight: 50 - url: '${configDir}/../images/FLYS_Logo.png' - - !columns - absoluteX: 665 - absoluteY: 70 - width: 75 - items: - - !image - maxWidth: 75 - maxHeight: 50 - url: '${configDir}/../${logo}' - # Scalebar - - !columns - absoluteX: 455 - absoluteY: 40 - width: 150 - items: - - !scalebar - type: bar - maxSize: 150 - barSize: 5 - barBgColor: white - fontSize: 8 - backgroundColor: #FFFFFF - # The legend - - !columns - absoluteX: 612 - absoluteY: 385 - width: 200 - items: - - !legends - maxHeight: 350 - maxWidth: 0 - maxIconHeight: 0 - inline: true - classIndentation: 10 - layerSpace: 0 - classSpace: 5 - layerFontSize: 0 - classFontSize: 10 - fontEncoding: Identity-H - classFont: FreeSans - layerFont: FreeSans - defaultScale: 0.7 - config: - borderWidthLeft: 1 - borderWidthRight: 1 - borderWidthTop: 1 - borderWidthBottom: 1 - # The stamp background - - !columns - absoluteX: 557 - absoluteY: 575 - width: 260 - items: - - !image - maxWidth: 260 - maxHeight: 190 - url: '${configDir}/../images/white.png' - - # Title of the map - - !columns - absoluteX: 562 - absoluteY: 575 - width: 250 - condition: mapTitle - items: - - !text - fontSize: 18 - text: '${mapTitle}' - - # The Stamp - - !columns - absoluteX: 562 - absoluteY: 550 - width: 250 - config: - borderWidth: 1 - items: - - !attributes - source: data - spacingAfter: 0 - columnDefs: - info: - columnWeight: 7 - header: !text - text: info - fontSize: 0 - cell: !columns - config: - cells: - - borderWidth: 0.5 - padding: 5 - items: - - !text - text: '${info}' - fontSize: 10 - fontEncoding: Identity-H - font: FreeSans - fontSize: 10 - backgroundColor: #FFFFFF - value: - columnWeight: 15 - header: !text - text: value - fontSize: 0 - cell: !columns - config: - cells: - - borderWidth: 0.5 - padding: 5 - items: - - !text - text: '${value}' - fontEncoding: Identity-H - font: FreeSans - fontSize: 10 - backgroundColor: #FFFFFF diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/src/main/webapp/WEB-INF/features.xml --- a/gwt-client/src/main/webapp/WEB-INF/features.xml Tue Aug 30 15:02:10 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ - - - - module:winfo - module:minfo - module:new_map - module:new_chart - module:fixanalysis - river:Beispielfluss - - - module:winfo - module:minfo - river:Beispielfluss - - diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/src/main/webapp/WEB-INF/web.xml --- a/gwt-client/src/main/webapp/WEB-INF/web.xml Tue Aug 30 15:02:10 2022 +0200 +++ b/gwt-client/src/main/webapp/WEB-INF/web.xml Mon Sep 05 17:55:32 2022 +0200 @@ -49,7 +49,7 @@ saml-trusted-public-key - /WEB-INF/saml-signer-cert.pem + /opt/d4e/river/gwt-client/config/saml-signer-cert.pem @@ -61,7 +61,7 @@ features-file - /WEB-INF/features.xml + /opt/d4e/river/gwt-client/config/features.xml @@ -336,7 +336,7 @@ org.mapfish.print.servlet.MapPrinterServlet config - WEB-INF/config.yaml + /opt/d4e/river/gwt-client/config/mapfish/config.yaml @@ -351,7 +351,7 @@ org.dive4elements.river.client.server.MapPrintServiceImpl config - WEB-INF/config.yaml + /opt/d4e/river/gwt-client/config/mapfish/config.yaml print-url diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/src/main/webapp/images/FLYS_Logo.png Binary file gwt-client/src/main/webapp/images/FLYS_Logo.png has changed diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/src/main/webapp/images/north.png Binary file gwt-client/src/main/webapp/images/north.png has changed diff -r 1a1e627b1483 -r cfc0aab9947f gwt-client/src/main/webapp/images/white.png Binary file gwt-client/src/main/webapp/images/white.png has changed