Fixed default value for JNDI resource.

In Apache tomcat we have to name it "jdbc/postgres" while in Geoserver we have to name it "java:comp/env/jdbc/postgres".
pull/31/head
Mitchell Bösecke 2023-11-09 09:54:11 -07:00
parent 70d948e7c8
commit 8be469744c
3 changed files with 20 additions and 2 deletions

View File

@ -139,7 +139,9 @@ To enable a PostgreSQL JNDI resource, provide the following environment variable
* ``POSTGRES_DB`` * ``POSTGRES_DB``
* ``POSTGRES_USERNAME`` * ``POSTGRES_USERNAME``
* ``POSTGRES_PASSWORD`` * ``POSTGRES_PASSWORD``
* ``POSTGRES_JNDI_RESOURCE_NAME`` (optional; defaults to ``java:comp/env/jdbc/postgres``) * ``POSTGRES_JNDI_RESOURCE_NAME`` (optional; defaults to ``jdbc/postgres``)
In geoserver, you can then reference this JNDI resource using the name `java:comp/env/jdbc/postgres` (if using default).
For advanced customization of the connection pool, you can provide your own customized "context.xml" For advanced customization of the connection pool, you can provide your own customized "context.xml"
file to Apache Tomcat by mounting it to the container at ``/opt/config_overrides/context.xml``. file to Apache Tomcat by mounting it to the container at ``/opt/config_overrides/context.xml``.

View File

@ -13,6 +13,22 @@ services:
- INSTALL_EXTENSIONS=true - INSTALL_EXTENSIONS=true
- STABLE_EXTENSIONS=wps,csw - STABLE_EXTENSIONS=wps,csw
- EXTRA_JAVA_OPTS=-Xms1G -Xmx2G - EXTRA_JAVA_OPTS=-Xms1G -Xmx2G
- POSTGRES_JNDI_ENABLED=true
- POSTGRES_HOST=postgis
- POSTGRES_PORT=5432
- POSTGRES_DB=geoserver
- POSTGRES_USERNAME=geoserver
- POSTGRES_PASSWORD=geoserver
- POSTGRES_JNDI_RESOURCE_NAME=jdbc/postgres
volumes: volumes:
- ./geoserver_data:/opt/geoserver_data/:Z - ./geoserver_data:/opt/geoserver_data/:Z
- ./additional_libs:/opt/additional_libs:Z # by mounting this we can install libs from host on startup - ./additional_libs:/opt/additional_libs:Z # by mounting this we can install libs from host on startup
postgis:
image: postgis/postgis:16-3.4-alpine
ports:
- 5555:5432
environment:
POSTGRES_USER: geoserver
POSTGRES_PASSWORD: geoserver
volumes:
- ./postgis/postgresql_data:/var/lib/postgresql/data:Z

View File

@ -94,7 +94,7 @@ if [ "${POSTGRES_JNDI_ENABLED}" = "true" ]; then
# Set up some default values # Set up some default values
if [ -z "${POSTGRES_JNDI_RESOURCE_NAME}" ]; then if [ -z "${POSTGRES_JNDI_RESOURCE_NAME}" ]; then
export POSTGRES_JNDI_RESOURCE_NAME="java:comp/env/jdbc/postgres" export POSTGRES_JNDI_RESOURCE_NAME="jdbc/postgres"
fi fi
if [ -z "${POSTGRES_PORT}" ]; then if [ -z "${POSTGRES_PORT}" ]; then
export POSTGRES_PORT="5432" export POSTGRES_PORT="5432"