GeoNode / geonode

GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data.
https://geonode.org/
Other
1.46k stars 1.13k forks source link

Streamline Unbuntu Deployment #8196

Closed crabel99 closed 9 months ago

crabel99 commented 3 years ago

Is your feature request related to a problem? Please describe. Setting up geoserver is very cumbersome and relies on manual configuration and installation of tomcat when there is a distribution package version that works. Additionally, the file structure is not well integrated with the Ubuntu style norms. I ran into java dependency issues when I followed the existing deployment guide on a clean Ubuntu 20.04 server. Which means that the development environment is not reproducible when deployed. When tomcat is installed through the repo libtomcat9-java is automatically included which has the missing jar. I got the method below working with either the geonode stock geoserver-2.18.3.war or with the manually installed geoserver-2.19.2.war as implemented below.

Describe the solution you'd like

Reproducible geoserver Deployment for Ubuntu 20.04 LTS

The purpose of this document is to show how to streamline and simplify the Ubuntu geoserver deployment and to make it conform more closely with the Ubuntu directory structure. The following commands are all executed as root. This can be done either by prepending sudo to each command, or by entering the command sudo su at the beginning of the process.

Install and Configure the systemd Service

This build environment relies upon and mimics the ubuntu package distribution structure. For the management of tomcat applications there are other options that can be installed. To see the list enter apt-cache search tomcat in the command line.

The systemctl configuration allows "overriding" the default distribution settings by using systemctl edit <service name>. The method shown here will append the additional commands to the default distribution settings and prevent the loss of the configuration when the distribution is upgraded. Note, the edit command automatically executes daemon-reload. You can see the change in the service settings by typing systemctl cat <service name>.

apt install tomcat9 -y
systemctl edit tomcat9

In the now open nano terminal paste the geoserver settings:

[Unit]
RequiresMountsFor=/var/log/geoserver /var/lib/geoserver /var/cache/geoserver

[Service]

# Configuration
# If needed to rollback the jdk uncomment the following. Note this should not be needed.
#Environment="JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/"
Environment="GEOSERVER_DATA_DIR=/var/lib/geoserver/data"
Environment="GEOSERVER_LOG_LOCATION=/var/log/geoserver/geoserver.log"
Environment="GEOWEBCACHE_CACHE_DIR=/var/cache/geoserver"
Environment="GEOFENCE_DIR=${GEOSERVER_DATA_DIR}/geofence"
Environment="TIMEZONE=UTC"
Environment="JAVA_OPTS='-server \
    -Djava.awt.headless=true \
    -Dorg.geotools.shapefile.datetime=false \
    -XX:+UseParallelGC \
    -XX:ParallelGCThreads=4 \
    -Dfile.encoding=UTF8 \
    -Duser.timezone=${TIMEZONE} \
    -Xms512m \
    -Xmx4096m \
    -Djavax.servlet.request.encoding=UTF-8 \
    -Djavax.servlet.response.encoding=UTF-8 \
    -DGEOSERVER_CSRF_DISABLED=true \
    -DPRINT_BASE_URL=http://localhost:8080/geoserver/pdf \
    -DGEOSERVER_DATA_DIR=${GEOSERVER_DATA_DIR} \
    -DGEOSERVER_LOG_LOCATION=${GEOSERVER_LOG_LOCATION} \
    -Dgeofence.dir=${GEOFENCE_DIR} \
    -DGEOWEBCACHE_CACHE_DIR=${GEOWEBCACHE_CACHE_DIR}'"

# Security
ReadWritePaths=/var/lib/geoserver
ReadWritePaths=/var/log/geoserver
ReadWritePaths=/var/cache/geoserver

Create the Directory Structure and Install Needed Packages

## make the geoserver directories
mkdir -p /var/lib/geoserver
mkdir -p /var/log/geoserver
mkdir -p /var/cache/geoserver

