Enable installation of custom libs/jars/extensions
parent
a4e3a83816
commit
4261b1bdc1
|
|
@ -15,11 +15,11 @@ ENV GS_VERSION=${GS_VERSION} \
|
|||
DOWNLOAD_EXTENSIONS=false \
|
||||
STABLE_EXTENSIONS='' \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
EXTENSION_DOWNLOAD_DIR=/opt/geoserver_extension_downloads \
|
||||
GEOSERVER_DATA_DIR=/opt/geoserver_data \
|
||||
GEOWEBCACHE_CACHE_DIR=/opt/geowebcache_data
|
||||
ADDITIONAL_LIBS_DIR=/opt/additional_libs/ \
|
||||
GEOSERVER_DATA_DIR=/opt/geoserver_data/ \
|
||||
GEOWEBCACHE_CACHE_DIR=/opt/geowebcache_data/
|
||||
|
||||
RUN mkdir ${EXTENSION_DOWNLOAD_DIR} ${GEOSERVER_DATA_DIR} ${GEOWEBCACHE_CACHE_DIR}
|
||||
RUN mkdir ${ADDITIONAL_LIBS_DIR} ${GEOSERVER_DATA_DIR} ${GEOWEBCACHE_CACHE_DIR}
|
||||
|
||||
# install required dependencies
|
||||
# also clear the initial webapps
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ You can quickstart by using the docker-compose demo
|
|||
|
||||
## Running
|
||||
|
||||
`docker run -it -e STABLE_EXTENSIONS='wps,csw' -p 8080:8080 geoserver:test`
|
||||
`docker run -it -e DOWNLOAD_EXTENSIONS='true' -e STABLE_EXTENSIONS='wps,csw' -p 8080:8080 geoserver:test`
|
||||
|
||||
The extensions will be downloaded on startup of the image (before starting the tomcat).
|
||||
|
||||
|
|
@ -44,16 +44,13 @@ Pass as environment variables. If not passed, the default values will be used.
|
|||
* `MAXIMUM_MEMORY` (default: 4G)
|
||||
* `JAIEXT_ENABLED` (default: true)
|
||||
* `DOWNLOAD_EXTENSIONS` (default: false)
|
||||
* `STABLE_EXTENSIONS` as comma separated list, will be downloaded and installed on startup (default: "")
|
||||
* `STABLE_EXTENSIONS` applies only if `DOWNLOAD_EXTENSIONS` is true: provide a comma separated list of extension identifiers and they will be downloaded and installed on startup (default: "")
|
||||
|
||||
## TODOs
|
||||
|
||||
* CORS
|
||||
* configuration of JNDI connections in the tomcat/custom tomcat configuration in general
|
||||
* default data for gs datadir?
|
||||
* possibility to add custom java dependencies (for example the oracle jdbc driver)
|
||||
* in this context: mount `EXTENSION_DOWNLOAD_DIR` and implement checks to cache extensions that have already been downloaded before?
|
||||
* log4j properties
|
||||
* add possibility to add custom fonts
|
||||
* starting from which version we want to provide geoserver images (maybe 2.15.x?)/backwards compatability
|
||||
* add a docker-compose demo environment?
|
||||
* starting from which version we want to provide geoserver images/backwards compatability?
|
||||
|
|
|
|||
|
|
@ -12,3 +12,4 @@ services:
|
|||
- MAXIMUM_MEMORY=2G
|
||||
volumes:
|
||||
- ./demo_data/geoserver_data:/opt/geoserver_data/:Z
|
||||
- ./demo_data/additional_libs:/opt/additional_libs:Z # by mounting this we can install libs from host on startup
|
||||
|
|
|
|||
|
|
@ -4,22 +4,44 @@
|
|||
function download_extension() {
|
||||
URL=$1
|
||||
EXTENSION=$2
|
||||
if curl --output /dev/null --silent --head --fail "${URL}"; then
|
||||
DOWNLOAD_FILE="${EXTENSION_DOWNLOAD_DIR}/geoserver-${GS_VERSION}-${EXTENSION}-plugin.zip"
|
||||
echo -e "\nDownloading ${EXTENSION}-extension from ${URL}"
|
||||
wget --progress=bar:force:noscroll -c --no-chec k-certificate "${URL}" -O ${DOWNLOAD_FILE}
|
||||
unzip -q -o ${DOWNLOAD_FILE} -d ${CATALINA_HOME}/webapps/geoserver/WEB-INF/lib
|
||||
else
|
||||
echo "URL does not exist: ${URL}"
|
||||
DOWNLOAD_FILE="${ADDITIONAL_LIBS_DIR}geoserver-${GS_VERSION}-${EXTENSION}-plugin.zip"
|
||||
|
||||
if [ -e "$DOWNLOAD_FILE" ]; then
|
||||
echo "$DOWNLOAD_FILE already exists. Skipping download."
|
||||
else
|
||||
if curl --output /dev/null --silent --head --fail "${URL}"; then
|
||||
echo -e "\nDownloading ${EXTENSION}-extension from ${URL}"
|
||||
wget --progress=bar:force:noscroll -c --no-chec k-certificate "${URL}" -O ${DOWNLOAD_FILE}
|
||||
else
|
||||
echo "URL does not exist: ${URL}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Install stable plugins only if DOWNLOAD_EXTENSIONS is true
|
||||
# Download stable plugins only if DOWNLOAD_EXTENSIONS is true
|
||||
if [ "$DOWNLOAD_EXTENSIONS" = "true" ]; then
|
||||
echo "Starting installation of extensions"
|
||||
echo "Starting download of extensions"
|
||||
for EXTENSION in $(echo "${STABLE_EXTENSIONS}" | tr ',' ' '); do
|
||||
URL="${STABLE_PLUGIN_URL}/geoserver-${GS_VERSION}-${EXTENSION}-plugin.zip"
|
||||
download_extension ${URL} ${EXTENSION}
|
||||
done
|
||||
echo "Finished installation of extensions"
|
||||
echo "Finished download of extensions"
|
||||
fi
|
||||
|
||||
TARGET_LIB_DIR="${CATALINA_HOME}/webapps/geoserver/WEB-INF/lib/"
|
||||
# Install all extensions that are available in the additional lib dir now
|
||||
echo "Starting installation of extensions"
|
||||
for ADDITIONAL_LIB in ${ADDITIONAL_LIBS_DIR}*; do
|
||||
[ -e "$ADDITIONAL_LIB" ] || continue
|
||||
|
||||
if [[ $ADDITIONAL_LIB == *.zip ]]; then
|
||||
unzip -q -o -d ${TARGET_LIB_DIR} ${ADDITIONAL_LIB} "*.jar"
|
||||
echo "Installed all jar files from ${ADDITIONAL_LIB}"
|
||||
elif [[ $ADDITIONAL_LIB == *.jar ]]; then
|
||||
cp ${ADDITIONAL_LIB} ${TARGET_LIB_DIR}
|
||||
echo "Installed ${ADDITIONAL_LIB}"
|
||||
else
|
||||
echo "Skipping ${ADDITIONAL_LIB}: unknown file extension."
|
||||
fi
|
||||
done
|
||||
echo "Finished installation of extensions"
|
||||
|
|
|
|||
Loading…
Reference in New Issue