Spaces:
Sleeping
Sleeping
| # ORA Google Cloud Deployment Script | |
| # Run this in PowerShell as Administrator | |
| Write-Host "π ORA Google Cloud Deployment" -ForegroundColor Cyan | |
| Write-Host "================================" -ForegroundColor Cyan | |
| # Step 1: Check if gcloud is installed | |
| Write-Host "`nπ¦ Checking Google Cloud SDK..." -ForegroundColor Yellow | |
| if (!(Get-Command gcloud -ErrorAction SilentlyContinue)) { | |
| Write-Host "β Google Cloud SDK not found!" -ForegroundColor Red | |
| Write-Host "Please install it from: https://cloud.google.com/sdk/docs/install" -ForegroundColor Yellow | |
| Write-Host "After installation, run this script again." -ForegroundColor Yellow | |
| exit | |
| } | |
| Write-Host "β Google Cloud SDK found!" -ForegroundColor Green | |
| # Step 2: Login to Google Cloud | |
| Write-Host "`nπ Logging in to Google Cloud..." -ForegroundColor Yellow | |
| gcloud auth login | |
| # Step 3: Set project | |
| Write-Host "`nπ Enter your Google Cloud Project ID:" -ForegroundColor Yellow | |
| $PROJECT_ID = Read-Host "Project ID" | |
| gcloud config set project $PROJECT_ID | |
| # Step 4: Enable required APIs | |
| Write-Host "`nβοΈ Enabling required APIs..." -ForegroundColor Yellow | |
| gcloud services enable compute.googleapis.com | |
| gcloud services enable containerregistry.googleapis.com | |
| # Step 5: Create VM with GPU | |
| Write-Host "`nπ₯οΈ Creating VM with T4 GPU..." -ForegroundColor Yellow | |
| Write-Host "This will use your $2000 credit (~$0.35/hour)" -ForegroundColor Cyan | |
| $VM_NAME = "ora-gpu-vm" | |
| $ZONE = "us-central1-a" | |
| gcloud compute instances create $VM_NAME ` | |
| --zone=$ZONE ` | |
| --machine-type=n1-standard-4 ` | |
| --accelerator=type=nvidia-tesla-t4,count=1 ` | |
| --image-family=pytorch-latest-gpu ` | |
| --image-project=deeplearning-platform-release ` | |
| --boot-disk-size=100GB ` | |
| --metadata="install-nvidia-driver=True" ` | |
| --tags=ora-vm | |
| # Step 6: Create firewall rule | |
| Write-Host "`nπ₯ Creating firewall rule..." -ForegroundColor Yellow | |
| gcloud compute firewall-rules create allow-ora ` | |
| --allow tcp:80,tcp:7860 ` | |
| --source-ranges 0.0.0.0/0 ` | |
| --target-tags=ora-vm | |
| # Step 7: Get VM IP | |
| Write-Host "`nπ Getting VM IP address..." -ForegroundColor Yellow | |
| $VM_IP = gcloud compute instances describe $VM_NAME --zone=$ZONE --format="get(networkInterfaces[0].accessConfigs[0].natIP)" | |
| Write-Host "`nβ VM Created Successfully!" -ForegroundColor Green | |
| Write-Host "================================" -ForegroundColor Cyan | |
| Write-Host "VM Name: $VM_NAME" -ForegroundColor White | |
| Write-Host "Zone: $ZONE" -ForegroundColor White | |
| Write-Host "IP Address: $VM_IP" -ForegroundColor White | |
| Write-Host "`nπ Next Steps:" -ForegroundColor Yellow | |
| Write-Host "1. SSH into VM: gcloud compute ssh $VM_NAME --zone=$ZONE" -ForegroundColor White | |
| Write-Host "2. Run the setup script on the VM (see setup_vm.sh)" -ForegroundColor White | |
| Write-Host "3. Access ORA at: http://$VM_IP" -ForegroundColor White | |
| Write-Host "`nπ° Cost: ~$0.35/hour with T4 GPU (using your credits)" -ForegroundColor Cyan | |