## set the directory permissions
chmod 0755 /var/lib/geoserver
chmod 2750 /var/log/geoserver
chmod 0750 /var/cache/geoserver

## install the data directory template
cd /var/lib/geoserver
wget --no-check-certificate "https://www.dropbox.com/s/cd20is9ddjz7ti5/data-2.18.3.zip?dl=1" -O data-2.18.3.zip
unzip data-2.18.3.zip

## set geoserver directory ownership
chown -R tomcat:tomcat /var/lib/geoserver
chown -R tomcat:adm /var/log/geoserver
chown -R tomcat:tomcat /var/cache/geoserver

## install the required *.jar files
cd /opt
mkdir -p geoserver && cd geoserver

## then either
wget --no-check-certificate "https://www.dropbox.com/s/cmrdzde1oq67pre/geoserver-2.18.3.war?dl=0" -O geoserver-2.18.3.war
mv geoserver-2.18.3.war /var/lib/tomcat9/webapps/geoserver.war

## or manually upgrade to the most recent version by doing the following:
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/geoserver-2.19.2-war.zip
unzip geoserver-2.19.2-war.zip
mkdir -p extensions && cd extensions

## Add any desired packages into here make sure that they are for the correct geoserver version, e.g.
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-authkey-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-css-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-excel-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-gdal-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-geofence-server-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-h2-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-importer-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-inspire-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-monitor-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-mysql-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-oracle-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-printing-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-pyramid-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-querylayer-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-sldservice-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-sqlserver-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-wmts-multi-dimensional-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-wps-download-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-wps-plugin.zip
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/extensions/geoserver-2.19.2-ysld-plugin.zip
## the backup-restore-plugin breaks geoserver when installed.
## there are a few other missing jars on the diff between 2.18.3 and what is done here. Not sure which other packages are missing.
#wget https://build.geoserver.org/geoserver/2.19.x/community-2021-10-03/geoserver-2.19-SNAPSHOT-backup-restore-plugin.zip
wget https://build.geoserver.org/geoserver/2.19.x/community-2021-10-03/geoserver-2.19-SNAPSHOT-sec-oauth2-geonode-plugin.zip

for FILE in *.zip; do unzip -o ${FILE}; done 
chmod -R 640 *.jar
chown -R tomcat:tomcat *.jar
# remove the earlier minor version for jackson-dataformat-cbor as 2.6.7 is included as well.
rm jackson-dataformat-cbor-2.6.6.jar

## Deploy geoserver and its extensions
## Note: Since tomcat9 is running it will automatically expand the geoserver.jar into the geoserver directory.
## Therefor, geoserver.war has to be copied and expanded first, then the extensions can be copied.
cp -p /opt/geoserver/geoserver.war /var/lib/tomcat9/webapps/
DIR=/var/lib/tomcat9/webapps/geoserver/WEB-INF/lib
for FILE in *.jar; do cp -p ${FILE} ${DIR}; done

Additional Logging (Optional)

If you desire additional stack trace outputs to be reported into the logs perform the following steps after deploying geoserver.

nano /var/lib/tomcat9/webapps/geoserver/WEB-INF/classes/logging.properties

classes/logging.properties:

org.apache.catalina.core.ContainerBase.[Catalina].level=INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers=java.util.logging.ConsoleHandler

Start geoserver

systemctl restart tomcat9
journalctl -u tomcat9 -f

# check the geoserver logs
tail -F -n 300 /var/log/geoserver/geoserver.log

Startup Log Files

/var/log/geoserver/geoserver.log

Following is the startup log entry, including the stacktrace for the only error that occurs. The same error was obtained also with geoserver-2.18.3.war using the similar framework. It does not appear to effect the operation of the geoserver.

