From 1afa2c8cd1e233d9f0913d6e5fe7dc15441250e9 Mon Sep 17 00:00:00 2001 From: Jody Garnett Date: Thu, 27 Apr 2023 19:53:56 -0700 Subject: [PATCH] Support for nightly builds --- BUILD.md | 64 +++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 13 ++++++--- README.md | 16 +++++------ install-extensions.sh | 6 +++- 4 files changed, 86 insertions(+), 13 deletions(-) diff --git a/BUILD.md b/BUILD.md index 568e615..631d999 100644 --- a/BUILD.md +++ b/BUILD.md @@ -54,3 +54,67 @@ docker build \ --build-arg ADDITIONAL_LIBS_PATH={RELATIVE_PATH_TO_YOUR_LIBS} -t {YOUR_TAG} . ``` + +## How to build from nightly snapshot releases? + +By default ``WAR_ZIP_URL``, ``STABLE_PLUGIN_URL`` make use of sourceforge downloads to obtain official releases. + +Override these arguments to make use of build.geoserver.org nightly releases: + +* ``--build-arg WAR_ZIP_URL=https://build.geoserver.org/geoserver/${GS_VERSION}/geoserver-${GS_VERSION}-latest-war.zip`` +* ``--build-arg STABLE_PLUGIN_URL=https://build.geoserver.org/geoserver/${GS_VERSION}/ext-latest/`` +* ``--build-arg COMMUNITY_PLUGIN_URL=https://build.geoserver.org/geoserver/${GS_VERSION}/community-latest/`` + + +Here is a working example for building 2.23.x nightly build:: +``` +docker build \ + --build-arg WAR_ZIP_URL=https://build.geoserver.org/geoserver/2.23.x/geoserver-2.23.x-latest-war.zip \ + --build-arg STABLE_PLUGIN_URL=https://build.geoserver.org/geoserver/2.23.x/ext-latest/ \ + --build-arg COMMUNITY_PLUGIN_URL=https://build.geoserver.org/geoserver/2.23.x/community-latest/ \ + --build-arg GS_VERSION=2.23-SNAPSHOT \ + -t 2.23.x . +``` + +When running both stable extensions and community modules can be included: + +``` +docker run -it -p 80:8080 \ + --env INSTALL_EXTENSIONS=true \ + --env STABLE_EXTENSIONS="ysld" \ + --env COMMUNITY_EXTENSIONS="ogcapi" \ + -t 2.23.x +``` + +Community modules are only available for nightly builds as they have not yet met the requirements for production use. Developers have shared these to attract participation, feedback and funding. + +## How to build from main snapshot releases? + +The build.geoserver.org output for the ``main`` branch requires the following: + +* ``--build-arg WAR_ZIP_URL=https://build.geoserver.org/geoserver/main/geoserver-main-latest-war.zip`` +* ``--build-arg STABLE_PLUGIN_URL=https://build.geoserver.org/geoserver/main/ext-latest/`` +* ``--build-arg COMMUNITY_PLUGIN_URL=https://build.geoserver.org/geoserver/main/community-latest/`` + + +Here is a working example for building main branch as 2.24.x build: + +``` +docker build \ + --build-arg WAR_ZIP_URL=https://build.geoserver.org/geoserver/main/geoserver-main-latest-war.zip \ + --build-arg STABLE_PLUGIN_URL=https://build.geoserver.org/geoserver/main/ext-latest/ \ + --build-arg COMMUNITY_PLUGIN_URL=https://build.geoserver.org/geoserver/main/community-latest/ \ + --build-arg GS_VERSION=2.24-SNAPSHOT \ + -t 2.24.x . +``` + +When running both [stable extensions](https://build.geoserver.org/geoserver/main/ext-latest/) and [community modules](https://build.geoserver.org/geoserver/main/community-latest/) can be included: + +``` +docker run -it -p 80:8080 \ + --env INSTALL_EXTENSIONS=true \ + --env STABLE_EXTENSIONS="wps,css" \ + --env COMMUNITY_EXTENSIONS="ogcapi-coverages,ogcapi-dggs,ogcapi-features,ogcapi-images,ogcapi-maps,ogcapi-styles,ogcapi-tiled-features,ogcapi-tiles" \ + -t 2.24.x +``` + diff --git a/Dockerfile b/Dockerfile index d5e4658..bc91930 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ FROM ubuntu:22.04 # The GS_VERSION argument could be used like this to overwrite the default: -# docker build --build-arg GS_VERSION=2.21.2 -t geoserver:2.21.2 . -ARG TOMCAT_VERSION=9.0.68 -ARG GS_VERSION=2.22.0 +# docker build --build-arg GS_VERSION=2.23.0 -t geoserver:2.23.0 . +ARG TOMCAT_VERSION=9.0.74 +ARG GS_VERSION=2.23.0 ARG GS_DATA_PATH=./geoserver_data/ ARG ADDITIONAL_LIBS_PATH=./additional_libs/ ARG ADDITIONAL_FONTS_PATH=./additional_fonts/ @@ -11,7 +11,9 @@ ARG CORS_ENABLED=false ARG CORS_ALLOWED_ORIGINS=* ARG CORS_ALLOWED_METHODS=GET,POST,PUT,DELETE,HEAD,OPTIONS ARG CORS_ALLOWED_HEADERS=* +ARG WAR_ZIP_URL=https://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/geoserver-${GS_VERSION}-war.zip ARG STABLE_PLUGIN_URL=https://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/extensions +ARG COMMUNITY_PLUGIN_URL='' # Environment variables ENV CATALINA_HOME=/opt/apache-tomcat-${TOMCAT_VERSION} @@ -26,8 +28,11 @@ ENV CORS_ALLOWED_METHODS=$CORS_ALLOWED_METHODS ENV CORS_ALLOWED_HEADERS=$CORS_ALLOWED_HEADERS ENV DEBIAN_FRONTEND=noninteractive ENV INSTALL_EXTENSIONS=false +ENV WAR_ZIP_URL=$WAR_ZIP_URL ENV STABLE_EXTENSIONS='' ENV STABLE_PLUGIN_URL=$STABLE_PLUGIN_URL +ENV COMMUNITY_EXTENSIONS='' +ENV COMMUNITY_PLUGIN_URL=$COMMUNITY_PLUGIN_URL ENV ADDITIONAL_LIBS_DIR=/opt/additional_libs/ ENV ADDITIONAL_FONTS_DIR=/opt/additional_fonts/ ENV SKIP_DEMO_DATA=false @@ -63,7 +68,7 @@ RUN wget -q https://archive.apache.org/dist/tomcat/tomcat-9/v${TOMCAT_VERSION}/b WORKDIR /tmp # install geoserver -RUN wget -q -O /tmp/geoserver.zip https://downloads.sourceforge.net/project/geoserver/GeoServer/$GEOSERVER_VERSION/geoserver-$GEOSERVER_VERSION-war.zip && \ +RUN wget -q -O /tmp/geoserver.zip $WAR_ZIP_URL && \ unzip geoserver.zip geoserver.war -d $CATALINA_HOME/webapps && \ mkdir -p $CATALINA_HOME/webapps/geoserver && \ unzip -q $CATALINA_HOME/webapps/geoserver.war -d $CATALINA_HOME/webapps/geoserver && \ diff --git a/README.md b/README.md index 440eff6..b8e0c2b 100644 --- a/README.md +++ b/README.md @@ -18,19 +18,19 @@ This README.md file covers use of official docker image, additional [build](BULD To pull an official image use ``docker.osgeo.org/geoserver:{{VERSION}}``, e.g.: ```shell -docker pull docker.osgeo.org/geoserver:2.22.0 +docker pull docker.osgeo.org/geoserver:2.23.0 ``` Afterwards you can run the pulled image locally with: ```shell -docker run -it -p 80:8080 docker.osgeo.org/geoserver:2.22.0 +docker run -it -p 80:8080 docker.osgeo.org/geoserver:2.23.0 ``` Or if you want to start the container daemonized, use e.g.: ```shell -docker run -d -p 80:8080 docker.osgeo.org/geoserver:2.22.0 +docker run -d -p 80:8080 docker.osgeo.org/geoserver:2.23.0 ``` Check to see the geoserver page, @@ -47,7 +47,7 @@ To use an external folder as your geoserver data directory. ```shell docker run -it -p 80:8080 \ --mount src="/absolute/path/on/host",target=/opt/geoserver_data/,type=bind \ - docker.osgeo.org/geoserver:2.22.0 + docker.osgeo.org/geoserver:2.23.0 ``` An empty data directory will be populated on first use. You can easily update GeoServer while @@ -62,7 +62,7 @@ The environment variable `SKIP_DEMO_DATA` can be set to `true` to create an empt ```shell docker run -it -p 80:8080 \ --env SKIP_DEMO_DATA=true \ - docker.osgeo.org/geoserver:2.22.0 + docker.osgeo.org/geoserver:2.23.0 ``` ## How to issue a redirect from the root ("/") to GeoServer web interface ("/geoserver/web")? @@ -83,7 +83,7 @@ Example installing wps and ysld extensions: ```shell docker run -it -p 80:8080 \ --env INSTALL_EXTENSIONS=true --env STABLE_EXTENSIONS="wps,ysld" \ - docker.osgeo.org/geoserver:2.22.0 + docker.osgeo.org/geoserver:2.23.0 ``` The list of extensions (taken from SourceForge download page): @@ -108,7 +108,7 @@ If you want to add geoserver extensions/libs, place the respective jar files in ```shell docker run -it -p 80:8080 \ --mount src="/dir/with/libs/on/host",target=/opt/additional_libs,type=bind \ - docker.osgeo.org/geoserver:2.22.0 + docker.osgeo.org/geoserver:2.23.0 ``` ## How to add additional fonts to the docker image (e.g. for SLD styling)? @@ -118,7 +118,7 @@ If you want to add custom fonts (the base image only contains 26 fonts) by using ```shell docker run -it -p 80:8080 \ --mount src="/dir/with/fonts/on/host",target=/opt/additional_fonts,type=bind \ - docker.osgeo.org/geoserver:2.22.0 + docker.osgeo.org/geoserver:2.23.0 ``` **Note:** Do not change the target value! diff --git a/install-extensions.sh b/install-extensions.sh index 345d4bf..fea456b 100644 --- a/install-extensions.sh +++ b/install-extensions.sh @@ -28,12 +28,16 @@ if [ "$INSTALL_EXTENSIONS" = "true" ]; then URL="${STABLE_PLUGIN_URL}/geoserver-${GEOSERVER_VERSION}-${EXTENSION}-plugin.zip" download_extension ${URL} ${EXTENSION} done + for EXTENSION in $(echo "${COMMUNITY_EXTENSIONS}" | tr ',' ' '); do + URL="${COMMUNITY_PLUGIN_URL}/geoserver-${GEOSERVER_VERSION}-${EXTENSION}-plugin.zip" + download_extension ${URL} ${EXTENSION} + done echo "Finished download of extensions" fi # Install the extensions echo "Starting installation of extensions" -for EXTENSION in $(echo "${STABLE_EXTENSIONS}" | tr ',' ' '); do +for EXTENSION in $(echo "${STABLE_EXTENSIONS},${COMMUNITY_EXTENSIONS}" | tr ',' ' '); do ADDITIONAL_LIB=${ADDITIONAL_LIBS_DIR}geoserver-${GEOSERVER_VERSION}-${EXTENSION}-plugin.zip [ -e "$ADDITIONAL_LIB" ] || continue