# 🎯 DEPLOYMENT ACTION PLAN - READY TO GO

**Status:** ⏰ AWAITING EXECUTION  
**Date:** March 28, 2026  
**Estimated Time:** 1-2 hours total

---

## ✅ PHASE SEKARANG: UPLOAD & TEST

### **STEP 1: VERIFY LOCAL FILES (5 min)**

Pastikan semua files sudah ada di local:

```powershell
# Check di e:\xampp\htdocs\tracker

# 1. Check dashboard/installer.php
Test-Path "e:\xampp\htdocs\tracker\dashboard\installer.php" -Verbose

# 2. Check api/controllers/InstallerController.php
Test-Path "e:\xampp\htdocs\tracker\api\controllers\InstallerController.php" -Verbose

# 3. Check api/index.php (updated)
Test-Path "e:\xampp\htdocs\tracker\api\index.php" -Verbose

# Result seharusnya TRUE untuk semua
```

**Expected Output:**
```
Target         : e:\xampp\htdocs\tracker\dashboard\installer.php
Exist          : True
```

---

### **STEP 2: TEST LOCAL (10 min)**

Sebelum upload ke webhost, test di local XAMPP dulu:

```powershell
# 1. Start XAMPP (jika belum running)
# Double-click: C:\xampp\xampp-control.exe
# Start Apache & MySQL

# 2. Open browser
start "http://localhost/tracker/dashboard/installer.php"

# Seharusnya melihat:
# ✅ Beautiful installer interface
# ✅ Download button
# ✅ All sections visible
# ✅ No errors in console
```

**Verify checklist:**
- [ ] Page loads without error
- [ ] Title: "PC Monitor Agent - Web Installer"
- [ ] Download button visible
- [ ] System requirements list visible
- [ ] All 4 steps visible
- [ ] Styling looks nice

---

### **STEP 3: TEST SCRIPT GENERATION (5 min)**

```powershell
# Test kalau PowerShell script bisa di-generate

# Di browser, test URL ini:
# http://localhost/tracker/dashboard/installer.php?action=api&do=get-installer-script

# Atau pakai curl:
$url = "http://localhost/tracker/dashboard/installer.php?action=api&do=get-installer-script"
Invoke-WebRequest -Uri $url -OutFile "C:\temp\PCMonitor-Install.ps1"

# Check file hasil download
Get-Item "C:\temp\PCMonitor-Install.ps1"

# Seharusnya:
# - File ada
# - Size ~20KB
# - Bisa dibuka dengan notepad
```

**Verify:**
- [ ] File berhasil di-download
- [ ] Size mendekati 20KB
- [ ] Isi adalah PowerShell script (starts dengan `#`)
- [ ] Contain webhost URL

---

### **STEP 4: UPLOAD KE WEBHOST (10 min)**

Ketika sudah test di local dan OK, upload ke webhost:

```bash
# 1. SSH to webhost
ssh user@tracker.lppmunud.id

# 2. Navigate
cd /home/lppmunu1/public_html/tracker.lppmunud.id

# 3. Backup existing files (if you want)
cp dashboard/installer.php dashboard/installer.php.backup
cp api/index.php api/index.php.backup

# 4. Upload files (dari local machine)
scp dashboard/installer.php user@tracker.lppmunud.id:/home/lppmunu1/public_html/tracker.lppmunud.id/dashboard/

scp api/controllers/InstallerController.php user@tracker.lppmunud.id:/home/lppmunu1/public_html/tracker.lppmunud.id/api/controllers/

scp api/index.php user@tracker.lppmunud.id:/home/lppmunu1/public_html/tracker.lppmunud.id/api/

# 5. Verify files uploaded
ssh user@tracker.lppmunud.id
ls -la /home/lppmunu1/public_html/tracker.lppmunud.id/dashboard/installer.php
ls -la /home/lppmunu1/public_html/tracker.lppmunud.id/api/controllers/InstallerController.php
ls -la /home/lppmunu1/public_html/tracker.lppmunud.id/api/index.php

# 6. Set permissions
chmod 644 /home/lppmunu1/public_html/tracker.lppmunud.id/dashboard/installer.php
chmod 644 /home/lppmunu1/public_html/tracker.lppmunud.id/api/controllers/InstallerController.php
chmod 644 /home/lppmunu1/public_html/tracker.lppmunud.id/api/index.php

# 7. Verify permissions
ls -la /home/lppmunu1/public_html/tracker.lppmunud.id/dashboard/installer.php
# Should show: -rw-r--r-- or similar
```

---

### **STEP 5: TEST WEBHOST (10 min)**

Setelah upload, test di webhost:

```bash
# 1. Test web interface
curl http://tracker.lppmunud.id/dashboard/installer.php | head -50
# Should return HTML, not error

# 2. Test script download
curl http://tracker.lppmunud.id/dashboard/installer.php?action=api&do=get-installer-script | head -20
# Should return PowerShell script lines

# 3. Test API config endpoint
curl http://tracker.lppmunud.id/api/installer?action=config
# Should return JSON

# 4. View in browser
# http://tracker.lppmunud.id/dashboard/installer.php
# Verify page loads with all UI elements
```