2021-10-04 00:07:34,776 WARN [geoserver.config] - Error reading resource URL [jar:file:/var/lib/tomcat9/webapps/geoserver/WEB-INF/lib/gs-geofence-server-2.19.2.jar!/geofence-default-override.properties]
java.io.FileNotFoundException: URL [jar:file:/var/lib/tomcat9/webapps/geoserver/WEB-INF/lib/gs-geofence-server-2.19.2.jar!/geofence-default-override.properties] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/var/lib/tomcat9/webapps/geoserver/WEB-INF/lib/gs-geofence-server-2.19.2.jar!/geofence-default-override.properties
        at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:217)
        at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:154)
        at org.springframework.core.io.UrlResource.getFile(UrlResource.java:240)
        at org.geoserver.config.SpringResourceAdaptor.relative(SpringResourceAdaptor.java:34)
        at org.geoserver.config.GeoServerPropertyOverrideConfigurer.setLocations(GeoServerPropertyOverrideConfigurer.java:49)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.beans.BeanWrapperImpl$BeanPropertyHandler.setValue(BeanWrapperImpl.java:332)
        at org.springframework.beans.AbstractNestablePropertyAccessor.processLocalProperty(AbstractNestablePropertyAccessor.java:461)
        at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:278)
        at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:266)
        at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:104)
        at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:79)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1705)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1424)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:591)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:154)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
        at org.geoserver.platform.GeoServerContextLoaderListener.contextInitialized(GeoServerContextLoaderListener.java:22)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4685)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5146)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:978)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1849)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:773)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1576)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:936)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)
2021-10-04 00:07:34,871 WARN [geoserver.monitor] - monitoring storage memory not found, falling back to 'memory'
2021-10-04 00:07:35,373 WARN [ejb.Ejb3Configuration] - hibernate.connection.autocommit = false break the EJB3 specification
2021-10-04 00:07:35,406 WARN [dialect.H2Dialect] - The 1.1.119 version of H2 implements temporary table creation such that it commits current transaction; multi-table, bulk hql/jpaql will not work properly
2021-10-04 00:07:35,610 WARN [dialect.H2Dialect] - The 1.1.119 version of H2 implements temporary table creation such that it commits current transaction; multi-table, bulk hql/jpaql will not work properly
2021-10-04 00:07:35,686 WARN [cache.EhCacheProvider] - Could not find configuration [Rule]; using defaults.
2021-10-04 00:07:35,721 WARN [cache.EhCacheProvider] - Could not find configuration [RuleLimits]; using defaults.
2021-10-04 00:07:35,723 WARN [cache.EhCacheProvider] - Could not find configuration [usergroup]; using defaults.
2021-10-04 00:07:35,724 WARN [cache.EhCacheProvider] - Could not find configuration [GSUser]; using defaults.
2021-10-04 00:07:35,727 WARN [cache.EhCacheProvider] - Could not find configuration [GFUser]; using defaults.
2021-10-04 00:07:35,729 WARN [cache.EhCacheProvider] - Could not find configuration [gsinstance]; using defaults.
2021-10-04 00:07:35,733 WARN [cache.EhCacheProvider] - Could not find configuration [LayerDetails]; using defaults.
2021-10-04 00:07:41,691 WARN [auth.GeoFenceAuthenticationProvider] - INIT FROM CONFIG

journalctl -u tomcat9

