From 80c78bf8060142465bd52cca02ea1c42ec8ce30c Mon Sep 17 00:00:00 2001 From: mazano Date: Tue, 13 Feb 2024 21:17:54 +0200 Subject: [PATCH] fix jbdcconfig and jdbcstore (#622) * fix jbdcconfig and jdbcstore * fix config --- build_data/jdbcconfig/jdbcconfig.properties | 4 ++-- build_data/jdbcstore/jdbcstore.properties | 4 ++-- scripts/entrypoint.sh | 9 +++++++++ scripts/functions.sh | 6 ++++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/build_data/jdbcconfig/jdbcconfig.properties b/build_data/jdbcconfig/jdbcconfig.properties index ff437b75..6d1980fd 100644 --- a/build_data/jdbcconfig/jdbcconfig.properties +++ b/build_data/jdbcconfig/jdbcconfig.properties @@ -2,7 +2,7 @@ #Mon Feb 05 14:49:17 GMT 2024 initdb=true pool.timeBetweenEvictionRunsMillis=-1L -import=false +import=true pool.poolPreparedStatements=true pool.testWhileIdle=false pool.validationQuery=SELECT now() @@ -13,7 +13,7 @@ password=${POSTGRES_PASS} jdbcUrl=jdbc:postgresql://${HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?${SSL_PARAMETERS} driverClassName=org.postgresql.Driver pool.maxActive=10 -initScript=jdbcconfig/scripts/initdb.postgres.sql +initScript=${GEOSERVER_DATA_DIR}/jdbcconfig/scripts/initdb.postgres.sql debugMode=false pool.testOnBorrow=true username=${POSTGRES_USER} diff --git a/build_data/jdbcstore/jdbcstore.properties b/build_data/jdbcstore/jdbcstore.properties index 0b5e6d81..c759bf1e 100644 --- a/build_data/jdbcstore/jdbcstore.properties +++ b/build_data/jdbcstore/jdbcstore.properties @@ -12,9 +12,9 @@ ignoreDirs=${JDBC_IGNORE_PATHS} enabled=${JDBC_STORE_ENABLED} pool.maxOpenPreparedStatements=50 password=${POSTGRES_PASS} -jdbcUrl=jdbcUrl=jdbc:postgresql://${HOST}:${POSTGRES_PORT}/${JDBC_STORE_DB}?${SSL_PARAMETERS} +jdbcUrl=jdbc:postgresql://${HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?${SSL_PARAMETERS} driverClassName=org.postgresql.Driver pool.maxActive=10 -initScript=jdbcstore/scripts/init.postgres.sql +initScript=${GEOSERVER_DATA_DIR}/jdbcstore/scripts/init.postgres.sql pool.testOnBorrow=true username=${POSTGRES_USER} diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index d849cb0e..f5ed472e 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -113,8 +113,17 @@ if [[ ${RUN_AS_ROOT} =~ [Ff][Aa][Ll][Ss][Ee] ]];then chown -R "${USER_NAME}":"${GEO_GROUP_NAME}" "${CLUSTER_CONFIG_DIR}" fi chown -R "${USER_NAME}":"${GEO_GROUP_NAME}" "${GEOSERVER_DATA_DIR}"/logging.xml + if [[ -d "${GEOSERVER_DATA_DIR}"/jdbcconfig ]];then + chown -R "${USER_NAME}":"${GEO_GROUP_NAME}" "${GEOSERVER_DATA_DIR}"/jdbcconfig + fi + + if [[ -d "${GEOSERVER_DATA_DIR}"/jdbcconfig ]];then + chown -R "${USER_NAME}":"${GEO_GROUP_NAME}" "${GEOSERVER_DATA_DIR}"/jdbcstore + fi fi + + chmod o+rw "${CERT_DIR}";gwc_file_perms ;chmod 400 "${CATALINA_HOME}"/conf/* if [[ ${SAMPLE_DATA} =~ [Tt][Rr][Uu][Ee] ]]; then diff --git a/scripts/functions.sh b/scripts/functions.sh index a1799e67..c0cb8426 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -575,6 +575,9 @@ fi function setup_jdbc_db_config() { if [[ ${ext} == 'jdbcconfig-plugin' ]];then if [[ ${DB_BACKEND} =~ [Pp][Oo][Ss][Tt][Gg][Rr][Ee][Ss] ]]; then + PGPASSWORD="${POSTGRES_PASS}" + export PGPASSWORD + postgres_ready_status "${HOST}" "${POSTGRES_PORT}" "${POSTGRES_USER}" "$POSTGRES_DB" if [[ -d "${GEOSERVER_DATA_DIR}"/jdbcconfig ]];then rm -r "${GEOSERVER_DATA_DIR}"/jdbcconfig else @@ -593,6 +596,9 @@ function setup_jdbc_db_config() { function setup_jdbc_db_store() { if [[ ${ext} == 'jdbcstore-plugin' ]];then + PGPASSWORD="${POSTGRES_PASS}" + export PGPASSWORD + postgres_ready_status "${HOST}" "${POSTGRES_PORT}" "${POSTGRES_USER}" "$POSTGRES_DB" if [[ ${DB_BACKEND} =~ [Pp][Oo][Ss][Tt][Gg][Rr][Ee][Ss] ]]; then if [[ -d "${GEOSERVER_DATA_DIR}"/jdbcstore ]];then rm -r "${GEOSERVER_DATA_DIR}"/jdbcstore