diff --git a/build_data/plugin_download.sh b/build_data/plugin_download.sh index f6db6d2a..305ccf75 100755 --- a/build_data/plugin_download.sh +++ b/build_data/plugin_download.sh @@ -27,5 +27,22 @@ if [[ "${WAR_URL}" == *\.zip ]]; then curl --progress-bar -fLvo "${destination}" "${WAR_URL}" || exit 1 fi +# Download Jetty Services +curl -vfLo /work/required_plugins/jetty-servlets.jar https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-servlets/11.0.9/jetty-servlets-11.0.9.jar + +# Download jetty-util +curl -vfLo /work/required_plugins/jetty-util.jar https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-util/11.0.9/jetty-util-11.0.9.jar + + + # Download everything! -curl --progress-bar -vK /work/curl.cfg +for attempt in {1..5}; do + echo "Attempt $attempt of downloading plugins" + if curl --progress-bar -vK /work/curl.cfg; then + echo "Download successful" + break + else + echo "Download failed, retrying in 10 seconds..." + sleep 10 + fi +done diff --git a/scenario_tests/clustering/docker-compose-external.yml b/scenario_tests/clustering/docker-compose-external.yml index 742d38af..845cf415 100644 --- a/scenario_tests/clustering/docker-compose-external.yml +++ b/scenario_tests/clustering/docker-compose-external.yml @@ -8,7 +8,7 @@ x-common-activemq: services: db: - image: kartoza/postgis:16-3.4 + image: kartoza/postgis:17-3.5 volumes: - geo-db-data:/var/lib/postgresql - ./tests/init.sql:/docker-entrypoint-initdb.d/init.sql diff --git a/scenario_tests/clustering/docker-compose.yml b/scenario_tests/clustering/docker-compose.yml index a619cbee..753c0693 100644 --- a/scenario_tests/clustering/docker-compose.yml +++ b/scenario_tests/clustering/docker-compose.yml @@ -4,7 +4,7 @@ volumes: services: db: - image: kartoza/postgis:16-3.4 + image: kartoza/postgis:17-3.5 volumes: - geo-db-data:/var/lib/postgresql - ./tests/init.sql:/docker-entrypoint-initdb.d/init.sql diff --git a/scenario_tests/disk-quota/docker-compose.yml b/scenario_tests/disk-quota/docker-compose.yml index 55e37509..687f5513 100644 --- a/scenario_tests/disk-quota/docker-compose.yml +++ b/scenario_tests/disk-quota/docker-compose.yml @@ -6,7 +6,7 @@ volumes: services: db: - image: kartoza/postgis:16-3.4 + image: kartoza/postgis:17-3.5 volumes: - postgis-data:/var/lib/postgresql environment: diff --git a/scenario_tests/jdbconfig/docker-compose-postgis-jndi.yml b/scenario_tests/jdbconfig/docker-compose-postgis-jndi.yml new file mode 100644 index 00000000..82d6abe0 --- /dev/null +++ b/scenario_tests/jdbconfig/docker-compose-postgis-jndi.yml @@ -0,0 +1,57 @@ + +volumes: + geoserver-data-dir: + postgis-data: + + +services: + db: + image: kartoza/postgis:17-3.5 + volumes: + - postgis-data:/var/lib/postgresql + environment: + - POSTGRES_DB=gis + - POSTGRES_USER=docker + - POSTGRES_PASS=docker + - ALLOW_IP_RANGE=0.0.0.0/0 + - POSTGRES_MULTIPLE_EXTENSIONS=postgis,hstore,postgis_topology,postgis_raster,pgrouting + - RUN_AS_ROOT=true + restart: on-failure + healthcheck: + test: "PGPASSWORD=docker pg_isready -h 127.0.0.1 -U docker -d gis" + + geoserver: + image: 'kartoza/geoserver:${TAG:-manual-build}' + restart: 'always' + volumes: + - geoserver-data-dir:/opt/geoserver/data_dir + - ./tests:/tests + environment: + GEOSERVER_ADMIN_PASSWORD: myawesomegeoserver + GEOSERVER_ADMIN_USER: admin + INITIAL_MEMORY: 2G + MAXIMUM_MEMORY: 4G + POSTGRES_JNDI: TRUE + POSTGRES_PORT: 5432 + HOST: db + POSTGRES_DB: gis + POSTGRES_USER: docker + POSTGRES_PASS: docker + RECREATE_DATADIR: TRUE + CONSOLE_HANDLER_LEVEL: WARNING + SAMPLE_DATA: true + DB_BACKEND: POSTGRES + COMMUNITY_EXTENSIONS: jdbcconfig-plugin,jdbcstore-plugin + TEST_CLASS: test_jdbconfig.TestGeoServerJDBCONFIG + depends_on: + db: + condition: service_healthy + ports: + - "8080:8080" + healthcheck: + test: ["CMD-SHELL", "curl --fail --silent --write-out 'HTTP CODE : %{http_code}\n' --output /dev/null -u $${GEOSERVER_ADMIN_USER}:$${GEOSERVER_ADMIN_PASSWORD} http://localhost:8080/geoserver/rest/about/version.xml"] + interval: 1m30s + timeout: 10s + retries: 3 + + diff --git a/scenario_tests/jdbconfig/docker-compose.yml b/scenario_tests/jdbconfig/docker-compose.yml index bac3333f..93bd5584 100644 --- a/scenario_tests/jdbconfig/docker-compose.yml +++ b/scenario_tests/jdbconfig/docker-compose.yml @@ -6,7 +6,7 @@ volumes: services: db: - image: kartoza/postgis:16-3.4 + image: kartoza/postgis:17-3.5 volumes: - postgis-data:/var/lib/postgresql environment: diff --git a/scenario_tests/jdbconfig/test.sh b/scenario_tests/jdbconfig/test.sh index 7dc06c00..7030cab2 100755 --- a/scenario_tests/jdbconfig/test.sh +++ b/scenario_tests/jdbconfig/test.sh @@ -34,3 +34,27 @@ for service in "${services[@]}"; do done ${VERSION} -f docker-compose.yml down -v + + +#JNDI +${VERSION} -f docker-compose-postgis-jndi.yml up -d + +if [[ -n "${PRINT_TEST_LOGS}" ]]; then + ${VERSION} -f docker-compose-postgis-jndi.yml logs -f & +fi + + + + +services=("geoserver") + +for service in "${services[@]}"; do + + # Execute tests + test_url_availability http://localhost:8080/geoserver/rest/about/version.xml + echo "Execute test for $service" + ${VERSION} -f docker-compose-postgis-jndi.yml exec $service /bin/bash /tests/test.sh + +done + +${VERSION} -f docker-compose-postgis-jndi.yml down -v \ No newline at end of file diff --git a/scenario_tests/stores/docker-compose-postgis-jndi.yml b/scenario_tests/stores/docker-compose-postgis-jndi.yml index 82d1b6e8..90dae711 100644 --- a/scenario_tests/stores/docker-compose-postgis-jndi.yml +++ b/scenario_tests/stores/docker-compose-postgis-jndi.yml @@ -6,7 +6,7 @@ volumes: services: db: - image: kartoza/postgis:16-3.4 + image: kartoza/postgis:17-3.5 volumes: - postgis-data:/var/lib/postgresql environment: diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 1de43542..e3e8854b 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -56,6 +56,7 @@ export CLUSTER_CONFIG_DIR MONITOR_AUDIT_PATH INSTANCE_STRING CLUSTER_CONNECTION log CLUSTER_CONFIG_DIR="${CLUSTER_CONFIG_DIR}" log MONITOR_AUDIT_PATH="${MONITOR_AUDIT_PATH}" +if [[ -z ${GEOSERVER_OPTS} ]];then export GEOSERVER_OPTS="-Djava.awt.headless=true -server -Xms${INITIAL_MEMORY} -Xmx${MAXIMUM_MEMORY} \ -XX:PerfDataSamplingInterval=500 -Dorg.geotools.referencing.forceXY=true \ @@ -83,8 +84,9 @@ export GEOSERVER_OPTS="-Djava.awt.headless=true -server -Xms${INITIAL_MEMORY} -X -Dsun.java2d.renderer.useThreadLocal=false \ -Dsun.java2d.renderer.pixelsize=8192 -server -XX:NewSize=300m \ -Dlog4j.configuration=${CATALINA_HOME}/log4j.properties \ - --patch-module java.desktop=${CATALINA_HOME}/marlin-render.jar \ + --patch-module java.desktop=${CATALINA_HOME}/lib/marlin.jar \ -Dsun.java2d.renderer=org.marlin.pisces.PiscesRenderingEngine \ + -Dsun.java2d.renderer.log=true \ -Dgeoserver.login.autocomplete=${LOGIN_STATUS} \ -DUPDATE_BUILT_IN_LOGGING_PROFILES=${UPDATE_LOGGING_PROFILES} \ -DRELINQUISH_LOG4J_CONTROL=${RELINQUISH_LOG4J_CONTROL} \ @@ -96,7 +98,7 @@ export GEOSERVER_OPTS="-Djava.awt.headless=true -server -Xms${INITIAL_MEMORY} -X -DENTITY_RESOLUTION_ALLOWLIST='"${ENTITY_RESOLUTION_ALLOWLIST}"' \ -DGEOSERVER_DISABLE_STATIC_WEB_FILES=${GEOSERVER_DISABLE_STATIC_WEB_FILES} \ ${ADDITIONAL_JAVA_STARTUP_OPTIONS} " - +fi ## Prepare the JVM command line arguments export JAVA_OPTS="${JAVA_OPTS} ${GEOSERVER_OPTS}" diff --git a/scripts/functions.sh b/scripts/functions.sh index e8a6f6e6..0eb4faa0 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -555,7 +555,13 @@ function setup_jdbc_db_config() { envsubst < "${EXTRA_CONFIG_DIR}"/jdbcconfig.properties > "${GEOSERVER_DATA_DIR}"/jdbcconfig/jdbcconfig.properties else envsubst < /build_data/jdbcconfig/jdbcconfig.properties > "${GEOSERVER_DATA_DIR}"/jdbcconfig/jdbcconfig.properties + sed -i '/^jndiName=/d' "${GEOSERVER_DATA_DIR}"/jdbcconfig/jdbcconfig.properties + if [[ ${POSTGRES_JNDI} =~ [Tt][Rr][Uu][Ee] ]];then + # Set jndiName if POSTGRES_JNDI is set to true + echo "jndiName=java:comp/env/jdbc/postgres" >> "${GEOSERVER_DATA_DIR}"/jdbcconfig/jdbcconfig.properties + fi fi + check_jdbc_config_table=$(psql -d "$POSTGRES_DB" -p "$POSTGRES_PORT" -U "$POSTGRES_USER" -h "$HOST" -tAc "SELECT EXISTS(SELECT 1 FROM information_schema.tables WHERE table_name = 'object_property')") if [[ ${check_jdbc_config_table} = "t" ]]; then sed -i 's/initdb=true/initdb=false/g' "${GEOSERVER_DATA_DIR}"/jdbcconfig/jdbcconfig.properties @@ -586,9 +592,14 @@ function setup_jdbc_db_store() { envsubst < /build_data/jdbcconfig/jdbcconfig.properties > "${GEOSERVER_DATA_DIR}"/jdbcconfig/jdbcconfig.properties fi if [[ -f "${EXTRA_CONFIG_DIR}"/jdbcstore.properties ]]; then - envsubst < "${EXTRA_CONFIG_DIR}"/jdbcstore.properties > "${GEOSERVER_DATA_DIR}"/jdbcstore/jdbcstore.propertiesproperties + envsubst < "${EXTRA_CONFIG_DIR}"/jdbcstore.properties > "${GEOSERVER_DATA_DIR}"/jdbcstore/jdbcstore.properties else - envsubst < /build_data/jdbcstore/jdbcstore.properties > "${GEOSERVER_DATA_DIR}"/jdbcstore/jdbcstore.propertiesproperties + envsubst < /build_data/jdbcstore/jdbcstore.properties > "${GEOSERVER_DATA_DIR}"/jdbcstore/jdbcstore.properties + sed -i '/^jndiName=/d' "${GEOSERVER_DATA_DIR}"/jdbcstore/jdbcstore.properties + if [[ ${POSTGRES_JNDI} =~ [Tt][Rr][Uu][Ee] ]];then + # Set jndiName if POSTGRES_JNDI is set to true + echo "jndiName=java:comp/env/jdbc/postgres" >> "${GEOSERVER_DATA_DIR}"/jdbcstore/jdbcstore.properties + fi fi check_jdbc_store_table=$(psql -d "$POSTGRES_DB" -p "${POSTGRES_PORT}" -U "${POSTGRES_USER}" -h "${HOST}" -tAc "SELECT EXISTS(SELECT 1 from information_schema.tables where table_name = 'resources')") diff --git a/scripts/setup.sh b/scripts/setup.sh index 70e130d6..a575aea6 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -67,32 +67,16 @@ 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}') -java_version_major=$(echo "${JAVA_VERSION}" | cut -d '.' -f 1) -if [[ ${java_version_major} -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-* - validate_url https://github.com/bourgesl/marlin-renderer/releases/download/v0_9_4_8/marlin-0.9.4.8-Unsafe-OpenJDK11.jar && \ - mv marlin-0.9.4.8-Unsafe-OpenJDK11.jar "${GEOSERVER_INSTALL_DIR}"/webapps/"${GEOSERVER_CONTEXT_ROOT}"/WEB-INF/lib/marlin-render.jar - fi -fi +curl --progress-bar -fLvo ${CATALINA_HOME}/lib/marlin.jar https://github.com/bourgesl/marlin-renderer/releases/download/v0_9_4_8/marlin-0.9.4.8-Unsafe-OpenJDK11.jar || exit 1 # Install jetty-servlets if [[ -f ${GEOSERVER_HOME}/start.jar ]]; then - if [[ ! -f ${GEOSERVER_HOME}/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/jetty-servlets.jar ]]; then - curl -vfLo "${GEOSERVER_HOME}/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/jetty-servlets.jar" https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-servlets/11.0.9/jetty-servlets-11.0.9.jar - fi + cp /work/required_plugins/jetty-servlets-11.0.9.jar "${GEOSERVER_HOME}"/webapps/"${GEOSERVER_CONTEXT_ROOT}"/WEB-INF/lib/ fi # Install jetty-util if [[ -f ${GEOSERVER_HOME}/start.jar ]]; then - if [[ ! -f ${GEOSERVER_HOME}/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/jetty-util.jar ]]; then - curl -vfLo "${GEOSERVER_HOME}/webapps/${GEOSERVER_CONTEXT_ROOT}/WEB-INF/lib/jetty-util.jar" https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-util/11.0.9/jetty-util-11.0.9.jar - fi + cp /work/required_plugins/jetty-util.jar "${GEOSERVER_HOME}"/webapps/"${GEOSERVER_CONTEXT_ROOT}"/WEB-INF/lib/ fi # Overlay files and directories in resources/overlays if they exist diff --git a/scripts/start.sh b/scripts/start.sh index dd90f802..d5351d2d 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -181,7 +181,7 @@ fi fi -export JDBC_CONFIG_ENABLED JDBC_IGNORE_PATHS JDBC_STORE_ENABLED +export JDBC_CONFIG_ENABLED JDBC_IGNORE_PATHS JDBC_STORE_ENABLED POSTGRES_JNDI # Install community modules plugins if [[ ! -z ${COMMUNITY_EXTENSIONS} ]]; then if [[ ${FORCE_DOWNLOAD_COMMUNITY_EXTENSIONS} =~ [Tt][Rr][Uu][Ee] ]];then