Oct 04 10:13:14 my-server systemd[1]: Starting Apache Tomcat 9 Web Application Server...
Oct 04 10:13:14 my-server systemd[1]: Started Apache Tomcat 9 Web Application Server.
Oct 04 10:13:14 my-server tomcat9[3867829]: NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Oct 04 10:13:15 my-server tomcat9[3867829]: Server version name:   Apache Tomcat/9.0.31 (Ubuntu)
Oct 04 10:13:15 my-server tomcat9[3867829]: Server built:          Oct 20 2020 12:27:39 UTC
Oct 04 10:13:15 my-server tomcat9[3867829]: Server version number: 9.0.31.0
Oct 04 10:13:15 my-server tomcat9[3867829]: OS Name:               Linux
Oct 04 10:13:15 my-server tomcat9[3867829]: OS Version:            5.4.0-67-generic
Oct 04 10:13:15 my-server tomcat9[3867829]: Architecture:          amd64
Oct 04 10:13:15 my-server tomcat9[3867829]: Java Home:             /usr/lib/jvm/java-11-openjdk-amd64
Oct 04 10:13:15 my-server tomcat9[3867829]: JVM Version:           11.0.11+9-Ubuntu-0ubuntu2.20.04
Oct 04 10:13:15 my-server tomcat9[3867829]: JVM Vendor:            Ubuntu
Oct 04 10:13:15 my-server tomcat9[3867829]: CATALINA_BASE:         /var/lib/tomcat9
Oct 04 10:13:15 my-server tomcat9[3867829]: CATALINA_HOME:         /usr/share/tomcat9
Oct 04 10:13:15 my-server tomcat9[3867829]: Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
Oct 04 10:13:15 my-server tomcat9[3867829]: Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
Oct 04 10:13:15 my-server tomcat9[3867829]: Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Oct 04 10:13:15 my-server tomcat9[3867829]: Command line argument: -Djava.util.logging.config.file=/var/lib/tomcat9/conf/logging.properties
Oct 04 10:13:15 my-server tomcat9[3867829]: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Oct 04 10:13:15 my-server tomcat9[3867829]: Command line argument: -Djava.awt.headless=true
Oct 04 10:13:15 my-server tomcat9[3867829]: Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
Oct 04 10:13:15 my-server tomcat9[3867829]: Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
Oct 04 10:13:15 my-server tomcat9[3867829]: Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
Oct 04 10:13:15 my-server tomcat9[3867829]: Command line argument: -Dignore.endorsed.dirs=
Oct 04 10:13:15 my-server tomcat9[3867829]: Command line argument: -Dcatalina.base=/var/lib/tomcat9
Oct 04 10:13:15 my-server tomcat9[3867829]: Command line argument: -Dcatalina.home=/usr/share/tomcat9
Oct 04 10:13:15 my-server tomcat9[3867829]: Command line argument: -Djava.io.tmpdir=/tmp
Oct 04 10:13:15 my-server tomcat9[3867829]: Loaded APR based Apache Tomcat Native library [1.2.23] using APR version [1.6.5].
Oct 04 10:13:15 my-server tomcat9[3867829]: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Oct 04 10:13:15 my-server tomcat9[3867829]: APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
Oct 04 10:13:15 my-server tomcat9[3867829]: OpenSSL successfully initialized [OpenSSL 1.1.1f  31 Mar 2020]
Oct 04 10:13:15 my-server tomcat9[3867829]: Initializing ProtocolHandler ["http-nio-8080"]
Oct 04 10:13:15 my-server tomcat9[3867829]: Server initialization in [234] milliseconds
Oct 04 10:13:15 my-server tomcat9[3867829]: Starting service [Catalina]
Oct 04 10:13:15 my-server tomcat9[3867829]: Starting Servlet engine: [Apache Tomcat/9.0.31 (Ubuntu)]
Oct 04 10:13:15 my-server tomcat9[3867829]: Deploying deployment descriptor [/etc/tomcat9/Catalina/localhost/docs.xml]
Oct 04 10:13:15 my-server tomcat9[3867829]: The path attribute with value [/docs] in deployment descriptor [/etc/tomcat9/Catalina/localhost/docs.xml] has been ignored
Oct 04 10:13:15 my-server tomcat9[3867829]: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Oct 04 10:13:15 my-server tomcat9[3867829]: Deployment of deployment descriptor [/etc/tomcat9/Catalina/localhost/docs.xml] has finished in [491] ms
Oct 04 10:13:15 my-server tomcat9[3867829]: Deploying deployment descriptor [/etc/tomcat9/Catalina/localhost/host-manager.xml]
Oct 04 10:13:15 my-server tomcat9[3867829]: The path attribute with value [/host-manager] in deployment descriptor [/etc/tomcat9/Catalina/localhost/host-manager.xml] has been ignored
Oct 04 10:13:16 my-server tomcat9[3867829]: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Oct 04 10:13:16 my-server tomcat9[3867829]: Deployment of deployment descriptor [/etc/tomcat9/Catalina/localhost/host-manager.xml] has finished in [305] ms
Oct 04 10:13:16 my-server tomcat9[3867829]: Deploying deployment descriptor [/etc/tomcat9/Catalina/localhost/manager.xml]
Oct 04 10:13:16 my-server tomcat9[3867829]: The path attribute with value [/manager] in deployment descriptor [/etc/tomcat9/Catalina/localhost/manager.xml] has been ignored
Oct 04 10:13:16 my-server tomcat9[3867829]: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Oct 04 10:13:16 my-server tomcat9[3867829]: Deployment of deployment descriptor [/etc/tomcat9/Catalina/localhost/manager.xml] has finished in [274] ms
Oct 04 10:13:16 my-server tomcat9[3867829]: Deploying web application archive [/var/lib/tomcat9/webapps/geoserver.war]
Oct 04 10:13:20 my-server tomcat9[3867829]: No Spring WebApplicationInitializer types detected on classpath
Oct 04 10:13:21 my-server tomcat9[3867829]: log4j:WARN File option not set for appender [geoserverlogfile].
Oct 04 10:13:21 my-server tomcat9[3867829]: log4j:WARN Are you using FileAppender instead of ConsoleAppender?
Oct 04 10:13:21 my-server tomcat9[3867829]: Initializing Spring root WebApplicationContext
Oct 04 10:13:24 my-server tomcat9[3867829]: WARNING: An illegal reflective access operation has occurred
Oct 04 10:13:24 my-server tomcat9[3867829]: WARNING: Illegal reflective access by org.geotools.image.ImageWorker (file:/var/lib/tomcat9/webapps/geoserver/WEB-INF/lib/gt-coverage-25.2.jar) to constructor com.sun.imageio.plugins.jpeg.JPEGImageWriterSpi()
Oct 04 10:13:24 my-server tomcat9[3867829]: WARNING: Please consider reporting this to the maintainers of org.geotools.image.ImageWorker
Oct 04 10:13:24 my-server tomcat9[3867829]: WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
Oct 04 10:13:24 my-server tomcat9[3867829]: WARNING: All illegal access operations will be denied in a future release
Oct 04 10:13:29 my-server tomcat9[3867829]: Deployment of web application archive [/var/lib/tomcat9/webapps/geoserver.war] has finished in [13,176] ms
Oct 04 10:13:29 my-server tomcat9[3867829]: Deploying web application directory [/var/lib/tomcat9/webapps/ROOT]
Oct 04 10:13:29 my-server tomcat9[3867829]: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Oct 04 10:13:29 my-server tomcat9[3867829]: Deployment of web application directory [/var/lib/tomcat9/webapps/ROOT] has finished in [259] ms
Oct 04 10:13:29 my-server tomcat9[3867829]: Starting ProtocolHandler ["http-nio-8080"]
Oct 04 10:13:29 my-server tomcat9[3867829]: Server startup in [14,549] milliseconds
Oct 04 11:00:42 my-server tomcat9[3867829]: Initializing Spring DispatcherServlet 'dispatcher'
afabiani commented 3 years ago

