mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 20:25:12 +00:00
(improvement)(project) support move webapp to chat/semantic/standalone class and copy to runtime in build (#93)
This commit is contained in:
@@ -5,7 +5,7 @@ pip_path="/usr/local/bin/pip3"
|
|||||||
|
|
||||||
sbinDir=$(cd "$(dirname "$0")"; pwd)
|
sbinDir=$(cd "$(dirname "$0")"; pwd)
|
||||||
baseDir=$(cd "$sbinDir/.." && pwd -P)
|
baseDir=$(cd "$sbinDir/.." && pwd -P)
|
||||||
runtimeDir=$baseDir/runtime
|
runtimeDir=$baseDir/../runtime
|
||||||
buildDir=$baseDir/build
|
buildDir=$baseDir/build
|
||||||
|
|
||||||
cd $baseDir
|
cd $baseDir
|
||||||
@@ -31,9 +31,40 @@ cp -fr ./supersonic-webapp.tar.gz ${buildDir}/
|
|||||||
cd $buildDir
|
cd $buildDir
|
||||||
tar xvf supersonic-webapp.tar.gz
|
tar xvf supersonic-webapp.tar.gz
|
||||||
mv supersonic-webapp webapp
|
mv supersonic-webapp webapp
|
||||||
mv webapp ../../launchers/standalone/target/classes
|
cp -fr webapp ../../launchers/semantic/target/classes
|
||||||
|
cp -fr webapp ../../launchers/chat/target/classes
|
||||||
|
cp -fr webapp ../../launchers/standalone/target/classes
|
||||||
|
|
||||||
#5. build backend python modules
|
#5. build backend python modules
|
||||||
requirementPath=$baseDir/../chat/core/src/main/python/requirements.txt
|
requirementPath=$baseDir/../chat/core/src/main/python/requirements.txt
|
||||||
${pip_path} install -r ${requirementPath}
|
${pip_path} install -r ${requirementPath}
|
||||||
echo "install python modules success"
|
echo "install python modules success"
|
||||||
|
|
||||||
|
#6. reset runtime
|
||||||
|
function setEnvToWeb {
|
||||||
|
model_name=$1
|
||||||
|
json='{"env": "'$model_name'"}'
|
||||||
|
echo $json > ${runtimeDir}/supersonic-${model_name}/webapp/supersonic.config.json
|
||||||
|
echo $json > ../../launchers/${model_name}/target/classes/webapp/supersonic.config.json
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveToRuntime {
|
||||||
|
model_name=$1
|
||||||
|
tar -zxvf ${buildDir}/supersonic-${model_name}.tar.gz -C ${runtimeDir}
|
||||||
|
mv ${runtimeDir}/launchers-${model_name}-* ${runtimeDir}/supersonic-${model_name}
|
||||||
|
|
||||||
|
mkdir -p ${runtimeDir}/supersonic-${model_name}/webapp
|
||||||
|
cp -fr ${buildDir}/webapp/* ${runtimeDir}/supersonic-${model_name}/webapp
|
||||||
|
}
|
||||||
|
|
||||||
|
mkdir -p ${runtimeDir}
|
||||||
|
rm -fr $runtimeDir/*
|
||||||
|
|
||||||
|
moveToRuntime chat
|
||||||
|
moveToRuntime semantic
|
||||||
|
moveToRuntime standalone
|
||||||
|
|
||||||
|
setEnvToWeb chat
|
||||||
|
setEnvToWeb semantic
|
||||||
|
|
||||||
|
rm -fr ${buildDir}/webapp
|
||||||
@@ -50,35 +50,7 @@ function setAppName {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function setEnvToWeb {
|
|
||||||
if [[ "$service" == $CHAT_SERVICE || "$service" == $SEMANTIC_SERVICE ]]; then
|
|
||||||
json='{"env": "'$service'"}'
|
|
||||||
echo $json > ${runtimeDir}/supersonic-${model_name}/webapp/supersonic.config.json
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetEnvironment {
|
|
||||||
if [[ ${app_name} == $LLMPARSER_APP_NAME ]]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if [[ "$command" == "start" || "$command" == "restart" ]]; then
|
|
||||||
#1. clear file
|
|
||||||
mkdir -p ${runtimeDir}
|
|
||||||
rm -fr ${runtimeDir}/supersonic-${model_name}
|
|
||||||
#2. package lib
|
|
||||||
tar -zxvf ${buildDir}/supersonic-${model_name}.tar.gz -C ${runtimeDir}
|
|
||||||
mv ${runtimeDir}/launchers-${model_name}-* ${runtimeDir}/supersonic-${model_name}
|
|
||||||
|
|
||||||
tar -zxvf ${buildDir}/supersonic-webapp.tar.gz -C ${buildDir}
|
|
||||||
mkdir -p ${runtimeDir}/supersonic-${model_name}/webapp
|
|
||||||
cp -fr ${buildDir}/supersonic-webapp/* ${runtimeDir}/supersonic-${model_name}/webapp
|
|
||||||
rm -fr ${buildDir}/supersonic-webapp
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
setAppName
|
setAppName
|
||||||
resetEnvironment
|
|
||||||
setEnvToWeb
|
|
||||||
setMainClass
|
setMainClass
|
||||||
|
|
||||||
function runJavaService {
|
function runJavaService {
|
||||||
|
|||||||
Reference in New Issue
Block a user