Improve localize scripts 41/67641/1
authorkurczews <krzysztof.kurczewski@nokia.com>
Wed, 19 Sep 2018 06:17:52 +0000 (08:17 +0200)
committerkurczews <krzysztof.kurczewski@nokia.com>
Wed, 19 Sep 2018 08:06:18 +0000 (10:06 +0200)
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 <krzysztof.kurczewski@nokia.com>
deliveries/src/main/scripts/localize.sh
deliveries/src/main/scripts/localize_asdc.sh
deliveries/src/main/scripts/localize_cache.sh
deliveries/src/main/scripts/localize_log4j.sh
deliveries/src/main/scripts/localize_logback.sh
deliveries/src/main/scripts/localize_portal.sh
deliveries/src/main/scripts/localize_quartz.sh
deliveries/src/main/scripts/localize_system.sh
deliveries/src/main/scripts/localize_war.sh

index 3966f70..aca557f 100755 (executable)
@@ -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
index 549c17a..af48318 100755 (executable)
@@ -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"
 
index d25949c..2d676c3 100755 (executable)
@@ -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"
 
index d2ab2bb..121f567 100755 (executable)
@@ -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"
 
index 43798eb..a0f1773 100755 (executable)
@@ -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"
 
index f29d485..947e0e1 100755 (executable)
@@ -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"
 
index c284e6c..c22d879 100755 (executable)
@@ -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"
 
index a739335..0947d49 100755 (executable)
@@ -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"
 
index f0669e0..99cb177 100755 (executable)
@@ -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
 }