@crabel99 are you sure you need to download and extract the plugins again? The WAR from dropbox contains already the needed JARs

crabel99 commented 3 years ago

@afabian I included them more as an exercise for me to learn how geoserver is set up. In the description of the process I show the conventional approach installing the prepared .war. Everything after ## then either can be ignored. The prepared .war does not work with jdk 11 so you do have to roll back to jdk 8. The reason why I submitted this was that the documentation goes through a lot of unnecessary steps while leaving unmet dependencies, and configures things in a non-standard way. I just streamlined the geoserver install to address these problems.

The error that I reported with the inability to access geofence-default-override.properties holds for both the stock 2.18.3 prepared war and my adhoc 2.19.2 method. Additionally, I am not able to access the reset password link (I keep getting 400) with both the 2.18.3 and the 2.19.2 methods. I also can't change any fields, getting 400 when trying to save. I've been working on this for about a week. Once I get the problem isolated I'll post what I find.

crabel99 commented 3 years ago

Going through the verbose geoserver logs there were a number of different things that weren't working using the stock Dropbox geoserver-2.18.3.war

First, there were a lot of ows messages in the logs, checked the OWS Summary Page and saw that there was a missing package: java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper entered apt install libatk-wrapper-java which removed the ows messages in the logs, but the OWS Summary Page has the same error.

Second, none of the GDAL coverage format factories were loading and there was a message in journalctl stating:

Oct 06 15:45:57 fermi tomcat9[4103004]: Native library load failed.
Oct 06 15:45:57 fermi tomcat9[4103004]: java.lang.UnsatisfiedLinkError: no gdaljni in java.library.path

This was partially fixed by apt install libgdal-java. But loading the libraries was not fixed. I attempted adding an environment variable into the systemctl service Environment=CATALINA_OPTS='-Djava.library.path=/usr/share/java'. This threw an error, so I included the configuration in JAVA_OPTS instead. This allowed geoserver.war to access the system's java gdal and atk libraries.

Third, there was an error with not finding the jpeg2000 jars. This was fixed by adding the jars from http://sourceforge.net/projects/geoserver/files/GeoServer/2.18.3/extensions/geoserver-2.18.3-jp2k-plugin.zip into WEB-INF. The error cleared and the results of the second and third fixes resulted in a logged output of:

2021-10-06 15:46:06,271 WARN [gce.imagemosaic] - Unable to set ordering between tiff readers spi
2021-10-06 15:46:06,290 INFO [util.factory] - Factory implementations for category GridFormatFactorySpi:
  org.geotools.coverageio.jp2k.JP2KFormatFactory
  org.geotools.gce.image.WorldImageFormatFactory
  org.geoserver.catalog.testreader.CustomFormatFactory
  org.geotools.gce.geotiff.GeoTiffFormatFactorySpi
  org.geotools.geopkg.mosaic.GeoPackageFormatFactorySpi
  org.geotools.gce.arcgrid.ArcGridFormatFactory
  org.geotools.gce.imagemosaic.ImageMosaicFormatFactory
  org.geotools.coverageio.gdal.mrsid.MrSIDFormatFactory
  org.geotools.coverageio.gdal.jp2kak.JP2KFormatFactory
  org.geotools.coverageio.gdal.jp2mrsid.JP2MrSIDFormatFactory
  org.geotools.coverageio.gdal.jp2ecw.JP2ECWFormatFactory
  org.geotools.coverageio.gdal.ecw.ECWFormatFactory
  org.geotools.coverageio.gdal.dted.DTEDFormatFactory
  org.geotools.coverageio.gdal.erdasimg.ErdasImgFormatFactory
  org.geotools.coverageio.gdal.idrisi.IDRISIFormatFactory
  org.geotools.coverageio.gdal.nitf.NITFFormatFactory
  org.geotools.coverageio.gdal.ehdr.EsriHdrFormatFactory
  org.geotools.coverageio.gdal.envihdr.EnviHdrFormatFactory
  org.geotools.coverageio.gdal.aig.AIGFormatFactory
  org.geotools.coverageio.gdal.rpftoc.RPFTOCFormatFactory
  org.geotools.coverageio.gdal.vrt.VRTFormatFactory
  org.geotools.coverageio.gdal.srp.SRPFormatFactory
2021-10-06 15:46:06,291 DEBUG [coverageio.jp2k] - JP2KFormatFactory is available.
2021-10-06 15:46:06,291 DEBUG [gce.arcgrid] - ArcGridFormatFactory is available.
2021-10-06 15:46:06,291 DEBUG [gdal.mrsid] - MrSIDFormatFactory is not available.
2021-10-06 15:46:06,291 DEBUG [gdal.jp2kak] - JP2KFormatFactory is not available.
2021-10-06 15:46:06,291 DEBUG [gdal.jp2mrsid] - JP2MrSIDFormatFactory is not available.
2021-10-06 15:46:06,291 DEBUG [gdal.jp2ecw] - JP2ECWFormatFactory is not available.
2021-10-06 15:46:06,291 DEBUG [gdal.ecw] - ECWFormatFactory is not available.
2021-10-06 15:46:06,292 DEBUG [gdal.dted] - DTEDFormatFactory is available.
2021-10-06 15:46:06,292 DEBUG [gdal.erdasimg] - ErdasImgFormatFactory is available.
2021-10-06 15:46:06,292 DEBUG [gdal.idrisi] - IDRISIFormatFactory is available.
2021-10-06 15:46:06,292 DEBUG [gdal.nitf] - NITFFormatFactory is available.
2021-10-06 15:46:06,292 DEBUG [gdal.ehdr] - EsriHdrFormatFactory is available.
2021-10-06 15:46:06,292 DEBUG [gdal.envihdr] - EnviHdrFormatFactory is available.
2021-10-06 15:46:06,292 DEBUG [gdal.aig] - AIGFormatFactory is available.
2021-10-06 15:46:06,292 DEBUG [gdal.rpftoc] - RPFTOCFormatFactory is available.
2021-10-06 15:46:06,292 DEBUG [gdal.vrt] - VRTFormatFactory is available.
2021-10-06 15:46:06,292 DEBUG [gdal.srp] - SRPFormatFactory is available.
2021-10-06 15:46:06,298 DEBUG [coverageio.jp2k] - Creating a new JP2KFormat.
2021-10-06 15:46:06,301 DEBUG [gdal.aig] - Creating a new AIGFormat.
2021-10-06 15:46:06,301 DEBUG [gdal.vrt] - Creating a new VRTFormat.
2021-10-06 15:46:06,305 DEBUG [gce.arcgrid] - Creating a new ArcGriFormat.
2021-10-06 15:46:06,306 DEBUG [gdal.erdasimg] - Creating a new ErdasImgFormat.
2021-10-06 15:46:06,307 DEBUG [gdal.rpftoc] - Creating a new RPFTOCFormat.
2021-10-06 15:46:06,307 DEBUG [gdal.srp] - Creating a new SRPFormat.
2021-10-06 15:46:06,313 DEBUG [gdal.envihdr] - Creating a new EnviHdrFormat.
2021-10-06 15:46:06,313 DEBUG [gdal.ehdr] - Creating a new EsriHdrFormat.
2021-10-06 15:46:06,314 DEBUG [gdal.idrisi] - Creating a new IDRISIFormat.
2021-10-06 15:46:06,314 DEBUG [gdal.dted] - Creating a new DTEDFormat.
2021-10-06 15:46:06,316 DEBUG [gdal.nitf] - Creating a new NITFFormat.

This leaves the MrSIDFormatFactory, JP2KFormatFactory, JP2MrSIDFormatFactory , JP2ECWFormatFactory, and ECWFormatFactory unavailable. As I don't have a reference system is this expected or is this a sign of additional missing packages?

There is still a non fatal error:

