File size: 2,924 Bytes
f917448
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# 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