**Expected outputs:**
```
✅ HTML page loads
✅ PowerShell script downloads
✅ API returns JSON
✅ No 404 errors
✅ No PHP errors
```

---

### **STEP 6: TEST INSTALLATION (20 min)**

Sekarang test full installation cycle:

```powershell
# On a Windows 10/11 target PC (jangan di XAMPP machine)

# 1. Open PowerShell as Administrator
# Press: Win+X → Select "Windows PowerShell (Admin)"

# 2. Navigate to Downloads
cd $env:USERPROFILE\Downloads

# 3. Download installer script
$url = "http://tracker.lppmunud.id/dashboard/installer.php?action=api&do=get-installer-script"
Invoke-WebRequest -Uri $url -OutFile "PCMonitor-Install.ps1" -Verbose

# 4. Allow script execution
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Verbose

# 5. Run installation script
.\PCMonitor-Install.ps1 -Verbose

# Wait for completion...
# Should see:
# ✅ Administrator check
# ✅ System requirements check
# ✅ System info collection
# ✅ Download progress
# ✅ Installation progress
# ✅ Service creation
# ✅ Agent registration
# ✅ Success summary with Agent ID
```

**Monitor progress:**
```
Expected output:
────────────────────────────────────────
[10:30:45] [INFO] Running as Administrator
[10:30:46] [INFO] Checking system requirements...
[10:30:47] [SUCCESS] .NET version: 6.0.12
[10:30:50] [INFO] Collecting system information...
[10:30:52] [SUCCESS] Computer: DESKTOP-ABC123 | MAC: 00:1A:2B:3C:4D:5E
[10:30:55] [INFO] Downloading agent files...
[10:31:15] [SUCCESS] Downloaded: C:\temp\PCMonitor.zip
[10:31:20] [SUCCESS] Extracted agent files
[10:31:25] [INFO] Installing agent to: C:\Program Files\PCMonitor
[10:31:30] [SUCCESS] Files copied
[10:31:35] [INFO] Installing Windows Service...
[10:31:40] [SUCCESS] Service created: PCMonitorAgent
[10:31:45] [SUCCESS] Service started
[10:31:50] [INFO] Registering agent with server...
[10:31:55] [SUCCESS] Agent registered successfully
[10:31:56] [SUCCESS] Agent ID: AGENT-ABC12345
[10:32:00] [INFO] Testing service...
[10:32:05] [SUCCESS] Service is running

════════════════════════════════════════
║      INSTALLATION COMPLETED          ║
════════════════════════════════════════
Service Name     : PCMonitorAgent
Install Path     : C:\Program Files\PCMonitor
Status           : Running
Agent ID         : AGENT-ABC12345
Webhost URL      : http://tracker.lppmunud.id
View in Dashboard: http://tracker.lppmunud.id/dashboard/agents
────────────────────────────────────────
```

---

### **STEP 7: VERIFY IN DASHBOARD (5 min)**

Setelah installation selesai:

```
1. Open browser
   http://tracker.lppmunud.id/dashboard/agents

2. Verify agent appears
   Should see new entry with:
   ✅ Computer Name: DESKTOP-ABC123
   ✅ MAC Address: 00:1A:2B:3C:4D:5E
   ✅ OS: Windows 11
   ✅ CPU: Intel Core i7
   ✅ RAM: 16 GB
   ✅ Status: Active (green)
   ✅ Last Seen: Just now

3. Check database
   mysql> SELECT * FROM agents WHERE agent_id LIKE 'AGENT-%' ORDER BY created_at DESC LIMIT 1;
   
   Should show:
   - agent_id: AGENT-ABC12345
   - computer_name: DESKTOP-ABC123
   - mac_address: 00:1A:2B:3C:4D:5E
   - status: active
   - created_at: current timestamp
```

---

### **STEP 8: VERIFY DATA FLOW (10 min)**

Check kalau agent mengirim data:

```
1. Check screenshots
   Dashboard → Agents → Select agent → Screenshots
   Should see: Screenshot from target PC captured

2. Check activities
   Dashboard → Agents → Select agent → Activities
   Should see: Running processes, activities logged

3. Check applications
   Dashboard → Agents → Select agent → Applications
   Should see: List of running applications

4. Check system info
   Dashboard → Agents → Select agent → Details
   Should see: CPU, RAM, network info updated
```

---

## 🛠️ TROUBLESHOOTING QUICK GUIDE

### **Issue: Installer page shows 404**
```
Cause: File not uploaded correctly
Fix:
1. Check file exists: ls -la /path/to/installer.php
2. Check permissions: -rw-r--r-- (644)
3. Re-upload file
4. Clear browser cache (Ctrl+F5)
```

