feat: introduce SET_GEOSERVER_REQUIRE_FILE variable
parent
4ab8c08323
commit
b8e32c57d9
|
|
@ -33,7 +33,7 @@ ENV EXTRA_JAVA_OPTS="-Xms256m -Xmx1g"
|
||||||
ENV GEOSERVER_BUILD=$GS_BUILD
|
ENV GEOSERVER_BUILD=$GS_BUILD
|
||||||
ENV GEOSERVER_DATA_DIR=/opt/geoserver_data/
|
ENV GEOSERVER_DATA_DIR=/opt/geoserver_data/
|
||||||
ENV GEOSERVER_LIB_DIR=$CATALINA_HOME/webapps/geoserver/WEB-INF/lib/
|
ENV GEOSERVER_LIB_DIR=$CATALINA_HOME/webapps/geoserver/WEB-INF/lib/
|
||||||
ENV GEOSERVER_REQUIRE_FILE=$GEOSERVER_DATA_DIR/global.xml
|
ENV SET_GEOSERVER_REQUIRE_FILE=true
|
||||||
ENV GEOSERVER_VERSION=$GS_VERSION
|
ENV GEOSERVER_VERSION=$GS_VERSION
|
||||||
ENV HEALTHCHECK_URL=''
|
ENV HEALTHCHECK_URL=''
|
||||||
ENV INSTALL_EXTENSIONS=false
|
ENV INSTALL_EXTENSIONS=false
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,8 @@ Following is the list of the all the environment variables that can be passed do
|
||||||
| DEBIAN_FRONTEND | Configures the Debian package manager frontend | `noninteractive`|
|
| DEBIAN_FRONTEND | Configures the Debian package manager frontend | `noninteractive`|
|
||||||
| CATALINA_OPTS | Catalina options. Check [ref](https://www.baeldung.com/tomcat-catalina_opts-vs-java_opts) | `-Djava.awt.headless=true` |
|
| CATALINA_OPTS | Catalina options. Check [ref](https://www.baeldung.com/tomcat-catalina_opts-vs-java_opts) | `-Djava.awt.headless=true` |
|
||||||
| GEOSERVER_DATA_DIR | Geoserver data directory location | `/opt/geoserver_data/` |
|
| GEOSERVER_DATA_DIR | Geoserver data directory location | `/opt/geoserver_data/` |
|
||||||
| GEOSERVER_REQUIRE_FILE | Geoserver configuration used interally | `/opt/geoserver_data/global.xml` |
|
| GEOSERVER_REQUIRE_FILE | Path to a file that will be passed to GeoServer. If this file does not exist, GeoServer won't start. | |
|
||||||
|
| SET_GEOSERVER_REQUIRE_FILE | If set to true, the GEOSERVER_REQUIRE_FILE will be automatically set to `$GEOSERVER_DATA_DIR/global.xml` on startup. If GEOSERVER_REQUIRE_FILE is set it will take precedence. | `true` |
|
||||||
| INSTALL_EXTENSIONS | Indicates whether additional GeoServer extensions should be installed | `false` |
|
| INSTALL_EXTENSIONS | Indicates whether additional GeoServer extensions should be installed | `false` |
|
||||||
| WAR_ZIP_URL | Specifies the URL for a GeoServer Web Archive (WAR) file | |
|
| WAR_ZIP_URL | Specifies the URL for a GeoServer Web Archive (WAR) file | |
|
||||||
| STABLE_EXTENSIONS | Specifies stable GeoServer extensions | |
|
| STABLE_EXTENSIONS | Specifies stable GeoServer extensions | |
|
||||||
|
|
@ -243,7 +244,7 @@ Following is the list of the all the environment variables that can be passed do
|
||||||
| COMMUNITY_PLUGIN_URL | Specifies the URL for downloading the latest community-contributed GeoServer plugins | `https://build.geoserver.org/geoserver/2.26.x/community-latest` |
|
| COMMUNITY_PLUGIN_URL | Specifies the URL for downloading the latest community-contributed GeoServer plugins | `https://build.geoserver.org/geoserver/2.26.x/community-latest` |
|
||||||
| ADDITIONAL_LIBS_DIR | Sets the directory for additional libraries used by GeoServer | `/opt/additional_libs/` |
|
| ADDITIONAL_LIBS_DIR | Sets the directory for additional libraries used by GeoServer | `/opt/additional_libs/` |
|
||||||
| ADDITIONAL_FONTS_DIR | Sets the directory for additional fonts used by GeoServer | `/opt/additional_fonts/` |
|
| ADDITIONAL_FONTS_DIR | Sets the directory for additional fonts used by GeoServer | `/opt/additional_fonts/` |
|
||||||
| SKIP_DEMO_DATA | Indicates whether to skip the installation of demo data provided by GeoServer | `false` |
|
| SKIP_DEMO_DATA | Indicates whether to skip the installation of demo data provided by GeoServer. GEOSERVER_REQUIRE_FILE will be ignored if set to true. | `false` |
|
||||||
| ROOT_WEBAPP_REDIRECT | Indicates whether to issue a permanent redirect to the web interface | `false` |
|
| ROOT_WEBAPP_REDIRECT | Indicates whether to issue a permanent redirect to the web interface | `false` |
|
||||||
| HEALTHCHECK_URL | URL to the resource / endpoint used for `docker` health checks | `http://localhost:8080/geoserver/web/wicket/resource/org.geoserver.web.GeoServerBasePage/img/logo.png` |
|
| HEALTHCHECK_URL | URL to the resource / endpoint used for `docker` health checks | `http://localhost:8080/geoserver/web/wicket/resource/org.geoserver.web.GeoServerBasePage/img/logo.png` |
|
||||||
| GEOSERVER_ADMIN_USER | Admin username | |
|
| GEOSERVER_ADMIN_USER | Admin username | |
|
||||||
|
|
|
||||||
34
startup.sh
34
startup.sh
|
|
@ -21,11 +21,6 @@ function copy_custom_config() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
## Skip demo data
|
|
||||||
if [ "${SKIP_DEMO_DATA}" = "true" ]; then
|
|
||||||
unset GEOSERVER_REQUIRE_FILE
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Add a permanent redirect (HTTP 301) from the root webapp ("/") to geoserver web interface ("/geoserver/web")
|
## Add a permanent redirect (HTTP 301) from the root webapp ("/") to geoserver web interface ("/geoserver/web")
|
||||||
if [ "${ROOT_WEBAPP_REDIRECT}" = "true" ] && [ "${WEBAPP_CONTEXT}" != "" ]; then
|
if [ "${ROOT_WEBAPP_REDIRECT}" = "true" ] && [ "${WEBAPP_CONTEXT}" != "" ]; then
|
||||||
if [ ! -d $CATALINA_HOME/webapps/ROOT ]; then
|
if [ ! -d $CATALINA_HOME/webapps/ROOT ]; then
|
||||||
|
|
@ -48,10 +43,35 @@ 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
|
# 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
|
echo "${HEALTHCHECK_URL:-$DEFAULT_HEALTHCHECK_URL}" > $CATALINA_HOME/conf/healthcheck_url.txt
|
||||||
|
|
||||||
## install release data directory if needed before starting tomcat
|
if [ "${SKIP_DEMO_DATA}" = "true" ]; then
|
||||||
if [ ! -z "$GEOSERVER_REQUIRE_FILE" ] && [ ! -f "$GEOSERVER_REQUIRE_FILE" ]; then
|
# skipping demo data
|
||||||
|
|
||||||
|
if [ "$SET_GEOSERVER_REQUIRE_FILE" = true ]; then
|
||||||
|
echo "SET_GEOSERVER_REQUIRE_FILE will be ignored because SKIP_DEMO_DATA is set to true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# unset geoserver require file
|
||||||
|
if [ ! -z "$GEOSERVER_REQUIRE_FILE" ]; then
|
||||||
|
echo "GEOSERVER_REQUIRE_FILE will be ignored because SKIP_DEMO_DATA is set to true"
|
||||||
|
unset GEOSERVER_REQUIRE_FILE
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# using demo data if data dir does not contain geoserver require file
|
||||||
|
|
||||||
|
# set geoserver require file to the correct value
|
||||||
|
if [ "$SET_GEOSERVER_REQUIRE_FILE" = true ]; then
|
||||||
|
if [ -z "$GEOSERVER_REQUIRE_FILE" ]; then
|
||||||
|
export GEOSERVER_REQUIRE_FILE="$GEOSERVER_DATA_DIR/global.xml"
|
||||||
|
else
|
||||||
|
echo "SET_GEOSERVER_REQUIRE_FILE is ignored because GEOSERVER_REQUIRE_FILE is set to a value"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
## install release data directory if needed before starting tomcat
|
||||||
|
if [ ! -f "$GEOSERVER_REQUIRE_FILE" ]; then
|
||||||
echo "Initialize $GEOSERVER_DATA_DIR from data directory included in geoserver.war"
|
echo "Initialize $GEOSERVER_DATA_DIR from data directory included in geoserver.war"
|
||||||
cp -r $CATALINA_HOME/webapps/geoserver/data/* $GEOSERVER_DATA_DIR
|
cp -r $CATALINA_HOME/webapps/geoserver/data/* $GEOSERVER_DATA_DIR
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## install GeoServer extensions before starting the tomcat
|
## install GeoServer extensions before starting the tomcat
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue