# 🎯 COMPLETE DEPLOYMENT PACKAGE - READY TO UPLOAD

**Status:** ✅ **PRODUCTION READY**  
**Date:** March 28, 2026  
**Total Size:** ~150-200MB (including C# binaries)  
**Upload Time:** 30-45 minutes  

---

## 📦 WHAT'S INCLUDED IN THIS PACKAGE

This complete package contains:
- ✅ **PHP Web System** (online monitoring dashboard)
- ✅ **C# Agent/Installer** (Windows service that runs on target PCs)
- ✅ **Database Schema** (MySQL tables needed)
- ✅ **Configuration Files** (template with credential placeholders)
- ✅ **Installation Scripts** (PowerShell automation)
- ✅ **Documentation** (setup & troubleshooting)

---

## 📋 COMPLETE FILE INVENTORY

### **1. PHP FILES - ONLINE SYSTEM** (Upload as-is to webhost)

#### **Dashboard Views** (User Interface)
```
dashboard/
├── index.php                    ✅ Main dashboard home
├── login.php                    ✅ Authentication
├── logout.php                   ✅ Logout handler
├── installer.php                ✅ [NEW] Web-based installer
├── assets/
│   ├── css/                     ✅ Styling files
│   ├── js/                      ✅ JavaScript functionality
│   └── images/                  ✅ Logo, icons, etc
├── views/
│   ├── agents-list.php          ✅ Agent monitoring
│   ├── agent-detail.php         ✅ Individual agent details
│   ├── screenshots.php          ✅ Screenshot viewer
│   ├── activities.php           ✅ Activity log
│   ├── bandwidth.php            ✅ Bandwidth monitor
│   ├── applications.php         ✅ Running apps monitor
│   └── settings.php             ✅ User settings
├── controllers/
│   ├── DashboardController.php  ✅ Main logic
│   ├── AgentViewController.php   ✅ Agent display logic
│   ├── BandwidthViewController.php ✅ Bandwidth logic
│   ├── ActivityViewController.php ✅ Activity display logic
│   ├── CommandViewController.php ✅ Command execution UI
│   └── DashboardIntegration.php ✅ Integration layer
├── config/
│   ├── dashboard-config.php     ⚙️ Dashboard settings
│   └── theme.php                ⚙️ UI theme variables
└── .htaccess                    ✅ Apache rewrite rules
```

#### **API Endpoints** (Backend services)
```
api/
├── index.php                    ✅ Main API router
├── controllers/
│   ├── AgentController.php      ✅ Agent registration/status
│   ├── ActivityController.php   ✅ Activity logging
│   ├── ApplicationsController.php ✅ Application monitoring
│   ├── ApplicationMonitorController.php ✅ App data handler
│   ├── CommandController.php    ✅ Remote commands
│   ├── ScreenshotController.php ✅ Screenshot API
│   ├── MediaSocialController.php ✅ Media detection API
│   └── InstallerController.php  ✅ [NEW] Installation API
├── models/
│   └── ApiModels.php            ✅ Data models
├── config/
│   ├── api-config.php           ⚙️ API settings
│   └── routes.php               ✅ Route definitions
└── .htaccess                    ✅ REST API routes
```

#### **Configuration Files** (Update these with your credentials)
```
config/
├── EnvironmentHelper.php        ⚙️ Environment variable handler
├── DatabaseConfig.php           ⚙️ [⭐ UPDATE] DB credentials
└── ApiConfig.php                ⚙️ [⭐ UPDATE] API settings
```

#### **Environment Variables** (Template files - fill in your values)
```
.env.webhost                     ⭐ [UPDATE] Webhost credentials
                                  ├── DB_HOST
                                  ├── DB_USER
                                  ├── DB_PASS
                                  ├── DB_NAME
                                  ├── API_KEY
                                  ├── JWT_SECRET
                                  └── WEBHOST_URL

.env.local (for reference)       📖 Local development settings
```

#### **Database** (MySQL schema and setup)
```
database/
├── schema.sql                   ✅ Table definitions
├── agents-table.sql             ✅ Agents table
├── activities-table.sql         ✅ Activities log
├── audit-log-table.sql          ✅ Audit log
├── applications-table.sql       ✅ Applications monitoring
├── bandwidth-table.sql          ✅ Bandwidth data
├── media-social-table.sql       ✅ Media detection data
└── fix_admin_password.sql       ✅ Admin user setup
```

---

### **2. C# AGENT FILES - INSTALLER & MONITORING SERVICE** (Cross-platform)

#### **C# Project Structure**
```
agent-csharp/
├── PCMonitorAgent.csproj        ✅ Project file
├── Program.cs                   ✅ Main entry point
├── appsettings.json             ⚙️ [⭐ UPDATE] Agent config
├── appsettings.production.json  ⚙️ [⭐ UPDATE] Production config
│
├── Services/                    🔧 Core Services
│   ├── ActivityMonitor.cs       ✅ Tracks user activities
│   ├── ProcessMonitor.cs        ✅ Monitors running processes
│   ├── SystemInfoMonitor.cs     ✅ Collects system information
│   ├── BandwidthController.cs   ✅ Bandwidth limiting
│   └── CommandExecutor.cs       ✅ Remote command execution
│
├── Models/
│   └── AgentModels.cs           ✅ Data structures
│
├── Installers/
│   └── ServiceInstaller.cs      ✅ Windows Service installer
│
├── bin/
│   ├── Release/
│   │   ├── net6.0/              📦 Compiled binaries (ready to run)
│   │   └── publish/             📦 Published output (.zip)
│   └── Debug/                   🔍 Debug builds
│
├── Build Scripts/
│   ├── BUILD.bat                🔨 Build script
│   ├── BUILD_CLEAN.bat          🧹 Clean build
│   ├── INSTALL.bat              ⚙️ Install service
│   ├── install-service.ps1      ⚙️ PowerShell installer
│   └── Install-Service-Fixed.ps1 ⚙️ Fixed installer version
│
├── obj/                         🗑️ Temp build files (ignore)
└── Configuration/
    ├── config.json              ⚙️ Development config
    ├── config.local.json        ⚙️ Local environment
    └── config.production.json   ⚙️ [⭐ UPDATE] Production settings
```

---

### **3. INSTALLATION & DEPLOYMENT SCRIPTS**

#### **Automation Scripts for Setup**
```
/tracker/ root
├── EXECUTE_NOW.md               📖 8-step execution guide
├── DEPLOYMENT_ACTION_PLAN.md    📖 Detailed deployment steps
├── upload-helper.ps1            🔨 PowerShell upload script
├── CREATE_UPLOAD_FOLDER.bat     🔨 Create folder structure
├── setup.php                    ⚙️ Web-based setup wizard
├── diagnostics.php              🔍 System diagnostics check
└── README.md                    📖 Project overview
```

---

## ⭐ CREDENTIAL FILES - MUST UPDATE BEFORE USE

These files contain placeholder values. **You MUST update them** with your actual credentials:

### **1. Database Credentials** → Update with your MySQL info
```
File: config/DatabaseConfig.php
Update:
├── DB_HOST = "localhost" or your DB host IP
├── DB_USER = your database username
├── DB_PASS = your database password
└── DB_NAME = "lppmunu1_tracker" (or your DB name)
```

### **2. Environment Variables** → Update with webhost details
```
File: .env.webhost
Update:
├── DB_HOST=your_db_host
├── DB_USER=your_db_user
├── DB_PASSWORD=your_db_password
├── DB_DATABASE=your_database_name
├── JWT_SECRET=generate_random_key_here
├── WEBHOST_URL=http://tracker.lppmunud.id
├── API_PORT=443 (or appropriate port)
└── TIMEZONE=Asia/Jakarta
```

### **3. C# Agent Configuration** → Update with webhost URL
```
File: agent-csharp/config.production.json
Update:
├── WebhostURL: "http://tracker.lppmunud.id"
├── ApiEndpoint: "http://tracker.lppmunud.id/api"
├── InstallerPath: "C:\Program Files\PCMonitor"
├── ServiceName: "PCMonitorAgent"
├── RefreshRate: 30000 (milliseconds)
└── LogDirectory: "C:\ProgramData\PCMonitor\logs"
```

### **4. API Configuration** → Update JWT tokens
```
File: api/config/api-config.php
Update:
├── API_KEY = your_secure_api_key
├── JWT_SECRET = generate_random_key
├── ENCRYPTION_KEY = another_random_key
└── RATE_LIMIT = 1000 (requests per hour)
```

---

## 📊 FILE STRUCTURE SUMMARY

```
Total Package:
├── PHP Files:              ~2.5 MB
├── C# Source Code:         ~1.2 MB
├── C# Compiled Binaries:   ~50-80 MB
├── Documentation:          ~5 MB
├── Database Scripts:       ~0.5 MB
└── Configuration:          ~0.2 MB
                           ─────────
Total:                     ~60-90 MB
```

**After webhost upload:**
```
tracker.lppmunud.id/
├── /dashboard/              → PHP views (online UI)
├── /api/                    → API endpoints
├── /config/                 → Configuration files
├── /database/               → Database scripts
├── /agent-csharp/           → C# installer package
├── /uploads/                → Agent downloads
└── /logs/                   → System logs
```

---

## 🚀 DEPLOYMENT STEPS - HIGH LEVEL

### **PHASE 1: UPLOAD (30-45 minutes)**

```
Step 1: Prepare credentials
   ✅ Update .env.webhost with DB details
   ✅ Update config.json with webhost URL
   ✅ Generate new JWT_SECRET
   ✅ Update database connection strings

Step 2: ZIP entire /tracker/ folder
   ✅ Create: tracker-deployment.zip (~60-90MB)
   ✅ Verify file integrity
   ✅ Note down file size

Step 3: Upload to webhost
   ✅ Using SCP: scp tracker-deployment.zip user@tracker.lppmunud.id:/tmp/
   ✅ OR WinSCP: Drag-drop to /tmp/ folder
   ✅ Verify upload completed (compare checksums)

Step 4: Extract on webhost
   ✅ SSH: unzip /tmp/tracker-deployment.zip -d /home/lppmunu1/public_html/
   ✅ Verify folder structure: ls -la /home/lppmunu1/public_html/tracker/
   ✅ Set permissions: chmod -R 755 /home/lppmunu1/public_html/tracker/

Step 5: Update webhost credentials
   ✅ SSH into webhost
   ✅ Edit: /home/lppmunu1/public_html/tracker/.env.webhost
   ✅ Update with actual webhost DB credentials
   ✅ Verify file ownership: chown -R www-data:www-data tracker/

Step 6: Import database schema
   ✅ SSH: mysql -u lppmunu1_tracker -p < database/schema.sql
   ✅ Verify tables created: mysql lppmunu1_tracker -e "SHOW TABLES;"
   ✅ Check admin user: mysql lppmunu1_tracker -e "SELECT * FROM users LIMIT 1;"
```

### **PHASE 2: VERIFY ONLINE SYSTEM (15 minutes)**

```
Step 1: Test PHP system
   ✅ Open: http://tracker.lppmunud.id/
   ✅ Should see: Login page
   ✅ Login with: admin / password

Step 2: Test API
   ✅ GET: http://tracker.lppmunud.id/api/status
   ✅ Should return: JSON response

Step 3: Test installer interface
   ✅ Open: http://tracker.lppmunud.id/dashboard/installer.php
   ✅ Should see: Beautiful installer interface
   ✅ Click "Download" button
   ✅ Should download: PowerShell script
```

### **PHASE 3: TEST ON TARGET PC (20 minutes)**

```
Step 1: Copy PowerShell script
   ✅ Download from: http://tracker.lppmunud.id/dashboard/installer.php?action=api&do=get-installer-script
   ✅ Save as: PCMonitor-Install.ps1

Step 2: Run installation
   ✅ Open: PowerShell (as Administrator)
   ✅ Run: .\PCMonitor-Install.ps1
   ✅ Wait for completion (~5 minutes)

Step 3: Verify installation
   ✅ Service running: Get-Service PCMonitorAgent
   ✅ Status should be: Running
   ✅ Check dashboard: http://tracker.lppmunud.id/dashboard/agents
   ✅ New agent should appear in list
```

---

## 🔐 SECURITY CHECKLIST

Before going production:

- [ ] **Database Password:** Changed from default
- [ ] **JWT Secret:** Generated with secure random string (min 32 chars)
- [ ] **API Key:** Created and documented
- [ ] **.env file:** Not readable from web (only server-side)
- [ ] **Admin Password:** Changed from default
- [ ] **HTTPS:** Enabled on webhost (Let's Encrypt)
- [ ] **File Permissions:** Set correctly (644 for files, 755 for directories)
- [ ] **Firewall:** Configured to allow only needed ports (80, 443)
- [ ] **Backup:** Database backed up
- [ ] **Logs:** Created and logging enabled

---

## ✅ VERIFICATION CHECKLIST

After upload, verify:

### **PHP System**
- [ ] Dashboard loads without errors
- [ ] Login works
- [ ] All UI pages accessible
- [ ] API responds to requests
- [ ] Database connected successfully
- [ ] Screenshots captured properly
- [ ] Activities logged
- [ ] Bandwidth monitoring shows data
- [ ] No error messages in browser console

### **C# Agent**
- [ ] Script downloads from installer page
- [ ] Installation runs without admin errors
- [ ] Service installs and starts
- [ ] Service appears in Windows Services
- [ ] Agent registers in database
- [ ] Agent appears in dashboard
- [ ] System info correct
- [ ] Data updates in real-time

### **End-to-End**
- [ ] Add new PC via installer
- [ ] PC shows up in dashboard within 30 seconds
- [ ] Real-time monitoring working
- [ ] Screenshot capture working
- [ ] Application list updating
- [ ] Bandwidth limiting working
- [ ] Remote commands executing

---

## 📞 CREDENTIAL GENERATION GUIDE

### **Generate Secure JWT Secret**

```powershell
# On Windows 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 and use in .env.webhost
```

### **Generate API Key**

```powershell
# Generate random API key
$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"
```

---

## 🔧 HOW TO USE THIS PACKAGE

### **Option A: Quick Upload (Recommended)**

```bash
# On your local machine
# 1. Setup credentials (see steps below)
# 2. ZIP the entire folder
# 3. Upload to webhost
# 4. Extract and set permissions

cd e:\xampp\htdocs
Compress-Archive -Path tracker -DestinationPath tracker-deployment.zip -Force

# Copy to webhost
scp tracker-deployment.zip user@tracker.lppmunud.id:/tmp/

# On webhost, extract
ssh user@tracker.lppmunud.id
cd /home/lppmunu1/public_html
unzip /tmp/tracker-deployment.zip
chmod -R 755 tracker/
chown -R www-data:www-data tracker/
```

### **Option B: Selective Upload (For updates)**

```bash
# Upload only changed files
# Dashboard updates
scp dashboard/*.php user@track.lppmunud.id:/home/lppmunu1/public_html/tracker/dashboard/

# API updates
scp api/controllers/*.php user@tracker.lppmunud.id:/home/lppmunu1/public_html/tracker/api/controllers/

# C# updates
scp agent-csharp/bin/Release/net6.0/publish/* user@tracker.lppmunud.id:/tmp/agent-update/
```

### **Option C: Synchronized Upload (Using rsync)**

```bash
# One-way sync (upload all changes)
rsync -avz --delete tracker/ user@tracker.lppmunud.id:/home/lppmunu1/public_html/tracker/

# Add --exclude to skip files
rsync -avz --exclude='*.git' --exclude='bin' --exclude='obj' tracker/ user@tracker.lppmunud.id:/home/lppmunu1/public_html/tracker/
```

---

## 📋 PRE-UPLOAD CHECKLIST

Before uploading to webhost:

### **Files to Check:**

- [ ] **.env.webhost** exists and has template values
- [ ] **config.json** exists in agent-csharp folder
- [ ] **appsettings.production.json** exists
- [ ] **database/schema.sql** exists and has all tables
- [ ] **dashboard/installer.php** uploaded and tested locally
- [ ] **api/index.php** updated with InstallerController routes
- [ ] **api/controllers/InstallerController.php** present
- [ ] All **8 API controllers** present
- [ ] All **6 dashboard controllers** present
- [ ] **C# project builds successfully** (dotnet build works)
- [ ] **No syntax errors** in PHP files
- [ ] **No compilation errors** in C# files
- [ ] **All dependencies listed** in requirements
- [ ] **Documentation updated** with correct URLs

### **Folders to Verify:**

```
/tracker/
├── /dashboard/          ✅ All views present
├── /api/               ✅ All controllers present
├── /agent-csharp/      ✅ C# project complete
├── /database/          ✅ SQL scripts ready
├── /config/            ✅ Config templates ready
└── /docs/              ✅ Documentation complete
```

---

## 🎯 NEXT STEPS

### **Step 1: Prepare Credentials**
- [ ] Edit `.env.webhost` with your DB details
- [ ] Edit `config.production.json` with webhost URL
- [ ] Generate new JWT_SECRET and API_KEY
- [ ] Update all placeholder values

### **Step 2: Build C# Project**
```
cd e:\xampp\htdocs\tracker\agent-csharp
dotnet build -c Release
dotnet publish -c Release -o bin/Release/net6.0/publish
```

### **Step 3: Create Deployment ZIP**
```powershell
$source = "e:\xampp\htdocs\tracker"
$dest = "e:\xampp\htdocs\tracker-deployment.zip"
Compress-Archive -Path $source -DestinationPath $dest -Force
```

### **Step 4: Upload and Extract**
```bash
scp e:\xampp\htdocs\tracker-deployment.zip user@tracker.lppmunud.id:/tmp/
ssh user@tracker.lppmunud.id
cd /home/lppmunu1/public_html
unzip /tmp/tracker-deployment.zip
```

### **Step 5: Set Permissions**
```bash
chmod -R 755 tracker/
chmod -R 644 tracker/config/
chmod 600 tracker/.env.webhost
chown -R www-data:www-data tracker/
```

### **Step 6: Import Database**
```bash
mysql -u lppmunu1_tracker -p lppmunu1_tracker < tracker/database/schema.sql
```

### **Step 7: Test Installation**
```
1. Open: http://tracker.lppmunud.id/
2. Login: admin / password
3. Download installer script
4. Run on target PC
```

---

## 📞 FILE STRUCTURE AFTER UPLOAD

```
tracker.lppmunud.id structure:
/home/lppmunu1/public_html/tracker/
│
├── dashboard/               → Web UI (load at http://tracker.lppmunud.id/dashboard/)
│   ├── index.php
│   ├── login.php
│   ├── installer.php        ← Users download script from here
│   ├── views/
│   ├── controllers/
│   ├── assets/
│   └── config/
│
├── api/                     → API endpoints (POST/GET at /api/)
│   ├── index.php
│   ├── controllers/         ← 8 controllers
│   ├── models/
│   └── config/
│
├── agent-csharp/            → C# installer files
│   ├── bin/Release/         ← Compiled agent .exe
│   ├── config.production.json
│   └── ... (source files)
│
├── uploads/                 → Downloaded scripts & ZIPs
│   └── agent-releases/
│
├── logs/                    → Application logs
│   ├── api.log
│   ├── installer.log
│   └── errors.log
│
├── config/                  → Configuration files
│   ├── DatabaseConfig.php   ← [⭐ Credentials here]
│   └── api-config.php
│
├── database/                → SQL scripts
│   ├── schema.sql
│   └── ... (table scripts)
│
├── .env.webhost            ← [⭐ Fill with credentials]
│
└── (documentation files)
```

---

## ✅ READY TO DEPLOY?

This package includes **EVERYTHING** needed:

✅ **PHP Web System**
- Dashboard UI (7 views + 6 controllers)
- API endpoints (8 controllers)
- Database schema (10 tables)
- Web-based installer interface
- Configuration management

✅ **C# Agent/Installer**
- Windows Service installer
- Monitoring services (5 types)
- Auto-registration with server
- PowerShell installation script
- Configuration management

✅ **Security**
- Database credential protection
- JWT token authentication
- API key validation
- Input validation & sanitization
- Audit logging

✅ **Installation Automation**
- One-click installer for target PCs
- Automated service setup
- Auto-registration in dashboard
- Health monitoring

---

## 🚀 LET'S DEPLOY!

**Are you ready to:**
1. Update credentials?
2. ZIP and upload to webhost?
3. Extract and set permissions?
4. Import database schema?
5. Test on target PC?

**Proceed with STEP 1 below when ready!**

---

## IMPLEMENTATION STEPS

### **STEP 1: PREPARE LOCAL CREDENTIALS** (10 min)

Open and edit these files in your local `/tracker/` folder:

**File 1: `.env.webhost`**
```
# Open with: Notepad or VS Code
# Path: e:\xampp\htdocs\tracker\.env.webhost

DB_HOST=your_database_host
DB_USER=your_database_username
DB_PASSWORD=your_database_password
DB_DATABASE=your_database_name

API_KEY=generate_random_key_here     (use script above)
JWT_SECRET=generate_random_key_here  (use script above)

WEBHOST_URL=http://tracker.lppmunud.id
WEBHOST_SSL=true (if https available)

TIMEZONE=Asia/Jakarta
ENVIRONMENT=production
DEBUG=false
```

**File 2: `agent-csharp/config.production.json`**
```json
{
  "WebhostURL": "http://tracker.lppmunud.id",
  "ApiEndpoint": "http://tracker.lppmunud.id/api",
  "InstallerPath": "C:\\Program Files\\PCMonitor",
  "ServiceName": "PCMonitorAgent",
  "RefreshRate": 30000,
  "LogDirectory": "C:\\ProgramData\\PCMonitor\\logs"
}
```

**File 3: `config/DatabaseConfig.php`**
```php
<?php
define('DB_HOST', 'your_database_host');
define('DB_USER', 'your_database_username');
define('DB_PASS', 'your_database_password');
define('DB_NAME', 'your_database_name');
```

---

### **STEP 2: BUILD C# PROJECT** (10 min)

```powershell
# Navigate to C# folder
cd e:\xampp\htdocs\tracker\agent-csharp

# Build project
dotnet build -c Release

# Publish for distribution
dotnet publish -c Release -o bin/Release/net6.0/publish

# Verify output
ls bin/Release/net6.0/publish | wc -l
# Should show: ~20+ files created
```

---

### **STEP 3: CREATE DEPLOYMENT ZIP** (5 min)

```powershell
# ZIP the entire tracker folder
$source = "e:\xampp\htdocs\tracker"
$dest = "e:\xampp\htdocs\tracker-deployment.zip"

Remove-Item $dest -ErrorAction SilentlyContinue
Compress-Archive -Path $source -DestinationPath $dest -Force -Verbose

# Verify ZIP created
Get-Item $dest | Select-Object Name, @{N='Size(MB)';E={[math]::round($_.Length/1MB,2)}}

# Output should show: ~60-90 MB
```

---

### **STEP 4: UPLOAD TO WEBHOST** (30 min)

**Using PowerShell (Windows):**
```powershell
# Define connection
$sshHost = "tracker.lppmunud.id"
$sshUser = "username_from_webhost"  # ⭐ Replace
$sshPass = "password_from_webhost"  # ⭐ Replace
$localZip = "e:\xampp\htdocs\tracker-deployment.zip"

# Upload using SCP
scp $localZip ${sshUser}@${sshHost}:/tmp/tracker-deployment.zip

# Verify upload (you'll be asked for password)
# scp -v ${sshUser}@${sshHost}:/tmp/tracker-deployment.zip $localZip.uploaded

Write-Host "Upload complete! Now SSH to extract..."
```

**Using WinSCP (Easier):**
```
1. Download: https://winscp.net/
2. Open WinSCP
3. Connect:
   - Hostname: tracker.lppmunud.id
   - Port: 22
   - Username: your_webhost_username
   - Password: your_webhost_password
4. Navigate: /tmp/
5. Drag-drop: tracker-deployment.zip
6. Wait for upload complete
7. Close WinSCP
```

---

### **STEP 5: EXTRACT ON WEBHOST** (15 min)

```bash
# SSH to webhost
ssh username@tracker.lppmunud.id

# Navigate to webroot
cd /home/your_username/public_html

# Backup existing tracker folder (if any)
mv tracker tracker.backup.$(date +%s)    # Creates: tracker.backup.1234567890

# Extract ZIP
unzip /tmp/tracker-deployment.zip

# Verify extraction
ls -la | grep tracker
# Should show: drwxr-xr-x  tracker

# Check contents
ls -la tracker/ | head -20
```

---

### **STEP 6: SET PERMISSIONS** (10 min)

```bash
# Set directory permissions (755 = rwxr-xr-x)
chmod -R 755 tracker/

# Set file permissions (644 = rw-r--r--)
find tracker -type f -exec chmod 644 {} \;

# Make .env file secure (600 = rw-------)
chmod 600 tracker/.env.webhost

# Set web server ownership
chown -R www-data:www-data tracker/

# Verify permissions
ls -la tracker/ | head -10
ls -la tracker/.env.webhost
# Should show: -rw------  (owner only can read/write)
```

---

### **STEP 7: UPDATE WEBHOST CREDENTIALS** (10 min)

```bash
# SSH into webhost
ssh username@tracker.lppmunud.id

# Edit .env.webhost with your webhost DB details
nano tracker/.env.webhost

# Update these values with your WEBHOST database info:
# DB_HOST = webhost database host (usually 'localhost' or IP)
# DB_USER = webhost database username (usually provided by hosting)
# DB_PASSWORD = webhost database password
# DB_DATABASE = webhost database name

# Save: Ctrl+O, Enter, Ctrl+X

# Verify file updated
cat tracker/.env.webhost | grep "^DB_"
```

---

### **STEP 8: IMPORT DATABASE SCHEMA** (10 min)

```bash
# SSH into webhost
ssh username@tracker.lppmunud.id

# Import database schema
mysql -u your_db_user -p your_db_name < /home/your_username/public_html/tracker/database/schema.sql

# You'll be prompted for password - enter your database password

# Verify tables created
mysql -u your_db_user -p your_db_name -e "SHOW TABLES;"

# Output should show:
# +-----------------------+
# | Tables_in_your_db     |
# +-----------------------+
# | activities            |
# | agents                |
# | audit_log             |
# | applications          |
# | bandwidth             |
# | commands              |
# | users                 |
# ... (more tables)
```

---

### **STEP 9: TEST ONLINE SYSTEM** (15 min)

```powershell
# Test 1: Web interface loads
$url = "http://tracker.lppmunud.id/dashboard/index.php"
Invoke-WebRequest -Uri $url -UseBasicParsing | Select-Object StatusCode, StatusDescription
# Expected: 200 OK

# Test 2: Installer page loads
$url = "http://tracker.lppmunud.id/dashboard/installer.php"
Invoke-WebRequest -Uri $url -UseBasicParsing | Select-Object StatusCode
# Expected: 200

# Test 3: download installer script
$url = "http://tracker.lppmunud.id/dashboard/installer.php?action=api&do=get-installer-script"
Invoke-WebRequest -Uri $url -OutFile C:\temp\test-installer.ps1
Get-Item C:\temp\test-installer.ps1
# Expected: File ~20KB

# Test 4: API endpoint
$url = "http://tracker.lppmunud.id/api/installer?action=config"
Invoke-RestMethod -Uri $url | ConvertTo-Json
# Expected: JSON response with config
```

---

### **STEP 10: TEST ON TARGET PC** (20 min)

On a Windows 10/11 PC (not your XAMPP server):

```powershell
# Open PowerShell as Administrator
# 1. Right-click Windows logo
# 2. Select "Windows PowerShell (Admin)"

# Navigate to Downloads
cd $env:USERPROFILE\Downloads

# Download installation script
$url = "http://tracker.lppmunud.id/dashboard/installer.php?action=api&do=get-installer-script"
Invoke-WebRequest -Uri $url -OutFile "PCMonitor-Install.ps1" -Verbose

# Allow script execution
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force

# Start installation
.\PCMonitor-Install.ps1 -Verbose

# Watch progress...
# Should complete in ~5-10 minutes

# After installation, verify service
Get-Service PCMonitorAgent
# Should show: Status: Running

# Open dashboard
start "http://tracker.lppmunud.id/dashboard/agents"
# New agent should appear in list
```

---

## 🎉 ALL STEPS COMPLETE!

When all 10 steps done:

✅ **System Deployed to Production**
- Web system live at http://tracker.lppmunud.id
- Database imported and connected
- API endpoints functional
- Installer interface ready
- First PC installed and registered
- Real-time monitoring working
- No more need to carry flashdisk - install via browser!

---

## 📊 DEPLOYMENT SUMMARY

| Step | Task | Duration | Status |
|------|------|----------|--------|
| 1 | Prepare credentials | 10 min | ⏳ TO DO |
| 2 | Build C# project | 10 min | ⏳ TO DO |
| 3 | Create deployment ZIP | 5 min | ⏳ TO DO |
| 4 | Upload to webhost | 30 min | ⏳ TO DO |
| 5 | Extract on webhost | 15 min | ⏳ TO DO |
| 6 | Set permissions | 10 min | ⏳ TO DO |
| 7 | Update credentials | 10 min | ⏳ TO DO |
| 8 | Import database | 10 min | ⏳ TO DO |
| 9 | Test online system | 15 min | ⏳ TO DO |
| 10 | Test on target PC | 20 min | ⏳ TO DO |
| | **TOTAL TIME** | **~145 minutes** | |

---

**Ready to start deployment? Begin with STEP 1! 🚀**

Need help? Check the documentation files:
- `EXECUTE_NOW.md` - Quick execution guide
- `DEPLOYMENT_ACTION_PLAN.md` - Detailed steps
- `WEB_INSTALLER_QUICK_START.md` - Installer info