2021-10-06 15:45:59,420 WARN [geoserver.config] - Error reading resource URL [jar:file:/var/lib/tomcat9/webapps/geoserver/WEB-INF/lib/gs-geofence-server-2.18.3.jar!/geofence-default-override.properties]
java.io.FileNotFoundException: URL [jar:file:/var/lib/tomcat9/webapps/geoserver/WEB-INF/lib/gs-geofence-server-2.18.3.jar!/geofence-default-override.properties] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/var/lib/tomcat9/webapps/geoserver/WEB-INF/lib/gs-geofence-server-2.18.3.jar!/geofence-default-override.properties
...
2021-10-06 15:45:59,427 TRACE [config.GeoFencePropertyPlaceholderConfigurer] - Loading properties file from org.geoserver.config.SpringResourceAdaptor@258f15c2
2021-10-06 15:45:59,436 TRACE [config.GeoServerPropertyOverrideConfigurer] - Loading properties file from URL [jar:file:/var/lib/tomcat9/webapps/geoserver/WEB-INF/lib/gs-geofence-server-2.18.3.jar!/geofence-default-override.properties]

Since the error ends up clearing. I'm not sure if this is worth chasing down other than to have clean logs.

There are a number of unresolved warnings:

2021-10-06 15:45:59,560 WARN [geoserver.monitor] - monitoring storage memory not found, falling back to 'memory'
2021-10-06 15:46:00,444 WARN [ejb.Ejb3Configuration] - hibernate.connection.autocommit = false break the EJB3 specification
2021-10-06 15:46:00,485 WARN [dialect.H2Dialect] - The 1.1.119 version of H2 implements temporary table creation such that it commits current transaction; multi-table, bulk hql/jpaql will not work properly
2021-10-06 15:46:00,689 WARN [dialect.H2Dialect] - The 1.1.119 version of H2 implements temporary table creation such that it commits current transaction; multi-table, bulk hql/jpaql will not work properly
2021-10-06 15:46:01,647 WARN [config.XMLConfiguration] - ********************************************************************************
2021-10-06 15:46:01,647 WARN [config.XMLConfiguration] - *** GWC configuration validation error: cvc-elt.1.a: Cannot find the declaration of element 'gwcConfiguration'.
2021-10-06 15:46:01,647 WARN [config.XMLConfiguration] - *** Will try to use configuration anyway. Please check the order of declared elements against the schema.
2021-10-06 15:46:01,647 WARN [config.XMLConfiguration] - ********************************************************************************
2021-10-06 15:46:06,271 WARN [gce.imagemosaic] - Unable to set ordering between tiff readers spi
2021-10-06 15:46:07,669 WARN [platform.resource] - There is code leaving resource input streams open, locks around them might not be cleared! Add -Dgs.lock.trace=true to your JVM options to get a full stack trace of the code that acquired the input stream
2021-10-06 15:46:08,167 WARN [servlet.BaseMapServlet] - Cannot delete file:/var/lib/tomcat9/work/Catalina/localhost/geoserver/wicket-filestore

I'm not sure if these are normal and expected or not.

None of what I did allowed me to change the admin user password, or access or change any of the settings and configurations, e.g. setting up Oauth2. What is everything supposed to look like?

crabel99 commented 3 years ago

Isolated the inability to change settings issue to a proxy header issue with nginx. I was able to log in to port 8080 from my local subnet (configured ufw to open up 8080 on the internal ip) However, when accessing through the nginx proxy there is a partial failure. It seems like geoserver only protects certain parts with CORS (this is pure speculation). The walk through does not address the nginx proxying. I borrowed a set of working proxy configs from another service to test to see if this fixed the issue. Unfortunately, it did not. The good news is that the problem is isolated to the nginx server config. Does anyone have a working nginx config that allows saving tables or changing passwords in geoserver?

server{
   ...
    # HTTP 1.1 support
    proxy_http_version 1.1;
    proxy_buffering off;
    proxy_set_header Host $http_host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $proxy_connection;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
    proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl;
    proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port;
    proxy_buffer_size          128k;
    proxy_buffers              4 256k;
    proxy_busy_buffers_size    256k;
    client_header_buffer_size 500k;
    large_client_header_buffers 4 500k;
    http2_max_field_size       500k;
    http2_max_header_size      500k;
    # Mitigate httpoxy attack (see README for details)
    proxy_set_header Proxy "";
    ...
}