add deploy class

This commit is contained in:
东煌 2020-08-20 13:11:07 +08:00
parent e8ec69dd24
commit 7c1f07c50a
2 changed files with 94 additions and 5 deletions

View File

@ -19,8 +19,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* @author bingpo
* @date 2020/3/30 下午3:27
* @author Donghuang
* @date Aug 20, 2020 11:25:04
*/
@Controller
@ListApi(searchCols = {
@ -71,9 +71,12 @@ public class CallDetailRecordController
final CallDetailRecord record = vm.getData();
if (record.getAnswerStamp() != null) {
final CallRecording recording = callRecordingMapper.find(
new Search(CallRecording.CONN_ID, vm.getData().getConnId()));
recording.setUrl(fileServerBasePath + recording.getPath());
vm.setAttr("recording", recording);
new Search(CallRecording.CONN_ID,
vm.getData().getConnId()));
if (recording != null) {
recording.setUrl(fileServerBasePath + recording.getPath());
vm.attr("recording", recording);
}
}
});
}

86
deploy_classes.sh Executable file
View File

@ -0,0 +1,86 @@
#!/bin/bash
# get real path of softlink
get_real_path() {
local f="$1"
while [ -h "$f" ]; do
ls=`ls -ld "$f"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
f="$link"
else
f=`dirname "$f"`/"$link"
fi
done
echo "$f"
}
deploy_server() {
local server="$1"
local app="$2"
local jar="$3"
local port="$4"
if [ -z "$port" ]; then
port='22'
fi
local target_dir="/data/program/$app"
local target_lib_dir="$target_dir/lib"
local target_jar="$target_lib_dir/main.jar"
local classes_jar="$target_lib_dir/main-clasess.jar"
scp -P $port $jar $server:"$classes_jar"
ssh -p $port $server "
$target_dir/bin/stop.sh;
cd $target_lib_dir &&
unzip $classes_jar &&
zip -d $target_jar BOOT-INF/classes/* &&
zip -ur $target_jar BOOT-INF/classes &&
rm -rf BOOT-INF $classes_jar &&
$target_dir/bin/start.sh"
}
prg_path=$(get_real_path "$0")
echo "Script path [$prg_path]"
# Service Home
pushd $(dirname "$prg_path") > /dev/null
WORK_DIR=$(pwd)
echo "Work dir [$WORK_DIR]"
if [ -z "$1" ] && [ -z "$2" ]; then
echo 'Usage: ./deploy_classes.sh cms|fsagent|openapi test|prod [nb]'
exit 1
fi
APP=$1
if [ ! -d "$APP" ]; then
echo "App [$APP] is not valid maven module."
exit 1
fi
if [ ! "$3" == "nb" ]; then
mvn -T 4C clean package -pl $APP -am -DskipTests
fi
TARGET_DIR=$APP/target
echo "Target dir [$TARGET_DIR]"
JAR=$(find "$TARGET_DIR" -maxdepth 1 -type f -name '*.jar' | grep -v 'sources.jar')
echo "JAR [$JAR] found"
zip -d $JAR \
BOOT-INF/lib/* \
META-INF/* \
org/*
if [ "$2" == "test" ]; then
echo "Deploy test."
deploy_server 'xiadou@118.24.251.131' $APP $JAR
elif [ "$2" == "prod" ]; then
echo "Deploy prod."
deploy_server 'xiandou@localhost' $APP $JAR 4025
fi
popd > /dev/null