From 2c70d03d11af7300eaff2a37ae3e5eb031fbfef2 Mon Sep 17 00:00:00 2001 From: mazano Date: Sun, 15 Oct 2023 13:25:45 +0200 Subject: [PATCH] Fix url for libturbo and update info (#578) --- README.md | 19 ++++++----------- scripts/setup.sh | 55 +++++++++++++++++++++--------------------------- scripts/start.sh | 4 +++- 3 files changed, 34 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index c101aa81..4829ac2b 100755 --- a/README.md +++ b/README.md @@ -132,6 +132,10 @@ docker build --build-arg IMAGE_VERSION=9-jdk11-openjdk-slim --build-arg JAVA_HOM **Note:** Please check the [GeoServer documentation](https://docs.geoserver.org/stable/en/user/production/index.html) to see which tomcat versions are supported. +We currently build the image using `tomcat:9.0.73-jdk11-temurin-focal` because +`libgdal-java` is no longer being built and support in base images > focal will not +have the java bindings for the [GDAL plugin](https://osgeo-org.atlassian.net/browse/GEOT-7412?focusedCommentId=84733). + ### Building on Windows These instructions detail the recommended process for reliably building this on Windows. @@ -674,28 +678,19 @@ http://localhost/geoserver/web/ To run the docker image with MacOS M1 Chip, the image needs to be built locally. -- JDK version of “9-jdk17-openjdk-slim-buster “ can work with M1 Chip as it is instructed on "Local build using -repository checkout" section, the parameters below needs to be changed in [.env](https://github.com/kartoza/docker-geoserver/blob/master/.env) file and [Dockerfile](https://github.com/kartoza/docker-geoserver/blob/master/Dockerfile) +- JDK version of `9-jdk17-openjdk-slim-buster` can work with M1 Chip as it is instructed on [Local build using +repository checkout](https://github.com/kartoza/docker-geoserver/#local-build-using-repository-checkout) section, the parameters below needs to be changed in [.env](https://github.com/kartoza/docker-geoserver/blob/master/.env) file ``` IMAGE_VERSION=9-jdk17-openjdk-slim-buster JAVA_HOME=/usr/local/openjdk-17 ``` - - The change above also requires the removal of some command-line options in -[entrypoint.sh](https://github.com/kartoza/docker-geoserver/blob/master/scripts/entrypoint.sh) file. -(Since they generate ```Unrecognized VM option 'CMSClassUnloadingEnabled' ``` error and these options are related to -JDK10 and lower) - -``` --XX:+CMSClassUnloadingEnabled --XX:+UseG1GC -``` After these changes, the image can be built as instructed. To run the just-built local image with your docker-compose file, the platform option in the docker-compose file -needs to be specified as ```linux/arm64/v8```. Otherwise, it will try to pull the docker image from the docker hub +needs to be specified as `linux/arm64/v8`. Otherwise, it will try to pull the docker image from the docker hub instead of using the local image. ## Kubernetes (Helm Charts) diff --git a/scripts/setup.sh b/scripts/setup.sh index 8e696622..cd8004cb 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -22,7 +22,7 @@ package_geoserver # Copy config files cp /build_data/stable_plugins.txt /stable_plugins && cp /build_data/community_plugins.txt /community_plugins && \ -cp /build_data/letsencrypt-tomcat.xsl ${CATALINA_HOME}/conf/ssl-tomcat.xsl +cp /build_data/letsencrypt-tomcat.xsl "${CATALINA_HOME}"/conf/ssl-tomcat.xsl validate_url http://ftp.br.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.8.1_all.deb && \ dpkg -i ttf-mscorefonts-installer_3.8.1_all.deb && rm ttf-mscorefonts-installer_3.8.1_all.deb @@ -31,12 +31,14 @@ validate_url http://ftp.br.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-ms pushd "${STABLE_PLUGINS_DIR}" || exit # Check if we have pre downloaded plugin yet -stable_count=$(ls -1 $resources_dir/plugins/stable_plugins/*.zip 2>/dev/null | wc -l) + +stable_count=$(find "$resources_dir/plugins/stable_plugins" -type f -name '*.zip' 2>/dev/null | wc -l) if [ "$stable_count" != 0 ]; then cp -r $resources_dir/plugins/stable_plugins/*.zip /stable_plugins/ fi -community_count=$(ls -1 $resources_dir/plugins/community_plugins/*.zip 2>/dev/null | wc -l) + +community_count=$(find "$resources_dir/plugins/community_plugins" -type f -name '*.zip' 2>/dev/null | wc -l) if [ "${community_count}" != 0 ]; then cp -r $resources_dir/plugins/community_plugin/*.zip /community_plugins/ fi @@ -72,11 +74,11 @@ fi #Install some mandatory stable extensions pushd ${resources_dir}/plugins || exit -array=(geoserver-${GS_VERSION}-vectortiles-plugin.zip geoserver-${GS_VERSION}-wps-plugin.zip geoserver-${GS_VERSION}-printing-plugin.zip - geoserver-${GS_VERSION}-libjpeg-turbo-plugin.zip geoserver-${GS_VERSION}-control-flow-plugin.zip - geoserver-${GS_VERSION}-pyramid-plugin.zip geoserver-${GS_VERSION}-gdal-plugin.zip - geoserver-${GS_VERSION}-monitor-plugin.zip geoserver-${GS_VERSION}-inspire-plugin.zip - geoserver-${GS_VERSION}-csw-plugin.zip geoserver-${GS_VERSION}-csw-iso-plugin.zip) +array=(geoserver-"${GS_VERSION}"-vectortiles-plugin.zip geoserver-"${GS_VERSION}"-wps-plugin.zip geoserver-"${GS_VERSION}"-printing-plugin.zip + geoserver-"${GS_VERSION}"-libjpeg-turbo-plugin.zip geoserver-"${GS_VERSION}"-control-flow-plugin.zip + geoserver-"${GS_VERSION}"-pyramid-plugin.zip geoserver-"${GS_VERSION}"-gdal-plugin.zip + geoserver-"${GS_VERSION}"-monitor-plugin.zip geoserver-"${GS_VERSION}"-inspire-plugin.zip + geoserver-"${GS_VERSION}"-csw-plugin.zip geoserver-"${GS_VERSION}"-csw-iso-plugin.zip) for i in "${array[@]}"; do url="${STABLE_PLUGIN_BASE_URL}/${GS_VERSION}/extensions/${i}" download_extension "${url}" "${i%.*}" ${resources_dir}/plugins @@ -85,12 +87,13 @@ done # Install libjpeg-turbo system_architecture=$(dpkg --print-architecture) -if [[ ! -f ${resources_dir}/libjpeg-turbo-official_2.1.3_amd64.deb ]]; then - validate_url https://tenet.dl.sourceforge.net/project/libjpeg-turbo/2.1.4/libjpeg-turbo-official_2.1.4_${system_architecture}.deb \ - '-P /tmp/resources/' +libjpeg_version=2.1.5 +if [[ ! -f ${resources_dir}/libjpeg-turbo-official_${libjpeg_version}_"${system_architecture}".deb ]]; then + wget https://master.dl.sourceforge.net/project/libjpeg-turbo/${libjpeg_version}/libjpeg-turbo-official_${libjpeg_version}_"${system_architecture}".deb?viasf=1 \ + -O ${resources_dir}/libjpeg-turbo-official_${libjpeg_version}_"${system_architecture}".deb fi -dpkg -i ${resources_dir}/libjpeg-turbo-official_2.1.4_${system_architecture}.deb +dpkg -i ${resources_dir}/libjpeg-turbo-official_${libjpeg_version}_"${system_architecture}".deb pushd "${CATALINA_HOME}" || exit @@ -101,33 +104,23 @@ GEOSERVER_INSTALL_DIR="$(detect_install_dir)" if ls /tmp/resources/plugins/*.zip >/dev/null 2>&1; then for p in /tmp/resources/plugins/*.zip; do unzip "$p" -d /tmp/gs_plugin && - mv /tmp/gs_plugin/*.jar "${GEOSERVER_INSTALL_DIR}"/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/ && + mv /tmp/gs_plugin/*.jar "${GEOSERVER_INSTALL_DIR}"/webapps/"${GEOSERVER_CONTEXT_ROOT}"/WEB-INF/lib/ && rm -rf /tmp/gs_plugin done fi -# Download appropriate gdal-jar -#GDAL_VERSION=$(gdalinfo --version | head -n1 | cut -d" " -f2) -#if [[ ${GDAL_VERSION:0:3} == 3.2 ]];then -# echo "gdal versions are the same" -#else -# rm /usr/local/tomcat/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/gdal-* -# validate_url https://repo1.maven.org/maven2/org/gdal/gdal/${GDAL_VERSION:0:3}.0/gdal-${GDAL_VERSION:0:3}.0.jar \ -# '-O "${GEOSERVER_HOME}"/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/gdal-${GDAL_VERSION:0:3}.0.jar' -#fi - # Install Marlin render https://www.geocat.net/docs/geoserver-enterprise/2020.5/install/production/marlin.html JAVA_VERSION=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}') -if [[ ${JAVA_VERSION} > 10 ]];then - if [[ -f $(find ${GEOSERVER_INSTALL_DIR}/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib -regex ".*marlin-[0-9]\.[0-9]\.[0-9].*jar") ]]; then - mv ${GEOSERVER_INSTALL_DIR}/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/marlin-* ${GEOSERVER_INSTALL_DIR}/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/marlin-render.jar +if [[ ${JAVA_VERSION} -gt 10 ]];then + if [[ -f $(find "${GEOSERVER_INSTALL_DIR}"/webapps/"${GEOSERVER_CONTEXT_ROOT}"/WEB-INF/lib -regex ".*marlin-[0-9]\.[0-9]\.[0-9].*jar") ]]; then + mv "${GEOSERVER_INSTALL_DIR}"/webapps/"${GEOSERVER_CONTEXT_ROOT}"/WEB-INF/lib/marlin-* "${GEOSERVER_INSTALL_DIR}"/webapps/"${GEOSERVER_CONTEXT_ROOT}"/WEB-INF/lib/marlin-render.jar fi else - if [[ -f $(find ${GEOSERVER_INSTALL_DIR}/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib -regex ".*marlin-[0-9]\.[0-9]\.[0-9].*jar") ]]; then - rm "${GEOSERVER_INSTALL_DIR}"/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/marlin-* \ + if [[ -f $(find "${GEOSERVER_INSTALL_DIR}"/webapps/"${GEOSERVER_CONTEXT_ROOT}"/WEB-INF/lib -regex ".*marlin-[0-9]\.[0-9]\.[0-9].*jar") ]]; then + rm "${GEOSERVER_INSTALL_DIR}"/webapps/"${GEOSERVER_CONTEXT_ROOT}"/WEB-INF/lib/marlin-* \ validate_url https://github.com/bourgesl/marlin-renderer/releases/download/v0_9_4_2_jdk9/marlin-0.9.4.2-Unsafe-OpenJDK9.jar && \ - mv marlin-0.9.4.2-Unsafe-OpenJDK9.jar ${GEOSERVER_INSTALL_DIR}/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/marlin-render.jar + mv marlin-0.9.4.2-Unsafe-OpenJDK9.jar "${GEOSERVER_INSTALL_DIR}"/webapps/"${GEOSERVER_CONTEXT_ROOT}"/WEB-INF/lib/marlin-render.jar fi fi @@ -135,7 +128,7 @@ fi if [[ -f ${GEOSERVER_HOME}/start.jar ]]; then if [[ ! -f ${GEOSERVER_HOME}/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/jetty-servlets.jar ]]; then validate_url https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-servlets/11.0.9/jetty-servlets-11.0.9.jar \ - '-O "${GEOSERVER_HOME}"/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/jetty-servlets.jar' + "-O ${GEOSERVER_HOME}/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/jetty-servlets.jar" fi fi @@ -143,7 +136,7 @@ fi if [[ -f ${GEOSERVER_HOME}/start.jar ]]; then if [[ ! -f ${GEOSERVER_HOME}/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/jetty-util.jar ]]; then validate_url https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-util/11.0.9/jetty-util-11.0.9.jar \ - '-O "${GEOSERVER_HOME}"/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/jetty-util.jar' + "-O ${GEOSERVER_HOME}/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/jetty-util.jar" fi fi diff --git a/scripts/start.sh b/scripts/start.sh index 12fa4597..92174cfc 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -152,7 +152,9 @@ export READONLY CLUSTER_DURABILITY BROKER_URL EMBEDDED_BROKER TOGGLE_MASTER TOG export CLUSTER_CONFIG_DIR MONITOR_AUDIT_PATH INSTANCE_STRING # Cleanup existing monitoring files if [[ ${CLUSTERING} =~ [Ff][Aa][Ll][Ss][Ee] ]]; then -find "${GEOSERVER_DATA_DIR}"/monitoring -type d -name 'monitor_*' -exec rm -r {} + + if [[ -d "${GEOSERVER_DATA_DIR}"/monitoring ]];then + find "${GEOSERVER_DATA_DIR}"/monitoring -type d -name 'monitor_*' -exec rm -r {} + + fi fi create_dir "${MONITOR_AUDIT_PATH}" setup_monitoring