From 07aa80fa75e3a854bfea616754cdf2293963bec9 Mon Sep 17 00:00:00 2001 From: Niels Geens Date: Tue, 29 Apr 2025 16:17:46 +0200 Subject: [PATCH] Create separate venv for running notebooks --- scripts/bootstrap.sh | 56 ++++++++++++++++++++++++++++++-------------- scripts/install.sh | 7 ++++++ 2 files changed, 45 insertions(+), 18 deletions(-) diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 68f960d..54b8e31 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -1,5 +1,15 @@ #!/bin/bash +#SIA_INSTALL_NO_ITB = 1 +#SIA_INSTALL_NO_TRAIN = 1 +#SIA_INSTALL_NO_NOTEBOOK = 1 +#SIA_INSTALL_NO_CORE = 1 +#SIA_BOOTSTRAP_NO_CHROME = 1 +#SIA_BOOTSTRAP_NO_RUST = 1 +#SIA_BOOTSTRAP_NO_WEB = 1 +#SIA_BOOTSTRAP_NO_TRAIN = 1 +#SIA_BOOTSTRAP_NO_START = 1 + trap 'return 1' ERR # Check if required environment variables are set @@ -31,18 +41,22 @@ apt-get install -y \ ; # Install Chrome -wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - -echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list -apt-get update && \ - apt-get install -y \ - google-chrome-stable +if [ -z "${SIA_BOOTSTRAP_NO_CHROME}" ]; then + wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - + echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list + apt-get update && \ + apt-get install -y \ + google-chrome-stable +fi # Install Rust -curl https://sh.rustup.rs -sSf | bash -s -- -y -export PATH="/root/.cargo/bin:${PATH}" +if [ -z "${SIA_BOOTSTRAP_NO_RUST}" ]; then + curl https://sh.rustup.rs -sSf | bash -s -- -y + export PATH="/root/.cargo/bin:${PATH}" +fi # Install Node.js -if ! command -v node &> /dev/null; then +if [ -z "${SIA_BOOTSTRAP_NO_WEB}" ]; then echo "Installing Node.js..." curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash export NVM_DIR="/root/.nvm" @@ -69,11 +83,13 @@ if [ ! -d "/root/sia" ]; then fi # Build web interface -echo "Building web interface" -cd "/root/sia/web" -npm install -npm run build -ln -s "/root/sia/web/dist" "/root/static" +if [ -z "${SIA_BOOTSTRAP_NO_WEB}" ]; then + echo "Building web interface" + cd "/root/sia/web" + npm install + npm run build + ln -s "/root/sia/web/dist" "/root/static" +fi # Install SIA dependencies cd /root/desktop @@ -93,10 +109,14 @@ fi source /root/sia/scripts/add_venvs_to_path.sh # Finetune model -echo "Finetuning model..." -train /root/models/bootstrap -ln -s /root/models/bootstrap /root/models/current +if [ -z "${SIA_BOOTSTRAP_NO_TRAIN}" ]; then + echo "Finetuning model..." + train /root/models/bootstrap + ln -s /root/models/bootstrap /root/models/current +fi # Start SIA using restart script -echo "Run restart script..." -"/root/sia/scripts/restart.sh" \ No newline at end of file +if [ -z "${SIA_BOOTSTRAP_NO_START}" ]; then + echo "Run restart script..." + "/root/sia/scripts/restart.sh" +if [ -z "${SIA_BOOTSTRAP_NO_TRAIN}" ]; then \ No newline at end of file diff --git a/scripts/install.sh b/scripts/install.sh index 3bb8059..7d0341b 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -13,6 +13,13 @@ if [ -z "${SIA_INSTALL_NO_TRAIN}" ]; then /root/venvs/train/bin/ipython kernel install --name=train fi +if [ -z "${SIA_INSTALL_NO_NOTEBOOK}"]; then + echo "Installing venv for running notebooks..." + python3 -m venv /root/venvs/notebook + /root/venvs/notebook/bin/pip install ipykernel ipywidgets + /root/venvs/notebook/bin/ipython kernel install --name=notebook +fi + if [ -z "${SIA_INSTALL_NO_CORE}" ]; then echo "Installing SIA core..." python3 -m venv /root/venvs/sia