71 lines
1.7 KiB
Bash
Executable File
71 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Check if required environment variables are set
|
|
if [ -z "$SIA_REPO_URL" ]; then
|
|
echo "Error: SIA_REPO_URL environment variable is not set"
|
|
return 1
|
|
fi
|
|
|
|
if [ -z "$SIA_REPO_USER" ]; then
|
|
echo "Error: SIA_REPO_USER environment variable is not set"
|
|
return 1
|
|
fi
|
|
|
|
if [ -z "$SIA_REPO_PAT" ]; then
|
|
echo "Error: SIA_REPO_PAT environment variable is not set"
|
|
return 1
|
|
fi
|
|
|
|
# Install required packages
|
|
apt-get update
|
|
apt-get install -y \
|
|
vim
|
|
|
|
# Create directory structure
|
|
echo "Creating directory structure..."
|
|
mkdir -p "/root/data/iterations"
|
|
mkdir -p "/root/desktop"
|
|
mkdir -p "/root/venvs"
|
|
|
|
# Clone SIA repository
|
|
if [ ! -d "/root/sia" ]; then
|
|
echo "Cloning SIA repository..."
|
|
git clone "https://$SIA_REPO_USER:$SIA_REPO_PAT@${SIA_REPO_URL#https://}" "/root/sia"
|
|
|
|
echo "Configuring git user and email..."
|
|
cd "/root/sia"
|
|
git config --global user.name "Niels Geens"
|
|
git config --global user.email "niels.geens@gmail.com"
|
|
git config --global core.editor vim
|
|
fi
|
|
|
|
# Fixing permissions
|
|
echo "Fixing permissions..."
|
|
chmod +x /root/sia/scripts/*.sh
|
|
|
|
# Install Node.js if needed
|
|
if ! command -v node &> /dev/null; then
|
|
echo "Installing Node.js..."
|
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
|
|
export NVM_DIR="$HOME/.nvm"
|
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
nvm install node
|
|
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"
|
|
|
|
# Install SIA dependencies
|
|
source "/root/sia/scripts/install.sh"
|
|
|
|
## Finetune model
|
|
#echo "Finetuning model..."
|
|
#train
|
|
#
|
|
## Start SIA using restart script
|
|
#echo "Run restart script..."
|
|
#"/root/sia/scripts/restart.sh" |