# cPanel & VPS Deployment Guide
## Sheba OLT Monitoring System

Enterprise-Grade Multi-Vendor OLT Monitoring System built with Core PHP 8.2 + MySQL + SNMP/Telnet.

---

### Prerequisites
1. **PHP 8.2+** with the following extensions enabled:
   - `pdo_mysql`
   - `snmp` or `php-snmp`
   - `sockets`
   - `curl`
   - `json`
2. **MySQL 5.7+ / MariaDB 10.3+**
3. **cPanel Shared Hosting or VPS** with Cron Job access.

---

### Step 1: Upload Files to cPanel
1. Compress all files in this project directory into a `.zip` archive.
2. Upload to your cPanel File Manager inside `public_html` or a subdomain folder (e.g. `olt.yourdomain.com`).
3. Extract the zip file. The directory structure will look like:
   ```
   app/
     Controllers/
     Models/
     Services/
     Vendors/
     Snmp/
     Telnet/
     Helpers/
   config/
     database.php
     app.php
   cron/
     scheduler.php
     worker.php
     alarm-worker.php
     cleanup.php
   database/
     schema.sql
     sample_oid_profiles.json
   public/
     index.php
     install.php
     api.php
   storage/
   ```

---

### Step 2: Database Setup
1. Go to **cPanel -> MySQL Database Wizard**.
2. Create a database (e.g. `username_shebaolt`) and database user with strong password.
3. Open **phpMyAdmin**, select your database, click **Import**, and upload `database/schema.sql`.
4. Open `config/database.php` in cPanel File Manager and edit line 10-15:
   ```php
   return [
       'host' => 'localhost',
       'port' => '3306',
       'dbname' => 'username_shebaolt',
       'username' => 'username_shebauser',
       'password' => 'YourDBPasswordHere',
       'charset' => 'utf8mb4',
   ];
   ```

---

### Step 3: Configure cPanel Cron Jobs
In cPanel, open **Cron Jobs** and add these 4 cron schedules:

1. **Polling Scheduler (Every Minute)**:
   ```bash
   * * * * * php /home/username/public_html/cron/scheduler.php >> /dev/null 2>&1
   ```

2. **Polling Worker Queue (Every Minute)**:
   ```bash
   * * * * * php /home/username/public_html/cron/worker.php >> /dev/null 2>&1
   ```

3. **Alarm Threshold Scan Worker (Every 5 Minutes)**:
   ```bash
   */5 * * * * php /home/username/public_html/cron/alarm-worker.php >> /dev/null 2>&1
   ```

4. **Daily Database Maintenance (3:00 AM)**:
   ```bash
   0 3 * * * php /home/username/public_html/cron/cleanup.php >> /dev/null 2>&1
   ```

---

### Step 4: Access System
- Open `https://yourdomain.com/public/index.php` in your web browser.
- Default Super Admin Credentials:
  - **Username**: `admin`
  - **Password**: `admin123`
- Immediately go to **Settings** and update password, Telegram bot token, and optical thresholds.
