Geographic Information Systems Asked by Eike on April 22, 2021
I am using GeoServer 2.16.0 docker image build by myself based on kartoza’s dockerfile.
The only pre-configuration is done via environment files, e.g. geoserver.env
:
ENABLE_JSONP=true
FOOTPRINTS_DATA_DIR=/opt/footprints_dir
GEOSERVER_ADMIN_PASSWORD=myawesomegeoserver
GEOSERVER_DATA_DIR=/opt/geoserver/data_dir
GEOSERVER_NODE_OPTS="id:$hostname - ($host_ip);background:red;color:white"
GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc
#JAVA_OPTS="-Duser.country=US -Duser.language=en"
MAX_FILTER_RULES=20
OPTIMIZE_LINE_WIDTH=false
I would like to configure more, e.g. workspaces, stores, but cannot find any according documentation.
Is there any better way than the following?
DATA_DIR
mountedDATA_DIR
content?Solution (16.02.2021)
I added the following two lines to my dockerfile:
COPY ./data_dir_init /tmp/data_dir_init
COPY ./init-workspace.sh /scripts
The init-workspace.sh contains the following:
SETUP_LOCKFILE="${GEOSERVER_DATA_DIR}/.init_data_dir.lock"
if [ -f "${SETUP_LOCKFILE}" ]; then
echo -e "nn Skip GeoServer init - already donenn"
exit 0
fi
if [ "${DEBUG}" ]; then
set -e
set -x
fi
echo -e "nnStarting init of GeoServer data dirnn"
cp --verbose --recursive /tmp/data_dir_init/{styles,workspaces} $GEOSERVER_DATA_DIR
cp --verbose /tmp/data_dir_init/{csw,global,logging,wms,wps}.xml $GEOSERVER_DATA_DIR
mkdir--verbose --parents $GEOSERVER_DATA_DIR/data
if [ ! ${DEBUG} ]; then
rm --recursive --verbose /tmp/data_dir_init
fi
# Put lock file to make sure data directory is not reinitialized on restart
touch ${SETUP_LOCKFILE}
The folder data_dir_init
contains all content from the first session, when I startet an empty geoserver instance and created the base set-up I needed.
Either of those would work, or you could use the REST API to add the workspaces and stores when building your own image.
Correct answer by Ian Turton on April 22, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP