From 7b8621da349c49a111bd6822888ce3df76c1c027 Mon Sep 17 00:00:00 2001 From: kurczews Date: Wed, 19 Sep 2018 08:17:52 +0200 Subject: Improve localize scripts Improve scripts to avoid unecessary WAR repackaging. Tomcat extracts WAR content when deployed so there is no need to repackage whole WAR (time-costly operation) in order to update template properties Issue-ID: VID-164 Change-Id: I2aa2db915ba7408cf9da51a28695c4890c369312 Signed-off-by: kurczews --- deliveries/src/main/scripts/localize.sh | 29 +++++++++++++++---------- deliveries/src/main/scripts/localize_asdc.sh | 4 ++-- deliveries/src/main/scripts/localize_cache.sh | 4 ++-- deliveries/src/main/scripts/localize_log4j.sh | 4 ++-- deliveries/src/main/scripts/localize_logback.sh | 4 ++-- deliveries/src/main/scripts/localize_portal.sh | 4 ++-- deliveries/src/main/scripts/localize_quartz.sh | 4 ++-- deliveries/src/main/scripts/localize_system.sh | 4 ++-- deliveries/src/main/scripts/localize_war.sh | 12 +++++----- 9 files changed, 37 insertions(+), 32 deletions(-) diff --git a/deliveries/src/main/scripts/localize.sh b/deliveries/src/main/scripts/localize.sh index 3966f7023..aca557f36 100755 --- a/deliveries/src/main/scripts/localize.sh +++ b/deliveries/src/main/scripts/localize.sh @@ -1,18 +1,23 @@ #!/bin/bash -#Extract the WAR so it can be customized by the localization script -cd /tmp/vid/stage -jar -xf vid.war +fillTemplateProperties() { + source /tmp/vid/localize_war.sh $1 || { + echo "ERROR: Localization script failed" + exit 2 + } +} -source /tmp/vid/localize_war.sh || { - echo "ERROR: Localization script failed" - exit 2 +deployWarOnTomcatManually() { + cd /usr/local/tomcat/webapps/ + mkdir vid + cd vid + jar -xf /tmp/vid/stage/vid.war } -#Create the customized WAR and deploy it to Tomcat -mkdir -p /tmp/vid/deployed -cd /tmp/vid/stage -jar -cvf /tmp/vid/deployed/vid.war . -cd -mv -f /tmp/vid/deployed/vid.war /usr/local/tomcat/webapps +deployWarOnTomcatManually + +TEMPLATES_BASE_DIR=/usr/local/tomcat/webapps/vid/WEB-INF + +fillTemplateProperties ${TEMPLATES_BASE_DIR} + catalina.sh run diff --git a/deliveries/src/main/scripts/localize_asdc.sh b/deliveries/src/main/scripts/localize_asdc.sh index 549c17af1..af483186f 100755 --- a/deliveries/src/main/scripts/localize_asdc.sh +++ b/deliveries/src/main/scripts/localize_asdc.sh @@ -1,7 +1,7 @@ #!/bin/bash -FINAL_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/asdc.properties -TEMPLATE_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/asdc_template.properties +FINAL_CONFIG_FILE=$1/conf/asdc.properties +TEMPLATE_CONFIG_FILE=$1/conf/asdc_template.properties echo "Localizing the ASDC client configuration" diff --git a/deliveries/src/main/scripts/localize_cache.sh b/deliveries/src/main/scripts/localize_cache.sh index d25949ccc..2d676c373 100755 --- a/deliveries/src/main/scripts/localize_cache.sh +++ b/deliveries/src/main/scripts/localize_cache.sh @@ -1,7 +1,7 @@ #!/bin/bash -FINAL_CONFIG_FILE=/tmp/vid/stage/WEB-INF/classes/cache.ccf -TEMPLATE_CONFIG_FILE=/tmp/vid/stage/WEB-INF/classes/cache_template.ccf +FINAL_CONFIG_FILE=$1/classes/cache.ccf +TEMPLATE_CONFIG_FILE=$1/classes/cache_template.ccf echo "Localizing the VID cache configuration" diff --git a/deliveries/src/main/scripts/localize_log4j.sh b/deliveries/src/main/scripts/localize_log4j.sh index d2ab2bba4..121f5673a 100755 --- a/deliveries/src/main/scripts/localize_log4j.sh +++ b/deliveries/src/main/scripts/localize_log4j.sh @@ -1,7 +1,7 @@ #!/bin/bash -FINAL_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/log4j.properties -TEMPLATE_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/log4j_template.properties +FINAL_CONFIG_FILE=$1/conf/log4j.properties +TEMPLATE_CONFIG_FILE=$1/conf/log4j_template.properties echo "Localizing the VID log4j configuration" diff --git a/deliveries/src/main/scripts/localize_logback.sh b/deliveries/src/main/scripts/localize_logback.sh index 43798eb84..a0f177337 100755 --- a/deliveries/src/main/scripts/localize_logback.sh +++ b/deliveries/src/main/scripts/localize_logback.sh @@ -1,7 +1,7 @@ #!/bin/bash -FINAL_CONFIG_FILE=/tmp/vid/stage/WEB-INF/classes/logback.xml -TEMPLATE_CONFIG_FILE=/tmp/vid/stage/WEB-INF/classes/logback_template.xml +FINAL_CONFIG_FILE=$1/classes/logback.xml +TEMPLATE_CONFIG_FILE=$1/classes/logback_template.xml echo "Localizing the VID logback configuration" diff --git a/deliveries/src/main/scripts/localize_portal.sh b/deliveries/src/main/scripts/localize_portal.sh index f29d485eb..947e0e1d0 100755 --- a/deliveries/src/main/scripts/localize_portal.sh +++ b/deliveries/src/main/scripts/localize_portal.sh @@ -1,7 +1,7 @@ #!/bin/bash -FINAL_CONFIG_FILE=/tmp/vid/stage/WEB-INF/classes/portal.properties -TEMPLATE_CONFIG_FILE=/tmp/vid/stage/WEB-INF/classes/portal_template.properties +FINAL_CONFIG_FILE=$1/classes/portal.properties +TEMPLATE_CONFIG_FILE=$1/classes/portal_template.properties echo "Localizing the VID portal configuration" diff --git a/deliveries/src/main/scripts/localize_quartz.sh b/deliveries/src/main/scripts/localize_quartz.sh index c284e6c24..c22d8793a 100755 --- a/deliveries/src/main/scripts/localize_quartz.sh +++ b/deliveries/src/main/scripts/localize_quartz.sh @@ -1,7 +1,7 @@ #!/bin/bash -FINAL_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/quartz.properties -TEMPLATE_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/quartz_template.properties +FINAL_CONFIG_FILE=$1/conf/quartz.properties +TEMPLATE_CONFIG_FILE=$1/conf/quartz_template.properties echo "Localizing the VID quartz configuration" diff --git a/deliveries/src/main/scripts/localize_system.sh b/deliveries/src/main/scripts/localize_system.sh index a739335be..0947d49ea 100755 --- a/deliveries/src/main/scripts/localize_system.sh +++ b/deliveries/src/main/scripts/localize_system.sh @@ -1,7 +1,7 @@ #!/bin/bash -FINAL_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/system.properties -TEMPLATE_CONFIG_FILE=/tmp/vid/stage/WEB-INF/conf/system_template.properties +FINAL_CONFIG_FILE=$1/conf/system.properties +TEMPLATE_CONFIG_FILE=$1/conf/system_template.properties echo "Localizing the VID system configuration" diff --git a/deliveries/src/main/scripts/localize_war.sh b/deliveries/src/main/scripts/localize_war.sh index f0669e0e6..99cb177ed 100755 --- a/deliveries/src/main/scripts/localize_war.sh +++ b/deliveries/src/main/scripts/localize_war.sh @@ -1,31 +1,31 @@ #!/bin/bash -source /tmp/vid/localize_logback.sh || { +source /tmp/vid/localize_logback.sh $1 || { echo "ERROR: Localizing logback.xml failed" exit 1 } -source /tmp/vid/localize_portal.sh || { +source /tmp/vid/localize_portal.sh $1 || { echo "ERROR: Localizing portal.properties failed" exit 1 } -source /tmp/vid/localize_quartz.sh || { +source /tmp/vid/localize_quartz.sh $1 || { echo "ERROR: Localizing quartz.properties failed" exit 1 } -source /tmp/vid/localize_system.sh || { +source /tmp/vid/localize_system.sh $1 || { echo "ERROR: Localizing system.properties failed" exit 1 } -source /tmp/vid/localize_cache.sh || { +source /tmp/vid/localize_cache.sh $1 || { echo "ERROR: Localizing cache.ccf failed" exit 1 } -source /tmp/vid/localize_asdc.sh || { +source /tmp/vid/localize_asdc.sh $1 || { echo "ERROR: Localizing asdc.properties failed" exit 1 } -- cgit 1.2.3-korg