# 🎯 DEPLOYMENT QUICK REFERENCE - 10 CRITICAL FILES

**Print this page and keep nearby during deployment!**

---

## 📋 10 FILES YOU MUST UPDATE/CHECK

### **1️⃣ DATABASE CREDENTIALS** 
```
File: .env.webhost
Location: e:\xampp\htdocs\tracker\.env.webhost
Update: ✅ MUST FILL IN
Values needed:
├── DB_HOST = your webhost database hostname
├── DB_USER = database username (from hosting provider)
├── DB_PASSWORD = database password
└── DB_DATABASE = database name (usually lppmunu1_tracker)
Tip: Keep this file secret! Don't commit to git.
```

### **2️⃣ API CONFIGURATION**
```
File: api/config/api-config.php
Location: e:\xampp\htdocs\tracker\api\config\api-config.php
Update: ✅ MUST FILL IN
Values needed:
├── API_KEY = generate random 32-char string
├── JWT_SECRET = generate random 32-char string
└── ENCRYPTION_KEY = generate random 32-char string
How: Use the scripts at end of DEPLOYMENT_PACKAGE_COMPLETE.md
```

### **3️⃣ DATABASE CONFIG**
```
File: config/DatabaseConfig.php
Location: e:\xampp\htdocs\tracker\config\DatabaseConfig.php
Update: ✅ MUST FILL IN
Values needed:
├── DB_HOST = same as .env.webhost
├── DB_USER = same as .env.webhost
├── DB_PASS = same as .env.webhost
└── DB_NAME = same as .env.webhost
```

### **4️⃣ C# AGENT CONFIG (PRODUCTION)**
```
File: config.production.json
Location: e:\xampp\htdocs\tracker\agent-csharp\config.production.json
Update: ✅ MUST FILL IN
Values needed:
├── WebhostURL = "http://tracker.lppmunud.id"
├── ApiEndpoint = "http://tracker.lppmunud.id/api"
└── ServiceName = "PCMonitorAgent"
```

### **5️⃣ C# APPSETTINGS PRODUCTION**
```
File: appsettings.production.json
Location: e:\xampp\htdocs\tracker\agent-csharp\appsettings.production.json
Update: ✅ VERIFY VALUES
Values:
├── Logging settings
├── API endpoints
└── Connection strings
```

### **6️⃣ DASHBOARD CONFIG**
```
File: dashboard/config/dashboard-config.php
Location: e:\xampp\htdocs\tracker\dashboard\config\dashboard-config.php
Update: ✅ CHECK
Verify:
├── Theme is correct
├── Logo paths correct
└── Menu items visible
```

### **7️⃣ DATABASE SCHEMA**
```
File: database/schema.sql
Location: e:\xampp\htdocs\tracker\database\schema.sql
Update: ✅ NO CHANGES (use as-is)
Purpose: Create all MySQL tables
Action: Run on webhost with: mysql -u user -p db < schema.sql
```

### **8️⃣ INSTALLER CONTAINER**
```
File: dashboard/installer.php
Location: e:\xampp\htdocs\tracker\dashboard\installer.php
Update: ❌ NO CHANGES (already complete)
Purpose: Web-based installer interface for users
Status: Ready to use!
```

### **9️⃣ API ROUTER**
```
File: api/index.php
Location: e:\xampp\htdocs\tracker\api\index.php
Update: ❌ NO CHANGES (already updated with InstallerController)
Purpose: Routes API requests to correct controller
Status: Ready with 6 new installer endpoints!
```

### **🔟 INSTALLER CONTROLLER**
```
File: InstallerController.php
Location: e:\xampp\htdocs\tracker\api\controllers\InstallerController.php
Update: ❌ NO CHANGES (brand new, complete)
Purpose: Handles all installer API requests
Endpoints:
├── /api/installer?action=download-agent
├── /api/installer?action=get-config
├── /api/installer?action=register-agent
├── /api/installer?action=check-status
├── /api/installer?action=get-progress
└── /api/installer?action=get-requirements
Status: Production ready!
```

