summaryrefslogtreecommitdiffstats
path: root/deliveries
diff options
context:
space:
mode:
Diffstat (limited to 'deliveries')
-rwxr-xr-xdeliveries/src/main/docker/docker-files/Dockerfile7
-rwxr-xr-xdeliveries/src/main/scripts/localize.sh31
-rwxr-xr-xdeliveries/src/main/scripts/localize_asdc.sh17
-rwxr-xr-xdeliveries/src/main/scripts/localize_cache.sh15
-rwxr-xr-xdeliveries/src/main/scripts/localize_log4j.sh19
-rwxr-xr-xdeliveries/src/main/scripts/localize_portal.sh23
-rwxr-xr-xdeliveries/src/main/scripts/localize_quartz.sh20
-rwxr-xr-xdeliveries/src/main/scripts/localize_system.sh43
-rwxr-xr-xdeliveries/src/main/scripts/localize_war.sh26
-rwxr-xr-xdeliveries/src/main/scripts/start.sh9
10 files changed, 196 insertions, 14 deletions
diff --git a/deliveries/src/main/docker/docker-files/Dockerfile b/deliveries/src/main/docker/docker-files/Dockerfile
index 192fcd236..1d95efa20 100755
--- a/deliveries/src/main/docker/docker-files/Dockerfile
+++ b/deliveries/src/main/docker/docker-files/Dockerfile
@@ -24,9 +24,6 @@ RUN groupadd -r $group && useradd -ms /bin/bash $user -g $group && \
mkdir /var/log/$user && \
chown -R $user:$group /var/log/$user
-#install procps
-RUN apt-get update && apt-get install -y procps
-
# Kubernetes variables
# set to TRUE (in capital) if on Kubernetes
ENV ON_KUBERNETES="FALSE"
@@ -115,6 +112,6 @@ RUN chown $user:$group /tmp/vid /usr/local/tomcat -R
COPY --chown=$user:$group --from=build /vid /usr/local/tomcat/webapps/vid/
-RUN chmod +x /tmp/vid/start.sh
+RUN chmod +x /tmp/vid/localize.sh
USER $user
-CMD ["/tmp/vid/start.sh"]
+CMD ["/tmp/vid/localize.sh"]
diff --git a/deliveries/src/main/scripts/localize.sh b/deliveries/src/main/scripts/localize.sh
new file mode 100755
index 000000000..e4b8c220d
--- /dev/null
+++ b/deliveries/src/main/scripts/localize.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+fillTemplateProperties() {
+ source /tmp/vid/localize_war.sh $1 || {
+ echo "ERROR: Localization script failed"
+ exit 2
+ }
+}
+
+createWritableLogbackConfig() {
+ # Create logback.xml in /tmp/vid/
+ # /tmp/logback.xml is owned by root and unmodifiable
+ cp -f /tmp/logback.xml /tmp/vid/logback.xml
+}
+
+if [ "${ON_KUBERNETES}" = "TRUE" ]
+then
+ echo "We're running on Kubernetes, preconfiguration is already handled"
+else
+ createWritableLogbackConfig
+ TEMPLATES_BASE_DIR=/usr/local/tomcat/webapps/vid/WEB-INF
+ fillTemplateProperties ${TEMPLATES_BASE_DIR}
+fi
+
+# Set CATALINA_OPTS if not defined previously
+# Enables late-evaluation of env variables, such as VID_KEYSTORE_PASSWORD
+: "${CATALINA_OPTS:=-Dvid.keystore.password=${VID_KEYSTORE_PASSWORD} -Dvid.keyalias=vid@vid.onap.org -Dvid.keystore.filename=${VID_KEYSTORE_FILENAME} -Dcom.att.eelf.logging.file=logback.xml -Dcom.att.eelf.logging.path=/tmp/vid/}"
+echo "CATALINA_OPTS: ${CATALINA_OPTS}"
+export CATALINA_OPTS
+
+catalina.sh run
diff --git a/deliveries/src/main/scripts/localize_asdc.sh b/deliveries/src/main/scripts/localize_asdc.sh
new file mode 100755
index 000000000..af483186f
--- /dev/null
+++ b/deliveries/src/main/scripts/localize_asdc.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+FINAL_CONFIG_FILE=$1/conf/asdc.properties
+TEMPLATE_CONFIG_FILE=$1/conf/asdc_template.properties
+
+echo "Localizing the ASDC client configuration"
+
+sed -e 's ${ASDC_CLIENT_TYPE} '${ASDC_CLIENT_TYPE}' g' \
+ -e 's ${ASDC_CLIENT_REST_HOST} '${ASDC_CLIENT_REST_HOST}' g' \
+ -e 's ${ASDC_CLIENT_REST_PORT} '${ASDC_CLIENT_REST_PORT}' g' \
+ -e 's ${ASDC_CLIENT_REST_PROTOCOL} '${ASDC_CLIENT_REST_PROTOCOL}' g' \
+ -e 's/${ASDC_CLIENT_REST_AUTH}/'"${ASDC_CLIENT_REST_AUTH}"'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || {
+ echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}"
+ exit 4
+ }
+
+echo "Localized ${FINAL_CONFIG_FILE} successfully."
diff --git a/deliveries/src/main/scripts/localize_cache.sh b/deliveries/src/main/scripts/localize_cache.sh
new file mode 100755
index 000000000..2d676c373
--- /dev/null
+++ b/deliveries/src/main/scripts/localize_cache.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+FINAL_CONFIG_FILE=$1/classes/cache.ccf
+TEMPLATE_CONFIG_FILE=$1/classes/cache_template.ccf
+
+echo "Localizing the VID cache configuration"
+
+mkdir -p "${CACHE_DIRECTORY}"
+
+sed -e 's,${CACHE_DIRECTORY},'${CACHE_DIRECTORY}',g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || {
+ echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}"
+ exit 3
+ }
+
+echo "Localized ${FINAL_CONFIG_FILE} successfully."
diff --git a/deliveries/src/main/scripts/localize_log4j.sh b/deliveries/src/main/scripts/localize_log4j.sh
new file mode 100755
index 000000000..121f5673a
--- /dev/null
+++ b/deliveries/src/main/scripts/localize_log4j.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+FINAL_CONFIG_FILE=$1/conf/log4j.properties
+TEMPLATE_CONFIG_FILE=$1/conf/log4j_template.properties
+
+echo "Localizing the VID log4j configuration"
+
+mkdir -p ${LOG4J_LOGS_DIRECTORY}
+
+sed -e 's/${LOG4J_LOGLEVEL}/'${LOG4J_LOGLEVEL}'/g' \
+ -e 's/${LOG4J_APPENDER}/'${LOG4J_APPENDER}'/g' \
+ -e 's,${LOG4J_LOGS_DIRECTORY},'${LOG4J_LOGS_DIRECTORY}',g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || {
+ echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}"
+ exit 3
+ }
+
+echo "Localized ${FINAL_CONFIG_FILE} successfully."
+
+
diff --git a/deliveries/src/main/scripts/localize_portal.sh b/deliveries/src/main/scripts/localize_portal.sh
new file mode 100755
index 000000000..947e0e1d0
--- /dev/null
+++ b/deliveries/src/main/scripts/localize_portal.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+FINAL_CONFIG_FILE=$1/classes/portal.properties
+TEMPLATE_CONFIG_FILE=$1/classes/portal_template.properties
+
+echo "Localizing the VID portal configuration"
+
+sed -e 's ${VID_WJ_LOGOUT_URL} '${VID_WJ_LOGOUT_URL}' g' \
+ -e 's ${VID_ECOMP_REDIRECT_URL} '${VID_ECOMP_REDIRECT_URL}' g' \
+ -e 's ${VID_ECOMP_REST_URL} '${VID_ECOMP_REST_URL}' g' \
+ -e 's ${VID_UEB_URL_LIST} '${VID_UEB_URL_LIST}' g' \
+ -e 's ${VID_ECOMP_PORTAL_INBOX_NAME} '${VID_ECOMP_PORTAL_INBOX_NAME}' g' \
+ -e 's ${VID_DECRYPTION_KEY} '${VID_DECRYPTION_KEY}' g' \
+ -e 's ${VID_UEB_APP_KEY} '${VID_UEB_APP_KEY}' g' \
+ -e 's ${VID_UEB_APP_SECRET} '${VID_UEB_APP_SECRET}' g' \
+ -e 's ${VID_UEB_APP_MAILBOX_NAME} '${VID_UEB_APP_MAILBOX_NAME}' g' \
+ -e 's ${VID_UEB_LISTENERS_ENABLE} '${VID_UEB_LISTENERS_ENABLE}' g' \
+ -e 's/${VID_UEB_CONSUMER_GROUP}/'${VID_UEB_CONSUMER_GROUP}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || {
+ echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}"
+ exit 4
+ }
+
+echo "Localized ${FINAL_CONFIG_FILE} successfully."
diff --git a/deliveries/src/main/scripts/localize_quartz.sh b/deliveries/src/main/scripts/localize_quartz.sh
new file mode 100755
index 000000000..e2b3a0adc
--- /dev/null
+++ b/deliveries/src/main/scripts/localize_quartz.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+FINAL_CONFIG_FILE=$1/conf/quartz.properties
+TEMPLATE_CONFIG_FILE=$1/conf/quartz_template.properties
+
+echo "Localizing the VID quartz configuration"
+
+sed -e 's/${VID_MYSQL_HOST}/'${VID_MYSQL_HOST}'/g' \
+ -e 's/${VID_MYSQL_PORT}/'${VID_MYSQL_PORT}'/g' \
+ -e 's/${VID_MYSQL_DBNAME}/'${VID_MYSQL_DBNAME}'/g' \
+ -e 's/${VID_MYSQL_USER}/'${VID_MYSQL_USER}'/g' \
+ -e 's/${VID_MYSQL_PASS}/'"$(printf '%q' "${VID_MYSQL_PASS}")"'/g' \
+ -e 's/${VID_MYSQL_MAXCONNECTIONS}/'${VID_MYSQL_MAXCONNECTIONS}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || {
+ echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}"
+ exit 4
+ }
+
+echo "Localized ${FINAL_CONFIG_FILE} successfully."
+
+
diff --git a/deliveries/src/main/scripts/localize_system.sh b/deliveries/src/main/scripts/localize_system.sh
new file mode 100755
index 000000000..5061a02b3
--- /dev/null
+++ b/deliveries/src/main/scripts/localize_system.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+FINAL_CONFIG_FILE=$1/conf/system.properties
+TEMPLATE_CONFIG_FILE=$1/conf/system_template.properties
+
+echo "Localizing the VID system configuration"
+
+mkdir -p "${VID_MYLOGIN_FEED_DIRECTORY}"
+
+
+sed -e 's/${VID_MYSQL_HOST}/'${VID_MYSQL_HOST}'/g' \
+ -e 's/${VID_MYSQL_PORT}/'${VID_MYSQL_PORT}'/g' \
+ -e 's/${VID_MYSQL_DBNAME}/'${VID_MYSQL_DBNAME}'/g' \
+ -e 's/${VID_MYSQL_USER}/'${VID_MYSQL_USER}'/g' \
+ -e 's/${VID_MYSQL_PASS}/'"$(printf '%q' "${VID_MYSQL_PASS}")"'/g' \
+ -e 's ${VID_AAI_URL} '${VID_AAI_URL}' g' \
+ -e 's/${AAI_USE_CLIENT_CERT}/'${AAI_USE_CLIENT_CERT}'/g' \
+ -e 's/${AAI_VID_UID}/'${AAI_VID_UID}'/g' \
+ -e 's/${AAI_VID_PASSWD_X}/'${AAI_VID_PASSWD_X}'/g' \
+ -e 's,${AAI_TRUSTSTORE_FILENAME},'${AAI_TRUSTSTORE_FILENAME}',g' \
+ -e 's/${AAI_TRUSTSTORE_PASSWD_X}/'${AAI_TRUSTSTORE_PASSWD_X}'/g' \
+ -e 's,${AAI_KEYSTORE_FILENAME},'${AAI_KEYSTORE_FILENAME}',g' \
+ -e 's/${AAI_KEYSTORE_PASSWD_X}/'${AAI_KEYSTORE_PASSWD_X}'/g' \
+ -e 's/${VID_APP_DISPLAY_NAME}/'${VID_APP_DISPLAY_NAME}'/g' \
+ -e 's ${VID_ECOMP_SHARED_CONTEXT_REST_URL} '${VID_ECOMP_SHARED_CONTEXT_REST_URL}' g' \
+ -e 's ${VID_ECOMP_REDIRECT_URL} '${VID_ECOMP_REDIRECT_URL}' g' \
+ -e 's ${VID_ECOMP_REST_URL} '${VID_ECOMP_REST_URL}' g' \
+ -e 's ${VID_MSO_SERVER_URL} '${VID_MSO_SERVER_URL}' g' \
+ -e 's/${VID_MSO_USER}/'${VID_MSO_USER}'/g' \
+ -e 's/${VID_MSO_PASS}/'${VID_MSO_PASS}'/g' \
+ -e 's,${VID_MYLOGIN_FEED_DIRECTORY},'${VID_MYLOGIN_FEED_DIRECTORY}',g' \
+ -e 's,${MSO_DME2_CLIENT_TIMEOUT},'${MSO_DME2_CLIENT_TIMEOUT}',g' \
+ -e 's,${MSO_DME2_CLIENT_READ_TIMEOUT},'${MSO_DME2_CLIENT_READ_TIMEOUT}',g' \
+ -e 's,${MSO_DME2_SERVER_URL},'${MSO_DME2_SERVER_URL}',g' \
+ -e 's,${MSO_DME2_ENABLED},'${MSO_DME2_ENABLED}',g' \
+ -e 's,${MSO_POLLING_INTERVAL_MSECS},'${MSO_POLLING_INTERVAL_MSECS}',g' \
+ -e 's,${VID_TRUSTSTORE_FILE},'${VID_TRUSTSTORE_FILENAME}',g' \
+ -e 's/${VID_TRUSTSTORE_PASS}/'${VID_TRUSTSTORE_PASSWORD}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || {
+ echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}"
+ exit 4
+ }
+
+echo "Localized ${FINAL_CONFIG_FILE} successfully."
diff --git a/deliveries/src/main/scripts/localize_war.sh b/deliveries/src/main/scripts/localize_war.sh
new file mode 100755
index 000000000..29cdc5137
--- /dev/null
+++ b/deliveries/src/main/scripts/localize_war.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+source /tmp/vid/localize_portal.sh $1 || {
+ echo "ERROR: Localizing portal.properties failed"
+ exit 1
+}
+
+source /tmp/vid/localize_quartz.sh $1 || {
+ echo "ERROR: Localizing quartz.properties failed"
+ exit 1
+}
+
+source /tmp/vid/localize_system.sh $1 || {
+ echo "ERROR: Localizing system.properties failed"
+ exit 1
+}
+
+source /tmp/vid/localize_cache.sh $1 || {
+ echo "ERROR: Localizing cache.ccf failed"
+ exit 1
+}
+
+source /tmp/vid/localize_asdc.sh $1 || {
+ echo "ERROR: Localizing asdc.properties failed"
+ exit 1
+}
diff --git a/deliveries/src/main/scripts/start.sh b/deliveries/src/main/scripts/start.sh
deleted file mode 100755
index 6c76ce3ca..000000000
--- a/deliveries/src/main/scripts/start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-# Set CATALINA_OPTS if not defined previously
-# Enables late-evaluation of env variables, such as VID_KEYSTORE_PASSWORD
-: "${CATALINA_OPTS:=-Dvid.keystore.password=${VID_KEYSTORE_PASSWORD} -Dvid.keyalias=vid@vid.onap.org -Dvid.keystore.filename=${VID_KEYSTORE_FILENAME} -Dcom.att.eelf.logging.file=logback.xml -Dcom.att.eelf.logging.path=/tmp/vid/}"
-echo "CATALINA_OPTS: ${CATALINA_OPTS}"
-export CATALINA_OPTS
-
-catalina.sh run