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