From bc10da56a30322ae7bcf00470c4b9940b2c1871f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20B=C3=BChner?= Date: Thu, 21 Nov 2024 16:49:19 +0100 Subject: [PATCH] feat: ensure that the datadir always exists --- startup.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/startup.sh b/startup.sh index 5b038f6..d7210c8 100755 --- a/startup.sh +++ b/startup.sh @@ -15,8 +15,8 @@ function copy_custom_config() { # since autodeploy is disabled by default, we need to enable it if the user has not provided a custom server.xml if [ "${CONFIG_FILE}" = "server.xml" ] && [ "${ROOT_WEBAPP_REDIRECT}" = "true" ] && [ "${WEBAPP_CONTEXT}" != "" ]; then - echo "Deploying ROOT context to allow for redirect to ${WEBAPP_CONTEXT}" - sed -i '\::i\' $CATALINA_HOME/conf/server.xml + echo "Deploying ROOT context to allow for redirect to ${WEBAPP_CONTEXT}" + sed -i '\::i\' $CATALINA_HOME/conf/server.xml fi fi } @@ -43,6 +43,12 @@ DEFAULT_HEALTHCHECK_URL="http://${DEFAULT_HEALTHCHECK_URL}" # write the healthcheck URL to a file that geoserver user has access to but is not served by tomcat echo "${HEALTHCHECK_URL:-$DEFAULT_HEALTHCHECK_URL}" > $CATALINA_HOME/conf/healthcheck_url.txt +# ensure that GEOSERVER_DATA_DIR exists as a directory +if [ ! -e "$GEOSERVER_DATA_DIR" ]; then + mkdir -p $GEOSERVER_DATA_DIR + echo "Created new GeoServer data directory $GEOSERVER_DATA_DIR as it did not exist." +fi + if [ "${SKIP_DEMO_DATA}" = "true" ]; then # skipping demo data @@ -209,4 +215,3 @@ then else exec $CATALINA_HOME/bin/catalina.sh run -Dorg.apache.catalina.connector.RECYCLE_FACADES=true fi -