dataminer, dataminer-multiple-instances: fixes to support tomcat 8.
This commit is contained in:
parent
2d7a8e16ac
commit
5627a97bca
|
@ -148,6 +148,7 @@
|
||||||
- name: Install the instances startup scripts
|
- name: Install the instances startup scripts
|
||||||
template: src=tomcat-instance.init.j2 dest=/etc/init.d/tomcat-instance-{{ item.http_port }} mode=0755 owner=root group=root
|
template: src=tomcat-instance.init.j2 dest=/etc/init.d/tomcat-instance-{{ item.http_port }} mode=0755 owner=root group=root
|
||||||
with_items: '{{ tomcat_m_instances }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
|
register: reload_systemd
|
||||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_init' ]
|
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_init' ]
|
||||||
|
|
||||||
- name: Install the tomcat instances default file
|
- name: Install the tomcat instances default file
|
||||||
|
@ -156,6 +157,10 @@
|
||||||
notify: tomcat instances restart
|
notify: tomcat instances restart
|
||||||
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_default', 'jdk' ]
|
tags: [ 'tomcat', 'tomcat_instances', 'tomcat_conf', 'tomcat_default', 'jdk' ]
|
||||||
|
|
||||||
|
- name: Reload the systemd daemon if we are running on a systemd-backed server
|
||||||
|
command: systemctl daemon-reload
|
||||||
|
when: ansible_service_mgr == 'systemd'
|
||||||
|
|
||||||
- name: Install a custom context.xml file
|
- name: Install a custom context.xml file
|
||||||
template: src=tomcat-context.xml.j2 dest={{ item.instance_path }}/conf/context.xml owner={{ item.user }} group={{ item.user }} mode=0640
|
template: src=tomcat-context.xml.j2 dest={{ item.instance_path }}/conf/context.xml owner={{ item.user }} group={{ item.user }} mode=0640
|
||||||
with_items: '{{ tomcat_m_instances }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# /etc/init.d/tomcat-instance-{{ item.http_port }} -- startup script for the Tomcat 7 {{ item.user }} servlet engine on port {{ item.http_port }}
|
# /etc/init.d/tomcat-instance-{{ item.http_port }} -- startup script for the Tomcat {{ tomcat_version }} {{ item.user }} servlet engine on port {{ item.http_port }}
|
||||||
#
|
#
|
||||||
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
|
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
|
||||||
# Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
|
# Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
# Additional improvements by Jason Brittain <jason.brittain@mulesoft.com>.
|
# Additional improvements by Jason Brittain <jason.brittain@mulesoft.com>.
|
||||||
#
|
#
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: tomcat-instance-8280
|
# Provides: tomcat-instance-{{ item.http_port }}
|
||||||
# Required-Start: $local_fs $remote_fs $network
|
# Required-Start: $local_fs $remote_fs $network
|
||||||
# Required-Stop: $local_fs $remote_fs $network
|
# Required-Stop: $local_fs $remote_fs $network
|
||||||
# Should-Start: $named
|
# Should-Start: $named
|
||||||
|
@ -49,15 +49,29 @@ fi
|
||||||
|
|
||||||
# The following variables can be overwritten in $DEFAULT
|
# The following variables can be overwritten in $DEFAULT
|
||||||
|
|
||||||
# Run Tomcat 7 as this user ID and group ID
|
# Run Tomcat {{ tomcat_version }} as this user ID and group ID
|
||||||
TOMCAT7_USER={{ item.user }}
|
TOMCAT{{ tomcat_version }}_USER={{ item.user }}
|
||||||
TOMCAT7_GROUP={{ item.user }}
|
TOMCAT{{ tomcat_version }}_GROUP={{ item.user }}
|
||||||
|
|
||||||
# this is a work-around until there is a suitable runtime replacement
|
# this is a work-around until there is a suitable runtime replacement
|
||||||
# for dpkg-architecture for arch:all packages
|
# for dpkg-architecture for arch:all packages
|
||||||
# this function sets the variable OPENJDKS
|
# this function sets the variable OPENJDKS
|
||||||
find_openjdks()
|
find_openjdks()
|
||||||
{
|
{
|
||||||
|
for jvmdir in /usr/lib/jvm/java-11-openjdk-*
|
||||||
|
do
|
||||||
|
if [ -d "${jvmdir}" -a "${jvmdir}" != "/usr/lib/jvm/java-11-openjdk-common" ]
|
||||||
|
then
|
||||||
|
OPENJDKS=$jvmdir
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for jvmdir in /usr/lib/jvm/java-8-openjdk-*
|
||||||
|
do
|
||||||
|
if [ -d "${jvmdir}" -a "${jvmdir}" != "/usr/lib/jvm/java-8-openjdk-common" ]
|
||||||
|
then
|
||||||
|
OPENJDKS=$jvmdir
|
||||||
|
fi
|
||||||
|
done
|
||||||
for jvmdir in /usr/lib/jvm/java-7-openjdk-*
|
for jvmdir in /usr/lib/jvm/java-7-openjdk-*
|
||||||
do
|
do
|
||||||
if [ -d "${jvmdir}" -a "${jvmdir}" != "/usr/lib/jvm/java-7-openjdk-common" ]
|
if [ -d "${jvmdir}" -a "${jvmdir}" != "/usr/lib/jvm/java-7-openjdk-common" ]
|
||||||
|
@ -89,13 +103,13 @@ done
|
||||||
export JAVA_HOME
|
export JAVA_HOME
|
||||||
|
|
||||||
# Directory where the Tomcat binary distribution resides
|
# Directory where the Tomcat binary distribution resides
|
||||||
CATALINA_HOME=/usr/share/tomcat7
|
CATALINA_HOME=/usr/share/tomcat{{ tomcat_version }}
|
||||||
|
|
||||||
# Directory for per-instance configuration files and webapps
|
# Directory for per-instance configuration files and webapps
|
||||||
CATALINA_BASE={{ item.instance_path }}
|
CATALINA_BASE={{ item.instance_path }}
|
||||||
|
|
||||||
# Use the Java security manager? (yes/no)
|
# Use the Java security manager? (yes/no)
|
||||||
TOMCAT7_SECURITY=no
|
TOMCAT{{ tomcat_version }}_SECURITY=no
|
||||||
|
|
||||||
# Default Java options
|
# Default Java options
|
||||||
# Set java.awt.headless=true if JAVA_OPTS is not set so the
|
# Set java.awt.headless=true if JAVA_OPTS is not set so the
|
||||||
|
@ -124,13 +138,13 @@ if [ -z "$CATALINA_TMPDIR" ]; then
|
||||||
CATALINA_TMPDIR="$JVM_TMP"
|
CATALINA_TMPDIR="$JVM_TMP"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set the JSP compiler if set in the tomcat7.default file
|
# Set the JSP compiler if set in the ${ NAME }.default file
|
||||||
if [ -n "$JSP_COMPILER" ]; then
|
if [ -n "$JSP_COMPILER" ]; then
|
||||||
JAVA_OPTS="$JAVA_OPTS -Dbuild.compiler=\"$JSP_COMPILER\""
|
JAVA_OPTS="$JAVA_OPTS -Dbuild.compiler=\"$JSP_COMPILER\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SECURITY=""
|
SECURITY=""
|
||||||
if [ "$TOMCAT7_SECURITY" = "yes" ]; then
|
if [ "$TOMCAT{{ tomcat_version }}_SECURITY" = "yes" ]; then
|
||||||
SECURITY="-security"
|
SECURITY="-security"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -172,9 +186,9 @@ catalina_sh() {
|
||||||
# Run the catalina.sh script as a daemon
|
# Run the catalina.sh script as a daemon
|
||||||
set +e
|
set +e
|
||||||
touch "$CATALINA_PID" "$CATALINA_BASE"/logs/catalina.out
|
touch "$CATALINA_PID" "$CATALINA_BASE"/logs/catalina.out
|
||||||
chown $TOMCAT7_USER "$CATALINA_PID" "$CATALINA_BASE"/logs/catalina.out
|
chown $TOMCAT{{ tomcat_version }}_USER "$CATALINA_PID" "$CATALINA_BASE"/logs/catalina.out
|
||||||
start-stop-daemon --start -b -u "$TOMCAT7_USER" -g "$TOMCAT7_GROUP" \
|
start-stop-daemon --start -b -u "$TOMCAT{{ tomcat_version }}_USER" -g "$TOMCAT{{ tomcat_version }}_GROUP" \
|
||||||
-c "$TOMCAT7_USER" -d "$CATALINA_TMPDIR" -p "$CATALINA_PID" \
|
-c "$TOMCAT{{ tomcat_version }}_USER" -d "$CATALINA_TMPDIR" -p "$CATALINA_PID" \
|
||||||
-x /bin/bash -- -c "$AUTHBIND_COMMAND $TOMCAT_SH"
|
-x /bin/bash -- -c "$AUTHBIND_COMMAND $TOMCAT_SH"
|
||||||
status="$?"
|
status="$?"
|
||||||
set +a -e
|
set +a -e
|
||||||
|
@ -195,7 +209,7 @@ case "$1" in
|
||||||
|
|
||||||
log_daemon_msg "Starting $DESC" "$NAME"
|
log_daemon_msg "Starting $DESC" "$NAME"
|
||||||
if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
|
if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
|
||||||
--user $TOMCAT7_USER --exec "$JAVA_HOME/bin/java" \
|
--user $TOMCAT{{ tomcat_version }}_USER --exec "$JAVA_HOME/bin/java" \
|
||||||
>/dev/null; then
|
>/dev/null; then
|
||||||
|
|
||||||
# Regenerate POLICY_CACHE file
|
# Regenerate POLICY_CACHE file
|
||||||
|
@ -212,12 +226,12 @@ case "$1" in
|
||||||
log_failure_msg "could not create JVM temporary directory"
|
log_failure_msg "could not create JVM temporary directory"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
chown $TOMCAT7_USER "$JVM_TMP"
|
chown $TOMCAT{{ tomcat_version }}_USER "$JVM_TMP"
|
||||||
|
|
||||||
catalina_sh start $SECURITY
|
catalina_sh start $SECURITY
|
||||||
sleep 5
|
sleep 5
|
||||||
if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
|
if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
|
||||||
--user $TOMCAT7_USER --exec "$JAVA_HOME/bin/java" \
|
--user $TOMCAT{{ tomcat_version }}_USER --exec "$JAVA_HOME/bin/java" \
|
||||||
>/dev/null; then
|
>/dev/null; then
|
||||||
if [ -f "$CATALINA_PID" ]; then
|
if [ -f "$CATALINA_PID" ]; then
|
||||||
rm -f "$CATALINA_PID"
|
rm -f "$CATALINA_PID"
|
||||||
|
@ -237,7 +251,7 @@ case "$1" in
|
||||||
set +e
|
set +e
|
||||||
if [ -f "$CATALINA_PID" ]; then
|
if [ -f "$CATALINA_PID" ]; then
|
||||||
start-stop-daemon --stop --pidfile "$CATALINA_PID" \
|
start-stop-daemon --stop --pidfile "$CATALINA_PID" \
|
||||||
--user "$TOMCAT7_USER" \
|
--user "$TOMCAT{{ tomcat_version }}_USER" \
|
||||||
--retry=TERM/20/KILL/5 >/dev/null
|
--retry=TERM/20/KILL/5 >/dev/null
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
log_progress_msg "$DESC is not running but pid file exists, cleaning up"
|
log_progress_msg "$DESC is not running but pid file exists, cleaning up"
|
||||||
|
@ -257,7 +271,7 @@ case "$1" in
|
||||||
status)
|
status)
|
||||||
set +e
|
set +e
|
||||||
start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
|
start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
|
||||||
--user $TOMCAT7_USER --exec "$JAVA_HOME/bin/java" \
|
--user $TOMCAT{{ tomcat_version }}_USER --exec "$JAVA_HOME/bin/java" \
|
||||||
>/dev/null 2>&1
|
>/dev/null 2>&1
|
||||||
if [ "$?" = "0" ]; then
|
if [ "$?" = "0" ]; then
|
||||||
|
|
||||||
|
@ -282,7 +296,7 @@ case "$1" in
|
||||||
;;
|
;;
|
||||||
try-restart)
|
try-restart)
|
||||||
if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
|
if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
|
||||||
--user $TOMCAT7_USER --exec "$JAVA_HOME/bin/java" \
|
--user $TOMCAT{{ tomcat_version }}_USER --exec "$JAVA_HOME/bin/java" \
|
||||||
>/dev/null; then
|
>/dev/null; then
|
||||||
$0 start
|
$0 start
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -21,7 +21,9 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
<Server port="{{ item.shutdown_port }}" shutdown="{{ tomcat_m_shutdown_pwd }}">
|
<Server port="{{ item.shutdown_port }}" shutdown="{{ tomcat_m_shutdown_pwd }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if tomcat_version <= 7 %}
|
||||||
<Listener className="org.apache.catalina.core.JasperListener" />
|
<Listener className="org.apache.catalina.core.JasperListener" />
|
||||||
|
{% endif %}
|
||||||
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
|
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
|
||||||
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
|
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
|
||||||
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
|
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
- import_tasks: tomcat-log4j-logging.yml
|
- import_tasks: tomcat-log4j-logging.yml
|
||||||
when:
|
when:
|
||||||
- tomcat_use_log4j
|
- tomcat_use_log4j
|
||||||
- tomcat_version <= '7'
|
- tomcat_version <= 7
|
||||||
tags: [ 'tomcat', 'tomcat_log4j' ]
|
tags: [ 'tomcat', 'tomcat_log4j' ]
|
||||||
- import_tasks: tomcat-logger-logging.yml
|
- import_tasks: tomcat-logger-logging.yml
|
||||||
when: not tomcat_use_log4j or tomcat_version > '7'
|
when: not tomcat_use_log4j or tomcat_version > 7
|
||||||
- import_tasks: access_log.yml
|
- import_tasks: access_log.yml
|
||||||
when: tomcat_access_log_enabled
|
when: tomcat_access_log_enabled
|
||||||
- import_tasks: pgsql_jdbc.yml
|
- import_tasks: pgsql_jdbc.yml
|
||||||
|
|
Loading…
Reference in New Issue