---

## 🔐 CREDENTIAL GENERATION

### **Generate JWT Secret (Random String)**

**Windows PowerShell:**
```powershell
$bytes = New-Object Byte[] 32
[System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
$secret = [System.Convert]::ToBase64String($bytes)
Write-Host "JWT_SECRET=$secret"
```

**Copy output → paste into .env.webhost**

---

### **Generate API Key**

**Windows PowerShell:**
```powershell
$length = 32
$charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
$random = new-object System.Random
$apikey = ""
for ($i = 0; $i -lt $length; $i++) {
    $apikey += $charset[$random.Next(0, $charset.length)]
}
Write-Host "API_KEY=$apikey"
```

**Copy output → paste into api/config/api-config.php**

---

## 📁 FOLDER STRUCTURE - KEY PATHS

```
e:\xampp\htdocs\tracker\           ← Root folder (upload entire folder to webhost)
│
├── dashboard/                      ← Web UI files
│   ├── index.php
│   ├── installer.php              ⭐ NEW - Users download script from here
│   ├── views/                      ← HTML pages
│   ├── controllers/                ← PHP logic
│   └── assets/                     ← CSS, JS, images
│
├── api/                            ← REST API
│   ├── index.php                  ⭐ UPDATED - Routes requests
│   └── controllers/                ← 8 PHP controllers
│       ├── InstallerController.php ⭐ NEW - Installer handler
│       ├── AgentController.php
│       ├── ActivityController.php
│       ├── CommandController.php
│       ├── ScreenshotController.php
│       ├── ApplicationsController.php
│       ├── ApplicationMonitorController.php
│       └── MediaSocialController.php
│
├── agent-csharp/                   ← C# Windows Service
│   ├── Program.cs
│   ├── PCMonitorAgent.csproj
│   ├── config.production.json     ⭐ UPDATE THIS
│   ├── appsettings.production.json
│   ├── Services/                   ← 5 monitoring services
│   │   ├── ActivityMonitor.cs
│   │   ├── ProcessMonitor.cs
│   │   ├── SystemInfoMonitor.cs
│   │   ├── BandwidthController.cs
│   │   └── CommandExecutor.cs
│   ├── Models/
│   │   └── AgentModels.cs
│   ├── bin/
│   │   └── Release/net6.0/publish/ ← Compiled .exe files
│   └── Installers/
│       └── ServiceInstaller.cs
│
├── config/                         ← Configuration
│   ├── DatabaseConfig.php          ⭐ UPDATE THIS
│   ├── ApiConfig.php               ⭐ UPDATE THIS
│   └── EnvironmentHelper.php
│
├── database/                       ← MySQL setup
│   ├── schema.sql                  ← All tables defined here
│   ├── agents-table.sql
│   ├── activities-table.sql
│   └── ... (10+ SQL files)
│
├── .env.webhost                    ⭐🔴 CRITICAL - UPDATE WITH YOUR CREDENTIALS
├── .env.local                      📖 Local reference (don't upload)
│
├── DEPLOYMENT_PACKAGE_COMPLETE.md  📖 This file!
├── DEPLOYMENT_ACTION_PLAN.md       📖 Step-by-step guide
├── EXECUTE_NOW.md                  📖 Quick execution guide
└── ... (documentation files)
```

---

## ✅ PRE-UPLOAD CHECKLIST

Before uploading to webhost, verify each file:

