diff --git a/assembly/bin/supersonic-build.sh b/assembly/bin/supersonic-build.sh index 6a11b2165..3f0fc75e9 100644 --- a/assembly/bin/supersonic-build.sh +++ b/assembly/bin/supersonic-build.sh @@ -5,7 +5,7 @@ pip_path="/usr/local/bin/pip3" sbinDir=$(cd "$(dirname "$0")"; pwd) baseDir=$(cd "$sbinDir/.." && pwd -P) -runtimeDir=$baseDir/runtime +runtimeDir=$baseDir/../runtime buildDir=$baseDir/build cd $baseDir @@ -31,9 +31,40 @@ cp -fr ./supersonic-webapp.tar.gz ${buildDir}/ cd $buildDir tar xvf supersonic-webapp.tar.gz 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 requirementPath=$baseDir/../chat/core/src/main/python/requirements.txt ${pip_path} install -r ${requirementPath} -echo "install python modules success" \ No newline at end of file +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 \ No newline at end of file diff --git a/assembly/bin/supersonic-daemon.sh b/assembly/bin/supersonic-daemon.sh index 1e5333b9a..49dfa53bd 100644 --- a/assembly/bin/supersonic-daemon.sh +++ b/assembly/bin/supersonic-daemon.sh @@ -50,35 +50,7 @@ function setAppName { 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 -resetEnvironment -setEnvToWeb setMainClass function runJavaService {