Updated Linux Launch Script (Needs Tested)
This commit is contained in:
parent
075db02c45
commit
eb4cd35734
@ -2,23 +2,26 @@
|
||||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Color codes
|
||||
GREEN="\033[0;32m"
|
||||
YELLOW="\033[1;33m"
|
||||
RED="\033[0;31m"
|
||||
RESET="\033[0m"
|
||||
CHECKMARK="✅"
|
||||
HOURGLASS="⏳"
|
||||
CROSSMARK="❌"
|
||||
INFO="ℹ️"
|
||||
|
||||
# ASCII-only icons
|
||||
CHECKMARK="[OK]"
|
||||
HOURGLASS="[WAIT]"
|
||||
CROSSMARK="[X]"
|
||||
INFO="[i]"
|
||||
|
||||
run_step() {
|
||||
local message="$1"
|
||||
shift
|
||||
echo -ne "${HOURGLASS} ${message}... "
|
||||
echo -e "${GREEN}${HOURGLASS} ${message}...${RESET}"
|
||||
if "$@"; then
|
||||
echo -e "\r${CHECKMARK} ${message}"
|
||||
echo -e "${GREEN}${CHECKMARK} ${message} completed.${RESET}"
|
||||
else
|
||||
echo -e "\r${CROSSMARK} ${message} - Failed${RESET}"
|
||||
echo -e "${RED}${CROSSMARK} ${message} failed!${RESET}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@ -26,11 +29,10 @@ run_step() {
|
||||
detect_distro() {
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
DISTRO_ID=$ID
|
||||
DISTRO_ID="$ID"
|
||||
else
|
||||
DISTRO_ID="unknown"
|
||||
fi
|
||||
echo -e "${INFO} Detected OS: ${DISTRO_ID}"
|
||||
}
|
||||
|
||||
install_core_dependencies() {
|
||||
@ -59,6 +61,7 @@ launch_server() {
|
||||
detect_distro
|
||||
run_step "Install System Dependencies" install_core_dependencies
|
||||
|
||||
# Paths
|
||||
venvFolder="Server"
|
||||
dataSource="Data/Server"
|
||||
dataDestination="${venvFolder}/Borealis"
|
||||
@ -66,54 +69,53 @@ launch_server() {
|
||||
webUIDestination="${venvFolder}/web-interface"
|
||||
venvPython="${venvFolder}/bin/python3"
|
||||
|
||||
# Create Python venv
|
||||
run_step "Create Virtual Python Environment" bash -c "
|
||||
if [ ! -f '${venvFolder}/bin/activate' ]; then
|
||||
python3 -m venv '${venvFolder}'
|
||||
fi
|
||||
"
|
||||
|
||||
# Install Python requirements
|
||||
run_step "Install Python Server Dependencies" bash -c "
|
||||
source '${venvFolder}/bin/activate'
|
||||
pip install --upgrade pip > /dev/null
|
||||
pip install --no-input -r '${dataSource}/server-requirements.txt'
|
||||
"
|
||||
|
||||
# Copy Python server components
|
||||
run_step "Copy Python Server Components" bash -c "
|
||||
rm -rf '${dataDestination}' && mkdir -p '${dataDestination}'
|
||||
cp -r '${dataSource}/Python_API_Endpoints' '${dataDestination}/'
|
||||
cp -r '${dataSource}/Sounds' '${dataDestination}/'
|
||||
cp -r '${dataSource}/Workflows' '${dataDestination}/'
|
||||
cp '${dataSource}/server.py' '${dataDestination}/'
|
||||
cp '${dataSource}/server.py' '${dataDestination}/'
|
||||
"
|
||||
|
||||
run_step "Create ReactJS App if Missing" bash -c "
|
||||
if [ ! -d '${webUIDestination}' ]; then
|
||||
npx create-react-app '${webUIDestination}' --use-npm --silent
|
||||
fi
|
||||
# Setup Vite WebUI assets
|
||||
run_step "Setup Vite WebUI assets" bash -c "
|
||||
rm -rf '${webUIDestination}' && mkdir -p '${webUIDestination}'
|
||||
cp -r '${customUIPath}/'* '${webUIDestination}/'
|
||||
"
|
||||
|
||||
run_step "Overwrite WebUI with Custom Files" bash -c "
|
||||
if [ -d '${customUIPath}' ]; then
|
||||
cp -r '${customUIPath}/'* '${webUIDestination}/'
|
||||
fi
|
||||
"
|
||||
|
||||
run_step "Clean Old React Builds" bash -c "rm -rf '${webUIDestination}/build'"
|
||||
|
||||
source "${venvFolder}/bin/activate"
|
||||
|
||||
run_step "Install Python Dependencies" bash -c "
|
||||
pip install --disable-pip-version-check -q -r '${dataSource}/server-requirements.txt'
|
||||
"
|
||||
|
||||
run_step "Install React Dependencies" bash -c "
|
||||
# Install NPM packages for Vite
|
||||
run_step "Install Vite Web Frontend NPM Packages" bash -c "
|
||||
cd '${webUIDestination}'
|
||||
npm install --silent --no-fund --audit=false
|
||||
cd -
|
||||
cd - > /dev/null
|
||||
"
|
||||
|
||||
run_step "Build React App" bash -c "
|
||||
# Launch Vite Web Frontend in Dev Mode
|
||||
run_step "Start Vite Web Frontend (Dev Mode)" bash -c "
|
||||
cd '${webUIDestination}'
|
||||
npm run build --silent
|
||||
cd -
|
||||
npm run dev --silent
|
||||
cd - > /dev/null
|
||||
"
|
||||
|
||||
# Launch Flask server
|
||||
echo -e "\n${GREEN}Launching Borealis Flask Server...${RESET}"
|
||||
echo "===================================================================================="
|
||||
source '${venvFolder}/bin/activate'
|
||||
python3 "${dataDestination}/server.py"
|
||||
}
|
||||
|
||||
@ -128,29 +130,32 @@ launch_agent() {
|
||||
agentSourcePath="Data/Agent/borealis-agent.py"
|
||||
agentRequirements="Data/Agent/agent-requirements.txt"
|
||||
agentDestinationFolder="${venvFolder}/Borealis"
|
||||
agentDestinationFile="${agentDestinationFolder}/borealis-agent.py"
|
||||
|
||||
run_step "Create Virtual Python Environment for Agent" bash -c "
|
||||
if [ ! -f '${venvFolder}/bin/activate' ]; then
|
||||
python3 -m venv '${venvFolder}'
|
||||
fi
|
||||
|
||||
rm -rf '${agentDestinationFolder}'
|
||||
mkdir -p '${agentDestinationFolder}'
|
||||
cp '${agentSourcePath}' '${agentDestinationFile}'
|
||||
"
|
||||
|
||||
source "${venvFolder}/bin/activate"
|
||||
run_step "Install Agent Dependencies" bash -c "
|
||||
source '${venvFolder}/bin/activate'
|
||||
pip install --upgrade pip > /dev/null
|
||||
pip install --no-input -r '${agentRequirements}'
|
||||
"
|
||||
|
||||
run_step "Install Python Dependencies for Agent" bash -c "
|
||||
pip install --disable-pip-version-check -q -r '${agentRequirements}'
|
||||
run_step "Copy Agent Script" bash -c "
|
||||
mkdir -p '${agentDestinationFolder}'
|
||||
cp '${agentSourcePath}' '${agentDestinationFolder}/'
|
||||
"
|
||||
|
||||
echo -e "\n${GREEN}Launching Borealis Agent...${RESET}"
|
||||
echo "===================================================================================="
|
||||
python3 "${agentDestinationFile}"
|
||||
source '${venvFolder}/bin/activate'
|
||||
python3 "${agentDestinationFolder}/borealis-agent.py"
|
||||
}
|
||||
|
||||
# Main menu
|
||||
|
||||
echo -e "${GREEN}Deploying Borealis - Workflow Automation Tool...${RESET}"
|
||||
echo "===================================================================================="
|
||||
echo "Please choose which module you want to launch / (re)deploy:"
|
||||
@ -159,7 +164,7 @@ echo "- Agent (Local/Remote Client) [2]"
|
||||
|
||||
read -p "Enter 1 or 2: " choice
|
||||
|
||||
case "$choice" in
|
||||
case "${choice}" in
|
||||
1) launch_server ;;
|
||||
2) launch_agent ;;
|
||||
*) echo -e "${YELLOW}Invalid selection. Exiting...${RESET}"; exit 1 ;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user