#!/bin/bash # Deploy The-Tired-AGI to Lenovo Server # Full installation with chat interface set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" AGI_HOME="$(dirname "$SCRIPT_DIR")" # Lenovo server details LENOVO_API="https://[2600:8803:bf0a:e000:4eea:41ff:fe69:2998]/s" AUTH_TOKEN="[credential removed]" echo "╔════════════════════════════════════════════════════════════════╗" echo "║ 🚀 Deploying The-Tired-AGI to Lenovo Server ║" echo "╚════════════════════════════════════════════════════════════════╝" echo "" echo "Target: $LENOVO_API" echo "" # Build chat server locally first echo "📦 Building chat server..." cd "$AGI_HOME/chat" go build -o chat_server server.go echo " ✅ Built" echo "" # Create deployment package echo "📦 Creating deployment package..." cd "$AGI_HOME" DEPLOY_DIR="/tmp/agi_deploy_$(date +%s)" mkdir -p "$DEPLOY_DIR" # Copy essential files cp -r chat "$DEPLOY_DIR/" cp -r training "$DEPLOY_DIR/" cp -r core "$DEPLOY_DIR/" 2>/dev/null || mkdir -p "$DEPLOY_DIR/core/knowledge" cp -r hive "$DEPLOY_DIR/" cp -r gossip "$DEPLOY_DIR/" cp -r bridge "$DEPLOY_DIR/" cp -r scripts "$DEPLOY_DIR/" # Create install script for Lenovo cat > "$DEPLOY_DIR/install.sh" <<'INSTALL_EOF' #!/bin/bash # AGI Installation Script for Lenovo Server set -e echo "Installing The-Tired-AGI on Lenovo Server..." # Install dependencies echo "📦 Installing dependencies..." if command -v apt-get &> /dev/null; then sudo apt-get update sudo apt-get install -y golang clang make zlib1g-dev curl elif command -v yum &> /dev/null; then sudo yum install -y golang clang make zlib-devel curl fi # Build components echo "🔨 Building components..." # Build gossip service cd gossip go build -o gossipd main.go echo " ✅ Gossip service built" # Build bridge cd ../bridge go build -o bridge main.go echo " ✅ Bridge built" # Build chat server cd ../chat go build -o chat_server server.go echo " ✅ Chat server built" # Build ultra hive cd ../hive make ultra echo " ✅ Ultra hive built" cd .. echo "" echo "✅ Installation complete!" echo "" echo "To start the AGI:" echo " ./start_agi.sh" echo "" INSTALL_EOF chmod +x "$DEPLOY_DIR/install.sh" # Create startup script cat > "$DEPLOY_DIR/start_agi.sh" <<'START_EOF' #!/bin/bash # Start all AGI services set -e AGI_HOME="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" mkdir -p "$AGI_HOME/logs" echo "╔════════════════════════════════════════════════════════════════╗" echo "║ 🧠 Starting The-Tired-AGI on Lenovo (25M agents) ║" echo "╚════════════════════════════════════════════════════════════════╝" echo "" # Start gossip service if ! lsof -i :8008 -t > /dev/null 2>&1; then echo "🌐 Starting Gossip Service (port 8008)..." cd "$AGI_HOME/gossip" nohup ./gossipd > "$AGI_HOME/logs/gossip.log" 2>&1 & echo " PID: $!" sleep 2 fi # Start ultra hive if ! lsof -i :8010 -t > /dev/null 2>&1; then echo "🐝 Starting Ultra Hive (ports 8010, 8009)..." cd "$AGI_HOME/hive" nohup ./agi_hive_ultra > "$AGI_HOME/logs/hive.log" 2>&1 & echo " PID: $!" sleep 2 fi # Start chat server if ! lsof -i :3001 -t > /dev/null 2>&1; then echo "💬 Starting Chat Server (port 3001)..." cd "$AGI_HOME/chat" nohup ./chat_server > "$AGI_HOME/logs/chat.log" 2>&1 & CHAT_PID=$! echo " PID: $CHAT_PID" sleep 2 fi # Spawn 25M agents (Lenovo capacity) echo "" echo "⚡ Spawning 25,000,000 agents..." curl -s -X POST http://localhost:8008/spawn -d '{"count":25000000}' > /dev/null 2>&1 sleep 3 # Check status AGENT_COUNT=$(curl -s http://localhost:8008/stats 2>/dev/null | grep -o '"agent_count":[0-9]*' | cut -d: -f2 || echo "0") echo "" echo "╔════════════════════════════════════════════════════════════════╗" echo "║ ✅ The-Tired-AGI is RUNNING on Lenovo! ║" echo "╚════════════════════════════════════════════════════════════════╝" echo "" echo "📊 Status:" echo " Agents Active: $(printf "%'d" $AGENT_COUNT)" echo " Gossip: http://localhost:8008/stats" echo " Chat: http://localhost:3001" echo "" echo "🌐 Access the chat interface:" echo " Local: http://localhost:3001" echo " Remote: http://$(hostname -I | awk '{print $1}'):3001" echo "" echo "💬 Start chatting with the AGI!" echo "" START_EOF chmod +x "$DEPLOY_DIR/start_agi.sh" echo " ✅ Package created at $DEPLOY_DIR" echo "" # Create tarball echo "📦 Creating tarball..." cd /tmp TAR_NAME="agi_deploy_$(date +%Y%m%d_%H%M%S).tar.gz" tar -czf "$TAR_NAME" -C "$DEPLOY_DIR" . echo " ✅ Created $TAR_NAME ($(du -h "$TAR_NAME" | cut -f1))" echo "" # Deploy via API echo "🚀 Deploying to Lenovo server..." echo " Uploading package..." # Use curl to upload (assuming the Lenovo API has a deployment endpoint) RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "$LENOVO_API/deploy" \ -H "Authorization: Bearer $AUTH_TOKEN" \ -F "package=@/tmp/$TAR_NAME" \ -F "auto_install=true" \ -F "auto_start=true" 2>&1) HTTP_CODE=$(echo "$RESPONSE" | tail -n1) BODY=$(echo "$RESPONSE" | head -n-1) if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "201" ]; then echo " ✅ Deployment successful!" echo "" echo "Server response:" echo "$BODY" | jq '.' 2>/dev/null || echo "$BODY" else echo " ⚠️ Deployment returned HTTP $HTTP_CODE" echo "" echo "Response:" echo "$BODY" echo "" echo "Alternative: Manual deployment" echo " 1. Copy the tarball to your Lenovo server:" echo " scp /tmp/$TAR_NAME user@lenovo-server:/tmp/" echo "" echo " 2. SSH to Lenovo and extract:" echo " ssh user@lenovo-server" echo " mkdir -p ~/the_tired_agi && cd ~/the_tired_agi" echo " tar -xzf /tmp/$TAR_NAME" echo "" echo " 3. Install and start:" echo " ./install.sh" echo " ./start_agi.sh" echo "" echo "Tarball location: /tmp/$TAR_NAME" fi echo "" echo "╔════════════════════════════════════════════════════════════════╗" echo "║ 🎉 Deployment Process Complete! ║" echo "╚════════════════════════════════════════════════════════════════╝" echo "" echo "Next steps:" echo " 1. Verify Lenovo server is running:" echo " curl https://[2600:8803:bf0a:e000:4eea:41ff:fe69:2998]/s/stats \\" echo " -H \"Authorization: Bearer $AUTH_TOKEN\"" echo "" echo " 2. Access the chat interface:" echo " http://[2600:8803:bf0a:e000:4eea:41ff:fe69:2998]:3001" echo "" echo " 3. Test locally first:" echo " cd $AGI_HOME/chat" echo " ./chat_server" echo " Open http://localhost:3001" echo ""