Skip to content

Commit

Permalink
Merge pull request #123 from buehner/arbitrary-datadirs
Browse files Browse the repository at this point in the history
feat: ensure that the datadir always exists
  • Loading branch information
buehner authored Nov 26, 2024
2 parents 597f74a + bc10da5 commit 055f2c8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 '\:</Host>:i\<Context override="true" docBase="ROOT" path=""></Context>' $CATALINA_HOME/conf/server.xml
echo "Deploying ROOT context to allow for redirect to ${WEBAPP_CONTEXT}"
sed -i '\:</Host>:i\<Context override="true" docBase="ROOT" path=""></Context>' $CATALINA_HOME/conf/server.xml
fi
fi
}
Expand All @@ -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

Expand Down Expand Up @@ -209,4 +215,3 @@ then
else
exec $CATALINA_HOME/bin/catalina.sh run -Dorg.apache.catalina.connector.RECYCLE_FACADES=true
fi

0 comments on commit 055f2c8

Please sign in to comment.