```
CREDENTIALS:
□ .env.webhost - DB_HOST, DB_USER, DB_PASSWORD filled in
□ config/DatabaseConfig.php - All 4 DB values filled in
□ api/config/api-config.php - API_KEY and JWT_SECRET filled in
□ agent-csharp/config.production.json - WebhostURL correct

FILES READY:
□ dashboard/installer.php - EXISTS (656 lines)
□ api/index.php - UPDATED with InstallerController routes
□ api/controllers/InstallerController.php - EXISTS (400+ lines)
□ database/schema.sql - Ready to import

C# BUILD:
□ C# project builds: dotnet build -c Release (no errors)
□ Publish works: dotnet publish -c Release (creates bin/Release/net6.0/publish/)
□ EXE files created: PCMonitorAgent.exe exists in publish folder

GENERAL:
□ No .git folders in deployment (remove if present)
□ No node_modules (not applicable here)
□ No unnecessary large files
□ All PHP files have no syntax errors
□ All C# files compile without errors
```

---

## 🚀 UPLOAD COMMAND (ONE LINE)

### **Using PowerShell:**

```powershell
# One-command upload (change username and password)
$source = "e:\xampp\htdocs\tracker"
$dest = "$source-deploy.zip"
Compress-Archive -Path $source -DestinationPath $dest -Force
Write-Host "Created: $dest"
# Then: scp $dest username@tracker.lppmunud.id:/tmp/
```

### **Using WinSCP GUI:**

```
1. Open WinSCP
2. Hostname: track.lppmunud.id | Port: 22
3. Username: [your webhost username]
4. Password: [your webhost password]
5. Connect
6. Navigate: /tmp/
7. Drag tracker.zip → Release
8. Done!
```

---

## 🔍 VERIFY AFTER UPLOAD

### **SSH Into Webhost:**

```bash
# SSH connection
ssh username@tracker.lppmunud.id

# Navigate
cd /home/username/public_html

# Extract (if uploaded as ZIP)
unzip /tmp/tracker.zip

# Verify files exist
ls -la tracker/dashboard/installer.php      # Should exist
ls -la tracker/api/controllers/*.php         # Should be 8 files
ls -la tracker/database/schema.sql           # Should exist
ls -la tracker/.env.webhost                  # Should exist (check permissions: 600)

# Import database
mysql -u db_user -p db_name < tracker/database/schema.sql

# Set permissions
chmod -R 755 tracker/
chmod 600 tracker/.env.webhost
chown -R www-data:www-data tracker/

# Test web
curl http://tracker.lppmunud.id/dashboard/installer.php | head -50
# Should return HTML (not error)
```

---

## 📞 FINAL CHECKLIST

**BEFORE DEPLOYMENT:**
- [ ] All credentials filled in ✅
- [ ] C# project builds successfully ✅
- [ ] No PHP syntax errors ✅
- [ ] Database schema prepared ✅
- [ ] ZIP file created ✅

**DURING DEPLOYMENT:**
- [ ] ZIP uploaded to webhost ✅
- [ ] Files extracted ✅
- [ ] Permissions set correctly ✅
- [ ] Database imported ✅
- [ ] Web interface loads ✅

**AFTER DEPLOYMENT:**
- [ ] Test login page loads ✅
- [ ] Test installer page loads ✅
- [ ] Test API endpoints ✅
- [ ] Download script from installer ✅
- [ ] Run script on target PC ✅
- [ ] Agent appears in dashboard ✅
- [ ] Data flowing in real-time ✅

---

## 🎉 YOU'RE READY!

This package has:
✅ Complete PHP web system with 8 API controllers
✅ Complete C# Windows Service with 5 monitoring features  
✅ Web-based browser installer
✅ Auto-registration system
✅ Real-time dashboard monitoring
✅ All database tables
✅ All configuration templates
✅ Complete documentation

**Upload to webhost → Done with flashdisks! 🎊**

---

**Questions? Check the documentation files:**
- `DEPLOYMENT_PACKAGE_COMPLETE.md` ← Detailed guide (this file)
- `DEPLOYMENT_ACTION_PLAN.md` ← Step by step
- `EXECUTE_NOW.md` ← Quick reference
- `WEB_INSTALLER_QUICK_START.md` ← Installer details