### **Issue: Script won't download**
```
Cause: API endpoint not working
Fix:
1. Verify InstallerController.php uploaded
2. Verify api/index.php updated
3. Check webhost error logs: tail -f /var/log/apache2/error.log
4. Test endpoint: curl http://tracker.lppmunud.id/api/installer?action=config
```

### **Issue: Installation fails - .NET not found**
```
Cause: .NET SDK not installed on target PC
Fix:
1. Download: https://dotnet.microsoft.com/download
2. Install .NET 6.0 SDK (NOT runtime)
3. Restart PowerShell
4. Try installation again
```

### **Issue: Service won't start**
```
Cause: Various - check logs
Fix:
1. Check service status: Get-Service -Name PCMonitorAgent
2. Check logs: C:\Program Files\PCMonitor\logs\*
3. Try manual run: cd C:\Program Files\PCMonitor
4. Run: .\PCMonitorAgent.exe debug
5. Share output in support request
```

### **Issue: Agent not appearing in dashboard**
```
Cause: Registration might have failed
Fix:
1. Wait 30-60 seconds
2. Refresh dashboard
3. Check database: SELECT * FROM agents WHERE mac_address = 'XX:XX:...'
4. Check webhost logs for registration POST
5. Verify network connectivity from PC to webhost
```

---

## ✅ COMPLETE CHECKLIST

Before you start:
- [ ] Local files verified to exist
- [ ] Test local (XAMPP) successful
- [ ] Script generation works local
- [ ] Have webhost SSH credentials ready
- [ ] Have Windows 10/11 test PC ready
- [ ] Target PC has internet connectivity

During upload:
- [ ] Files backed up on webhost
- [ ] Files uploaded successfully
- [ ] Permissions set correctly (644)
- [ ] No upload errors

During webhost testing:
- [ ] Web interface loads
- [ ] Script downloads
- [ ] API endpoints respond
- [ ] No errors in logs

During installation:
- [ ] Script runs with admin
- [ ] System requirements validated
- [ ] Files downloaded
- [ ] Service created
- [ ] Agent registered
- [ ] Installation completed successfully

After installation:
- [ ] Agent appears in dashboard
- [ ] Status shows "Active"
- [ ] System info correct
- [ ] Screenshots captured
- [ ] Activities logged
- [ ] All features working

---

## 📞 SUPPORT TICKETS TEMPLATE

Jika ada issue, provide ini:

```
ISSUE: [Brief description]

ENVIRONMENT:
- Windows Version: [10/11]
- .NET Version: [dotnet --version output]
- Webhost: tracker.lppmunud.id
- Date/Time: [When issue occurred]

STEPS TO REPRODUCE:
1. ...
2. ...
3. ...

ERROR MESSAGE:
[Paste full error]

EXPECTED:
[What should happen]

ACTUAL:
[What actually happened]

LOGS:
[Paste relevant logs]
```

---

## 🚀 NEXT STEPS (After this phase succeeds)

### **Phase 2: Scale Rollout**
```
✅ Pilot: 5-10 PCs (CURRENT - THIS PHASE)
→ Phase 2: Department (50-100 PCs)
→ Phase 3: Company-wide (1000+ PCs)
```

### **Phase 3: C# Agent Development**
```
After installer proven to work:
→ Implement 5 features in C#:
  1. Screenshot Service
  2. Application Monitoring
  3. Bandwidth Limiting
  4. Shutdown Handler
  5. Media Social Detection
```

### **Phase 4: Integration Testing**
```
After C# implementation:
→ Test all 5 features end-to-end
→ Performance testing
→ Load testing
→ Security audit
```

---

## 📊 ESTIMATED TIMELINE

```
Now:     Upload files (10 min)
         ↓
+10min:  Test local (10 min)
         ↓
+20min:  Test webhost (10 min)
         ↓
+30min:  Test installation (20 min)
         ↓
+50min:  Verify dashboard (5 min)
         ↓
+55min:  Verify data flow (10 min)
         ↓
+65min:  Troubleshooting (if needed)
         ↓
~75min:  **COMPLETE & READY** ✅
```

---

## 🎯 DECISION POINTS

At each step, decide:

1. **After LOCAL test:**
   - ✅ PASS → Continue to upload
   - ❌ FAIL → Debug local, check files

2. **After WEBHOST upload:**
   - ✅ PASS → Continue to webhost test
   - ❌ FAIL → Re-upload, check permissions

3. **After WEBHOST test:**
   - ✅ PASS → Continue to installation test
   - ❌ FAIL → Check API logs, review controller

4. **After INSTALLATION test:**
   - ✅ PASS → Verify in dashboard
   - ❌ FAIL → Check script output, read logs

5. **After DASHBOARD verify:**
   - ✅ PASS → Production ready! 🎉
   - ❌ FAIL → Check registration, database

---

## 📝 NOTES

- Save all outputs/screenshots for documentation
- Keep track of any errors for future reference
- Document time taken for each step
- Note any customizations needed
- Create FAQ from issues encountered

---

**READY TO START?**

Next step: STEP 1 - Verify local files exist

Tell me when you're ready! 🚀

