From 433ad1d5619fa4803b6b08b44cc9b5d175422d9f Mon Sep 17 00:00:00 2001 From: Orestis Tsakiridis Date: Fri, 14 Jul 2017 14:06:33 +0300 Subject: [PATCH 1/3] Deploy/undeploy bundled RVD through configuration - RVD will get either deployed or undeployed based on the value of advanced.conf/RVD_URL Refers #2350 --- .../as7-config-scripts/restcomm/advanced.conf | 2 +- .../restcomm/autoconfig.d/config-restcomm.sh | 57 +++++++++++++------ 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/restcomm/configuration/config-scripts/as7-config-scripts/restcomm/advanced.conf b/restcomm/configuration/config-scripts/as7-config-scripts/restcomm/advanced.conf index 70190f78f8..31fb1e0d4d 100644 --- a/restcomm/configuration/config-scripts/as7-config-scripts/restcomm/advanced.conf +++ b/restcomm/configuration/config-scripts/as7-config-scripts/restcomm/advanced.conf @@ -93,7 +93,7 @@ LBHOST='' #Obligatory to set if Load Balancer is used for PSTN (DID provider con #RVD workspace path. (If not set default will be used). #Default: leave empty. RVD_LOCATION='' -RVD_URL='' # override if RVD is not under the same domain with restcomm. Use a base url like http://myrvd.restcomm.com . No path included. +RVD_URL='' # override if RVD is not under the same domain with restcomm. Use a base url like http://myrvd.restcomm.com . No path included. Also, if provided, bundled RVD will get undeployed. RVD_VIDEO_SUPPORT='false' # Toggle RVD Video RCML generation and UI RVD_MAX_MEDIA_FILE_SIZE=4194304 # Limit media file size when uploading. For video should probably be greater diff --git a/restcomm/configuration/config-scripts/as7-config-scripts/restcomm/autoconfig.d/config-restcomm.sh b/restcomm/configuration/config-scripts/as7-config-scripts/restcomm/autoconfig.d/config-restcomm.sh index 680edbbfe2..2382f2cf7f 100755 --- a/restcomm/configuration/config-scripts/as7-config-scripts/restcomm/autoconfig.d/config-restcomm.sh +++ b/restcomm/configuration/config-scripts/as7-config-scripts/restcomm/autoconfig.d/config-restcomm.sh @@ -540,26 +540,51 @@ otherRestCommConf(){ echo "End Rest RestComm configuration" } -confRVD(){ - echo "Configure RVD" - if [ -n "$RVD_LOCATION" ]; then - echo "RVD_LOCATION $RVD_LOCATION" - mkdir -p `echo $RVD_LOCATION` - sed -i "s|.*|${RVD_LOCATION}|" $RVD_DEPLOY/WEB-INF/rvd.xml - - COPYFLAG=$RVD_LOCATION/.demos_initialized - if [ -f "$COPYFLAG" ]; then - #Do nothing, we already copied the demo file to the new workspace - echo "RVD demo application are already copied" - else - echo "Will copy RVD demo applications to the new workspace $RVD_LOCATION" - cp -ar $RVD_DEPLOY/workspace/* $RVD_LOCATION - touch $COPYFLAG - fi +disableRVD() { + echo "disabling bundled RVD..." + if [ -f "$RVD_DEPLOY.deployed" ]; then + rm "$RVD_DEPLOY.deployed" + echo "RVD un-deployed" + else + echo "RVD already not deployed" + fi +} +enableRVD() { + echo "enabling bundled RVD..." + if [ -f "$RVD_DEPLOY.deployed" ]; then + echo "RVD already deployed" + else + touch "$RVD_DEPLOY".dodeploy + echo "RVD enabled/deployed" fi } +confRVD(){ + if [ -z "$RVD_URL" ]; then + enableRVD + echo "Configure bundled RVD" + if [ -n "$RVD_LOCATION" ]; then + echo "RVD_LOCATION $RVD_LOCATION" + mkdir -p `echo $RVD_LOCATION` + sed -i "s|.*|${RVD_LOCATION}|" $RVD_DEPLOY/WEB-INF/rvd.xml + + COPYFLAG=$RVD_LOCATION/.demos_initialized + if [ -f "$COPYFLAG" ]; then + #Do nothing, we already copied the demo file to the new workspace + echo "RVD demo application are already copied" + else + echo "Will copy RVD demo applications to the new workspace $RVD_LOCATION" + cp -ar $RVD_DEPLOY/workspace/* $RVD_LOCATION + touch $COPYFLAG + fi + + fi + else + disableRVD + fi +} + ## Adds/removes / element based on $RVD_URL ## This version of confRcmlserver() will used xmlstarlet and will probably sed commands that rely on empty elements like instead of #confRcmlserver(){ From dbe273a37159f091e933dbdb7fa7c2217bca8c29 Mon Sep 17 00:00:00 2001 From: George Vagenas Date: Fri, 14 Jul 2017 16:38:43 +0300 Subject: [PATCH 2/3] Simulate long operation of FileUtils.waitFor putting the thread to sleep for 6000 ms This refer to #2346 --- .../org/restcomm/connect/commons/amazonS3/S3AccessTool.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/amazonS3/S3AccessTool.java b/restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/amazonS3/S3AccessTool.java index db07a3aa5e..6b8b407273 100644 --- a/restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/amazonS3/S3AccessTool.java +++ b/restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/amazonS3/S3AccessTool.java @@ -125,7 +125,7 @@ public URI uploadFile(final String fileToUpload) { if (logger.isInfoEnabled()) { logger.info("Will thread sleep for 1 minute simulating the long operation of FileUtils.waitFor"); } - Thread.sleep(60000); + Thread.sleep(6000); } catch (Exception e) { logger.error("Exception while sleepig simulating the long operation waiting for the file"); From 18b60e7ecf5b32defa49e650d00c69f26795d80a Mon Sep 17 00:00:00 2001 From: Orestis Tsakiridis Date: Thu, 27 Jul 2017 10:05:14 +0300 Subject: [PATCH 3/3] RVD undeployed by config at *first* restcomm start Improvements in the log messages of config-restcomm.sh too Refers #2350 --- .../restcomm/autoconfig.d/config-restcomm.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/restcomm/configuration/config-scripts/as7-config-scripts/restcomm/autoconfig.d/config-restcomm.sh b/restcomm/configuration/config-scripts/as7-config-scripts/restcomm/autoconfig.d/config-restcomm.sh index 2382f2cf7f..5201a64ad8 100755 --- a/restcomm/configuration/config-scripts/as7-config-scripts/restcomm/autoconfig.d/config-restcomm.sh +++ b/restcomm/configuration/config-scripts/as7-config-scripts/restcomm/autoconfig.d/config-restcomm.sh @@ -541,22 +541,21 @@ otherRestCommConf(){ } disableRVD() { - echo "disabling bundled RVD..." - if [ -f "$RVD_DEPLOY.deployed" ]; then - rm "$RVD_DEPLOY.deployed" - echo "RVD un-deployed" + if [[ -f "$RVD_DEPLOY.deployed" || -f "$RVD_DEPLOY.dodeploy" ]]; then + rm -f "$RVD_DEPLOY.deployed" + rm -f "$RVD_DEPLOY.dodeploy" + echo "RVD undeployed (or not deployed at all)" else - echo "RVD already not deployed" + echo "RVD not deployed" fi } enableRVD() { - echo "enabling bundled RVD..." if [ -f "$RVD_DEPLOY.deployed" ]; then echo "RVD already deployed" else touch "$RVD_DEPLOY".dodeploy - echo "RVD enabled/deployed" + echo "RVD deployed" fi }