Skip to content

Commit

Permalink
fix entrypoint and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
NyakudyaA committed Aug 13, 2023
1 parent 72036f4 commit ee60bc7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
24 changes: 11 additions & 13 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ set_vars
export READONLY CLUSTER_DURABILITY BROKER_URL EMBEDDED_BROKER TOGGLE_MASTER TOGGLE_SLAVE BROKER_URL
export CLUSTER_CONFIG_DIR MONITOR_AUDIT_PATH CLUSTER_LOCKFILE INSTANCE_STRING


/bin/bash /scripts/start.sh


Expand Down Expand Up @@ -95,21 +96,18 @@ export JAVA_OPTS="${JAVA_OPTS} ${GEOSERVER_OPTS}"


# Chown again - seems to fix issue with resolving all created directories
CHOWN_LOCKFILE=/scripts/.permission_file.lock
if [[ $(stat -c '%U' ${CATALINA_HOME}) != "${USER_NAME}" ]] && [[ $(stat -c '%G' ${CATALINA_HOME}) != "${GEO_GROUP_NAME}" ]];then
if [[ -f ${CHOWN_LOCKFILE} ]];then
rm ${CHOWN_LOCKFILE}
fi
if [[ ! -f ${CHOWN_LOCKFILE} ]];then
chown -R "${USER_NAME}":"${GEO_GROUP_NAME}" "${CATALINA_HOME}" \
/home/"${USER_NAME}"/ "${COMMUNITY_PLUGINS_DIR}" "${STABLE_PLUGINS_DIR}" \
"${GEOSERVER_HOME}" /usr/share/fonts/ /scripts /tomcat_apps.zip /tmp/
touch ${CHOWN_LOCKFILE}
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}"
"${EXTRA_CONFIG_DIR}")
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}
fi
fi
done


chown -R "${USER_NAME}":"${GEO_GROUP_NAME}" "${FOOTPRINTS_DATA_DIR}" "${CERT_DIR}" "${FONTS_DIR}" \
"${EXTRA_CONFIG_DIR}" ;chmod o+rw "${CERT_DIR}";gwc_file_perms ;chmod 400 ${CATALINA_HOME}/conf/*
chmod o+rw "${CERT_DIR}";gwc_file_perms ;chmod 400 ${CATALINA_HOME}/conf/*

if [[ ${SAMPLE_DATA} =~ [Tt][Rr][Uu][Ee] ]]; then
chown -R "${USER_NAME}":"${GEO_GROUP_NAME}" "${GEOSERVER_DATA_DIR}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function web_cors() {
cp -f "${EXTRA_CONFIG_DIR}"/web.xml "${CATALINA_HOME}"/conf/
else
# default values
envsubst < /build_data/web.xml > "${CATALINA_HOME}"/conf/
envsubst < /build_data/web.xml > "${CATALINA_HOME}"/conf/web.xml
###
# Deactivate CORS filter in web.xml if DISABLE_CORS=true
# Useful if CORS is handled outside of Tomcat (e.g. in a proxying webserver like nginx)
Expand Down

0 comments on commit ee60bc7

Please sign in to comment.