devmatrix-scripts/DEVMATRIX_SETUP_GUIDE.md

434 lines
8.9 KiB
Markdown

# DevMatrix Proxmox Setup - Complete Guide
## Overview
This guide will set up a complete autonomous development environment on your Proxmox server with:
- **VM 300**: OpenClaw DevMatrix (Ubuntu 22.04) - 32GB RAM, 16 cores
- **VM 301**: Windows 11 LTSC IoT Test VM - 16GB RAM, 8 cores
- **VM 302**: Android Emulator VM - 8GB RAM, 4 cores
## Prerequisites
- Proxmox VE 7.x or 8.x
- Network bridge `vmbr1` configured
- At least 56GB RAM available (32+16+8)
- At least 750GB storage available
- Root access to Proxmox host
## Files Included
1. `setup_devmatrix_proxmox.sh` - Main Proxmox setup script
2. `setup_openclaw_dev.sh` - Ubuntu VM environment setup
3. `setup_windows_vm.ps1` - Windows VM post-install setup
---
## Step 1: Transfer Scripts to Proxmox
### Option A: SSH (Recommended)
```bash
# From your local machine, copy scripts to Proxmox
scp setup_devmatrix_proxmox.sh root@192.168.5.200:/root/
```
### Option B: Proxmox Shell
1. Go to https://192.168.5.200:8006
2. Select your node → Shell
3. Use `wget` or `curl` to download scripts
---
## Step 2: Run Proxmox Setup Script
```bash
# SSH into Proxmox
ssh root@192.168.5.200
# Make script executable
chmod +x setup_devmatrix_proxmox.sh
# Run setup
./setup_devmatrix_proxmox.sh
```
### What the script does:
1. ✅ Checks vmbr1 exists
2. ✅ Shows available storage - you pick one
3. ✅ Verifies VM IDs 300-302 are available
4. ✅ Checks available RAM and disk space
5. ✅ Downloads Ubuntu 22.04 Server ISO
6. ✅ Prompts for Windows ISO (you provide LTSC IoT)
7. ✅ Creates VM 300: OpenClaw DevMatrix
8. ✅ Creates VM 301: Windows LTSC Test
9. ✅ Creates VM 302: Android Emulator
10. ✅ Generates SSH keys for access
11. ✅ Saves VM info to ~/devmatrix_vm_info.txt
### Expected Output:
```
[DevMatrix] 🔍 Running pre-flight checks...
[DevMatrix] ✓ Network bridge 'vmbr1' found
[DevMatrix] 📦 Checking available storage...
...
[DevMatrix] 🎉 DevMatrix VMs Created Successfully!
```
---
## Step 3: Install Ubuntu on VM 300
### Start the VM:
```bash
qm start 300
```
### Access Console:
- Proxmox Web UI → VM 300 → Console
- Or: `qm console 300` from Proxmox shell
### Install Ubuntu 22.04 Server:
1. Select "Try or Install Ubuntu Server"
2. Language: English
3. Keyboard layout: Your preference
4. Network: DHCP (should get IP from vmbr1)
5. Proxy: Leave blank
6. Mirror: Default
7. Storage: Use entire disk
8. Profile:
- Name: `devmatrix`
- Server name: `devmatrix`
- Username: `devmatrix`
- Password: [Choose a strong password]
9. SSH: Import SSH key (copy from ~/.ssh/devmatrix_id_rsa.pub on Proxmox)
10. Featured Server Snaps: None (we'll install everything manually)
11. Wait for installation to complete
12. Reboot when prompted
### After Reboot:
```bash
# Find VM IP address
qm guest exec 300 -- ip addr show | grep inet
# SSH into VM from Proxmox host
ssh -i ~/.ssh/devmatrix_id_rsa devmatrix@<vm-ip>
```
---
## Step 4: Setup Dev Environment on VM 300
### Transfer setup script:
```bash
# From Proxmox host, copy script to VM
scp -i ~/.ssh/devmatrix_id_rsa setup_openclaw_dev.sh devmatrix@<vm-ip>:/home/devmatrix/
```
### Run setup:
```bash
# Inside VM (SSH session)
chmod +x setup_openclaw_dev.sh
./setup_openclaw_dev.sh
```
### This installs:
- OpenClaw (AI orchestrator)
- Node.js 20
- Python + development tools
- Docker
- Flutter (mobile development)
- .NET 8 (cross-platform)
- Rust
- Go
- Wine (Windows compatibility)
- Playwright (UI testing)
- PostgreSQL & Redis
- AWS CLI & Google Cloud SDK
- Kubernetes tools (kubectl, helm)
- Terraform
- VS Code Server (web-based IDE)
- VM control scripts
### Expected Duration:
- 15-30 minutes depending on internet speed
- Downloads ~5GB of packages
---
## Step 5: Configure API Keys (YOU DO THIS)
**⚠️ IMPORTANT: This is the ONLY step requiring your API keys**
```bash
# Inside VM 300
~/scripts/configure_api_keys.sh
```
You will be prompted for:
1. **Kimi API Key** - Get from https://kimi.moonshot.cn/
2. **Antigravity API Key** - From your provider
The script creates:
- `~/.openclaw/config/kimi.yaml`
- `~/.openclaw/config/antigravity.yaml`
Files are set to 600 permissions (owner read/write only).
### Test Configuration:
```bash
openclaw models list
```
---
## Step 6: Install Windows on VM 301
### Prerequisites:
You need Windows 11 Enterprise LTSC IoT ISO:
- Download from Microsoft Volume Licensing Service Center
- Or your organization's licensing portal
- Filename: `Win11_Ent_LTSC_IoT.iso`
- Place in: `/var/lib/vz/template/iso/` on Proxmox
### Start VM:
```bash
qm start 301
```
### Install Windows:
1. Connect via Proxmox Console
2. Standard Windows 11 LTSC installation
3. Region/keyboard: Your preference
4. Network: Let it connect to vmbr1
5. Microsoft account: Skip (use offline account)
6. Username: `testuser`
7. Password: `DevMatrix2024!` (or your choice)
### Post-Install Setup:
1. Log in as testuser
2. Open PowerShell as Administrator
3. Transfer setup script:
```powershell
# From Proxmox, copy to VM
scp setup_windows_vm.ps1 testuser@<win-vm-ip>:C:/Scripts/
```
4. Run setup:
```powershell
cd C:\Scripts
.\setup_windows_vm.ps1
```
### This installs on Windows:
- OpenSSH Server
- Remote Desktop
- Chocolatey package manager
- Git, Python, Node.js, .NET, VS Code
- Playwright for UI testing
- Test automation scripts
### Reboot when complete.
---
## Step 7: Install Android Emulator (VM 302 - Optional)
VM 302 is pre-configured with Ubuntu. You can either:
### Option A: Use as-is (lightweight Linux VM)
Good for testing Linux-specific code.
### Option B: Install Android Emulator
```bash
qm start 302
# Install Ubuntu Server
# Then install Android SDK + Emulator
```
---
## Usage Examples
### Start Development Session:
```bash
# SSH into main dev VM
ssh -i ~/.ssh/devmatrix_id_rsa devmatrix@192.168.5.x
# Access VS Code in browser
# http://192.168.5.x:8080
# Password: devmatrix-setup-2024
```
### Create New Project:
```bash
# Example: Create Flutter mobile app
openclaw swarm create "MyMobileApp" --type flutter --agents 4
# Example: Create React web app
openclaw swarm create "MyWebApp" --type react --agents 5
```
### Test on Windows:
```bash
# From VM 300
~/scripts/vm_control.sh win-start
# Wait 60 seconds
~/scripts/test_on_windows.sh /path/to/your/dotnet/project
~/scripts/vm_control.sh win-stop
```
### Control VMs:
```bash
# Start Windows VM
~/scripts/vm_control.sh win-start
# Check status
~/scripts/vm_control.sh win-status
# Stop Windows VM
~/scripts/vm_control.sh win-stop
# Same for Android
~/scripts/vm_control.sh android-start
~/scripts/vm_control.sh android-stop
```
---
## Network Configuration
### Default IPs (via DHCP on vmbr1):
- VM 300 (Ubuntu): Assigned by DHCP
- VM 301 (Windows): Assigned by DHCP
- VM 302 (Android): Assigned by DHCP
### To Set Static IPs (recommended):
**On VM 300 (Ubuntu):**
```bash
sudo nano /etc/netplan/00-installer-config.yaml
```
Change to:
```yaml
network:
ethernets:
ens18:
dhcp4: no
addresses:
- 192.168.5.150/24
routes:
- to: default
via: 192.168.5.1
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
version: 2
```
```bash
sudo netplan apply
```
**On VM 301 (Windows):**
Settings → Network → Ethernet → Edit → Manual
- IP: 192.168.5.151
- Subnet: 255.255.255.0
- Gateway: 192.168.5.1
- DNS: 8.8.8.8
---
## Troubleshooting
### VM Won't Start:
```bash
# Check logs
qm log 300
# Check status
qm status 300
# Start with verbose
qm start 300 --verbose
```
### Can't SSH to VM:
```bash
# Test from Proxmox
qm guest exec 300 -- ping -c 1 8.8.8.8
# Check IP
qm guest exec 300 -- ip addr
# Check SSH service
qm guest exec 300 -- systemctl status ssh
```
### Windows VM No Network:
```powershell
# In Windows PowerShell (Admin)
Get-NetAdapter
Get-NetIPAddress
Test-NetConnection 8.8.8.8
```
### Out of Disk Space:
```bash
# On Proxmox
pvesm status
# Expand VM disk
qm resize 300 scsi0 +100G
```
---
## Security Notes
1. **API Keys**: Only stored on VM 300, never transmitted
2. **SSH Keys**: Generated on Proxmox, private key stays on Proxmox
3. **Windows Password**: Change after setup if desired
4. **VS Code Password**: Change in ~/.config/code-server/config.yaml
5. **Firewall**: VMs use vmbr1 (presumably internal network)
---
## Backup Strategy
### Create Snapshots:
```bash
# Snapshot before major changes
qm snapshot 300 pre-experiment
# Rollback if needed
qm rollback 300 pre-experiment
```
### Backup VM Configs:
```bash
# Backup to NAS/external
vzdump 300 301 302 --compress zstd --storage <your-backup-storage>
```
---
## Next Steps
1. ✅ Run Proxmox setup script
2. ✅ Install Ubuntu on VM 300
3. ✅ Run dev environment setup
4. ✅ Add your API keys
5. ✅ Install Windows on VM 301
6. ✅ Test the setup
7. 🚀 Start building with AI-powered development!
---
## Support
If you encounter issues:
1. Check logs: `qm log <vmid>`
2. Review this guide
3. Check OpenClaw docs: https://docs.openclaw.ai
4. Ask me for help!
**Ready to build something amazing?** 🚀