Brought Linux Script to Parity with Windows Script

This commit is contained in:
2025-04-30 00:22:08 -06:00
parent 3f753a2bde
commit e417d21698

View File

@ -1,13 +1,6 @@
#////////// PROJECT FILE SEPARATION LINE ////////// CODE AFTER THIS LINE ARE FROM: <ProjectRoot>/Launch-Borealis.sh #////////// PROJECT FILE SEPARATION LINE ////////// CODE AFTER THIS LINE ARE FROM: <ProjectRoot>/Launch-Borealis.sh
#!/usr/bin/env bash #!/usr/bin/env bash
# --------------------------------------------------------------------
# Deploy Borealis - Workflow Automation Tool
#
# Menu-driven launcher for:
# [1] Borealis Web Dashboard (Server)
# [2] Borealis Client Agent (Agent)
# --------------------------------------------------------------------
GREEN="\033[0;32m" GREEN="\033[0;32m"
YELLOW="\033[1;33m" YELLOW="\033[1;33m"
@ -60,17 +53,18 @@ install_core_dependencies() {
} }
launch_server() { launch_server() {
echo -e "${GREEN}Deploying Borealis - Workflow Automation Tool...${RESET}" echo -e "${GREEN}Deploying Borealis - Server Dashboard...${RESET}"
echo "====================================================================================" echo "===================================================================================="
detect_distro detect_distro
run_step "Install System Dependencies" install_core_dependencies run_step "Install System Dependencies" install_core_dependencies
venvFolder="Borealis-Workflow-Automation-Tool" venvFolder="Server"
dataSource="Data" dataSource="Data/Server"
dataDestination="${venvFolder}/Borealis" dataDestination="${venvFolder}/Borealis"
customUIPath="${dataSource}/WebUI" customUIPath="${dataSource}/WebUI"
webUIDestination="${venvFolder}/web-interface" webUIDestination="${venvFolder}/web-interface"
venvPython="${venvFolder}/bin/python3"
run_step "Create Virtual Python Environment" bash -c " run_step "Create Virtual Python Environment" bash -c "
if [ ! -f '${venvFolder}/bin/activate' ]; then if [ ! -f '${venvFolder}/bin/activate' ]; then
@ -78,77 +72,49 @@ launch_server() {
fi fi
" "
run_step "Copy Borealis Server Data into Virtual Python Environment" bash -c " run_step "Copy Python Server Components" bash -c "
if [ -d \"$dataSource\" ]; then rm -rf '${dataDestination}' && mkdir -p '${dataDestination}'
rm -rf \"$dataDestination\" cp -r '${dataSource}/Python_API_Endpoints' '${dataDestination}/'
mkdir -p \"$dataDestination\" cp -r '${dataSource}/Sounds' '${dataDestination}/'
cp -r \"$dataSource/\"* \"$dataDestination\" cp -r '${dataSource}/Workflows' '${dataDestination}/'
else cp '${dataSource}/server.py' '${dataDestination}/'
echo -e \"\r${INFO} Warning: Data folder not found, skipping copy.${RESET}\"
fi
true
" "
run_step "Create a new ReactJS App in ${webUIDestination}" bash -c " run_step "Create ReactJS App if Missing" bash -c "
if [ ! -d \"$webUIDestination\" ]; then if [ ! -d '${webUIDestination}' ]; then
CI=true npx create-react-app \"$webUIDestination\" --silent --use-npm --loglevel=error npx create-react-app '${webUIDestination}' --use-npm --silent
fi fi
" "
run_step "Overwrite React App with Custom Files" bash -c " run_step "Overwrite WebUI with Custom Files" bash -c "
if [ -d \"$customUIPath\" ]; then if [ -d '${customUIPath}' ]; then
cp -r \"$customUIPath/\"* \"$webUIDestination\" cp -r '${customUIPath}/'* '${webUIDestination}/'
else
echo -e \"\r${INFO} No custom UI found, using default React app.${RESET}\"
fi fi
true
" "
run_step "Remove Existing React Build (if any)" bash -c " run_step "Clean Old React Builds" bash -c "rm -rf '${webUIDestination}/build'"
if [ -d \"$webUIDestination/build\" ]; then
rm -rf \"$webUIDestination/build\"
fi
true
"
source "${venvFolder}/bin/activate" source "${venvFolder}/bin/activate"
run_step "Install Python Dependencies into Virtual Python Environment" bash -c " run_step "Install Python Dependencies" bash -c "
if [ -f \"requirements.txt\" ]; then pip install -q -r '${dataSource}/server-requirements.txt'
pip install -q -r requirements.txt
else
echo -e \"\r${INFO} No requirements.txt found, skipping Python packages.${RESET}\"
fi
true
" "
run_step "Install React App Dependencies" bash -c " run_step "Install React Dependencies" bash -c "
if [ -f \"$webUIDestination/package.json\" ]; then cd '${webUIDestination}'
cd \"$webUIDestination\" npm install --silent --no-fund --audit=false
npm install --silent --no-fund --audit=false --loglevel=error
cd -
fi
"
run_step "Install React Flow and UI Libraries" bash -c "
cd \"$webUIDestination\"
npm install reactflow --silent --no-fund --audit=false --loglevel=error
npm install --silent @mui/material @mui/icons-material @emotion/react @emotion/styled --no-fund --audit=false --loglevel=error
cd - cd -
" "
run_step "Build React App" bash -c " run_step "Build React App" bash -c "
cd \"$webUIDestination\" cd '${webUIDestination}'
npm run build --silent --loglevel=error npm run build --silent
cd - cd -
" "
cd "${venvFolder}" echo -e "\n${GREEN}Launching Borealis Flask Server...${RESET}"
echo -e "\n${GREEN}Launching Borealis...${RESET}"
echo "====================================================================================" echo "===================================================================================="
echo -ne "${HOURGLASS} Starting Flask server... " python3 "${dataDestination}/server.py"
python3 Borealis/server.py
echo -e "\r${CHECKMARK} Borealis Launched Successfully!"
} }
launch_agent() { launch_agent() {
@ -160,8 +126,8 @@ launch_agent() {
venvFolder="Agent" venvFolder="Agent"
agentSourcePath="Data/Agent/borealis-agent.py" agentSourcePath="Data/Agent/borealis-agent.py"
agentRequirements="Data/Agent/requirements.txt" agentRequirements="Data/Agent/agent-requirements.txt"
agentDestinationFolder="${venvFolder}/Agent" agentDestinationFolder="${venvFolder}/Borealis"
agentDestinationFile="${agentDestinationFolder}/borealis-agent.py" agentDestinationFile="${agentDestinationFolder}/borealis-agent.py"
run_step "Create Virtual Python Environment for Agent" bash -c " run_step "Create Virtual Python Environment for Agent" bash -c "
@ -169,25 +135,15 @@ launch_agent() {
python3 -m venv '${venvFolder}' python3 -m venv '${venvFolder}'
fi fi
if [ -f '${agentSourcePath}' ]; then rm -rf '${agentDestinationFolder}'
rm -rf '${agentDestinationFolder}' mkdir -p '${agentDestinationFolder}'
mkdir -p '${agentDestinationFolder}' cp '${agentSourcePath}' '${agentDestinationFile}'
cp '${agentSourcePath}' '${agentDestinationFile}'
else
echo -e '\r${INFO} Warning: Agent script not found at ${agentSourcePath}, skipping copy.${RESET}'
fi
true
" "
source "${venvFolder}/bin/activate" source "${venvFolder}/bin/activate"
run_step "Install Python Dependencies for Agent" bash -c " run_step "Install Python Dependencies for Agent" bash -c "
if [ -f '${agentRequirements}' ]; then pip install -q -r '${agentRequirements}'
pip install -q -r '${agentRequirements}'
else
echo -e '\r${INFO} Agent-specific requirements.txt not found at ${agentRequirements}, skipping Python packages.${RESET}'
fi
true
" "
echo -e "\n${GREEN}Launching Borealis Agent...${RESET}" echo -e "\n${GREEN}Launching Borealis Agent...${RESET}"