#!/bin/bash # ============================================================================== # Senti AI — Debian VM Lightweight Setup Script # ============================================================================== # Run this script on the target Compute Engine Debian VM. # ============================================================================== set -e # exit on error echo "====== [SENTI VM SETUP] ======" # 1. Update Packages echo "--> 1. Updating packages..." sudo apt-get update && sudo apt-get upgrade -y sudo apt-get install -y git python3 python3-pip python3-venv nginx curl gcc g++ pkg-config build-essential tesseract-ocr # 2. Install Rust (for cargo/senti_calc maturin compilation) if ! command -v cargo &> /dev/null; then echo "--> 2. Installing Rust..." curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y source "$HOME/.cargo/env" fi # 3. Setup Node.js & NPM (for frontend build) if ! command -v node &> /dev/null; then echo "--> 3. Installing Node.js..." curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt-get install -y nodejs fi # 4. Build Frontend echo "--> 4. Building React Frontend..." cd /app/frontend || cd ~/senti_ai/frontend || cd "$(pwd)/frontend" npm ci npm run build # 5. Configure Nginx echo "--> 5. Configuring Nginx..." FRONTEND_DIST_PATH=$(pwd)/dist sudo tee /etc/nginx/sites-available/senti < 6. Building Python Backend Virtual Environment..." cd .. python3 -m venv venv source venv/bin/activate pip install --upgrade pip pip install -r senti/requirements.txt # Compile Rust engine echo "--> 7. Building Rust engine extensions..." cd senti/senti_calc pip install maturin maturin build --release pip install . cd ../.. # 7. Create Systemd Service for Gateway echo "--> 8. Creating systemd service for Senti Gateway..." PROJECT_DIR=$(pwd) sudo tee /etc/systemd/system/senti-gateway.service < 9. Checking status of services..." sudo systemctl status nginx --no-pager sudo systemctl status senti-gateway --no-pager echo "====== [VM SETUP AND DEPLOYMENT COMPLETED] ======" echo "Access Senti AI on http://"