Skip to content

Commit

Permalink
fix monitoring creating multiple folders (#576)
Browse files Browse the repository at this point in the history
* fix monitoring creating multiple folders

* fix permission for minitoring directory

* only clean monitoring folders when not in cluster
  • Loading branch information
NyakudyaA authored Oct 9, 2023
1 parent c2e8a75 commit 2014ac1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ if [[ ${RUN_AS_ROOT} =~ [Ff][Aa][Ll][Ss][Ee] ]];then
dir_ownership=("${CATALINA_HOME}" /home/"${USER_NAME}"/ "${COMMUNITY_PLUGINS_DIR}"
"${STABLE_PLUGINS_DIR}" "${GEOSERVER_HOME}" /usr/share/fonts/ /tomcat_apps.zip
/tmp/ "${FOOTPRINTS_DATA_DIR}" "${CERT_DIR}" "${FONTS_DIR}" /scripts/
"${EXTRA_CONFIG_DIR}" "/docker-entrypoint-geoserver.d")
"${EXTRA_CONFIG_DIR}" "/docker-entrypoint-geoserver.d" "${MONITOR_AUDIT_PATH}")
for directory in "${dir_ownership[@]}"; do
if [[ $(stat -c '%U' "${directory}") != "${USER_NAME}" ]] && [[ $(stat -c '%G' "${directory}") != "${GEO_GROUP_NAME}" ]];then
chown -R "${USER_NAME}":"${GEO_GROUP_NAME}" "${directory}"
Expand Down
20 changes: 20 additions & 0 deletions scripts/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -536,3 +536,23 @@ function entry_point_script {
done
fi
}

function setup_monitoring() {

if [[ -f "${EXTRA_CONFIG_DIR}"/monitor.properties ]]; then
envsubst < "${EXTRA_CONFIG_DIR}"/monitor.properties > "${GEOSERVER_DATA_DIR}"/monitoring/monitor.properties
else

cat > "${GEOSERVER_DATA_DIR}"/monitoring/monitor.properties <<EOF
audit.enabled=true
audit.roll_limit=40
storage=memory
mode=history
sync=async
maxBodySize=1024
bboxLogCrs=EPSG:4326
bboxLogLevel=no_wfs
EOF
fi

}
6 changes: 6 additions & 0 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,13 @@ fi
set_vars
export READONLY CLUSTER_DURABILITY BROKER_URL EMBEDDED_BROKER TOGGLE_MASTER TOGGLE_SLAVE BROKER_URL
export CLUSTER_CONFIG_DIR MONITOR_AUDIT_PATH INSTANCE_STRING
# Cleanup existing monitoring files
if [[ ${CLUSTERING} =~ [Ff][Aa][Ll][Ss][Ee] ]]; then
find "${GEOSERVER_DATA_DIR}"/monitoring -type d -name 'monitor_*' -exec rm -r {} +
fi
create_dir "${MONITOR_AUDIT_PATH}"
setup_monitoring


if [[ ${CLUSTERING} =~ [Tt][Rr][Uu][Ee] ]]; then
ext=jms-cluster-plugin
Expand Down

0 comments on commit 2014ac1

Please sign in to comment.