From 5ae07c0d0a5b21d3d84be2065710e7495c38bda5 Mon Sep 17 00:00:00 2001 From: Brian Kelley Date: Fri, 20 Jan 2023 21:44:56 -0600 Subject: [PATCH] Add a server xml template file within a new directory with bash startup script support to allow overriding the default tomcat server xml file --- Dockerfile | 4 ++- configuration.sh | 9 +++++- server.template | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 server.template diff --git a/Dockerfile b/Dockerfile index 2b7e898..da70b49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,8 @@ RUN apt-get update -qq && \ apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ adduser --disabled-password --gecos '' tomcat && \ rm -rf /usr/local/tomcat/webapps && \ - mkdir -p /usr/local/tomcat/webapps + mkdir -p /usr/local/tomcat/webapps && \ + mkdir /jamfpro-config COPY startup.sh /startup.sh COPY log4j.stdout.replace /log4j.stdout.replace @@ -15,6 +16,7 @@ COPY log4j2.stdout.appenders.replace /log4j2.stdout.appenders.replace COPY log4j2.stdout.loggers.analytics.replace /log4j2.stdout.loggers.analytics.replace COPY log4j2.stdout.loggers.root.replace /log4j2.stdout.loggers.root.replace COPY log4j2.stdout.loggers.vpp.replace /log4j2.stdout.loggers.vpp.replace +COPY server.template /jamfpro-config/server.template COPY configuration.sh /configuration.sh CMD ["/startup.sh"] diff --git a/configuration.sh b/configuration.sh index 2f44ec8..bf44412 100755 --- a/configuration.sh +++ b/configuration.sh @@ -140,6 +140,12 @@ memcached.timeToLiveSeconds=120 EOF } +## Move the server.xml template into proper location +tomcatServerXML() { + echo_time "Moving custom server.xml into tomcat" + eval "echo \"$(cat "/jamfpro-config/server.template")\" " > /usr/local/tomcat/conf/server.xml +} + ########################################################## # Arguments: # Cluster primary node name / ip @@ -148,7 +154,7 @@ create_cluster_properties() { echo_time "Creating the clustering properties file" cat <<- EOF > /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/clustering.properties cluster.settings.enabled=true -cluster.settings.monitor_frequency=180 +cluster.settings.monitor_frequency=60 cluster.node[0]=$1 EOF } @@ -205,5 +211,6 @@ setup_jmx_remote_opts setup_java_opts +tomcatServerXML ########################################################## diff --git a/server.template b/server.template new file mode 100644 index 0000000..40611b2 --- /dev/null +++ b/server.template @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +