# Live deploy checklist — data.busvalley.com

**Live API / admin base URL:** `https://data.busvalley.com/busvalley_new`

---

## 1. Before upload

- [ ] Backup live files and database on cPanel
- [ ] Add menus **151–156** on live DB (see menu SQL from DB comparison) if not done yet
- [ ] Do **not** overwrite server `.env` with dev DB credentials — merge settings only

---

## 2. Upload code

Upload project to server (same folder where `spark` exists), e.g.:

```text
/home/busvall/data.busvalley.com/busvalley_new
```

**Do not upload:**

- `scratch/`
- `public/test_db3.php`
- `public/check_holds.php`
- `writable/debugbar/*` (optional cleanup)
- Local-only SQL dumps

---

## 3. Server `.env` (required)

On the server, edit `.env`:

```ini
CI_ENVIRONMENT = production

app.baseURL = 'https://data.busvalley.com/busvalley_new'
app.forceGlobalSecureRequests = true

database.default.hostname = localhost
database.default.database = YOUR_LIVE_DB_NAME
database.default.username = YOUR_LIVE_DB_USER
database.default.password = "YOUR_LIVE_DB_PASSWORD"
database.default.DBDriver = MySQLi

logger.threshold = 4
```

Keep existing `TOKEN_SECRET` and encryption keys from the current live `.env` — do not change unless you intend to invalidate sessions.

---

## 4. Permissions

```bash
chmod -R 775 writable
chmod -R 775 public/pdf
```

Owner should be the cPanel user (`busvall`).

---

## 5. Cron job (cPanel → Cron Jobs)

Every minute (matches your existing cPanel cron):

```bash
cd /home/busvall/data.busvalley.com/busvalley_new && /opt/cpanel/ea-php81/root/usr/bin/php spark notifications:send >> /home/busvall/data.busvalley.com/busvalley_new/cron.log 2>&1
```

Delete any invalid cron (e.g. `evry day at 5AM`).

Verify:

```bash
tail -20 /home/busvall/data.busvalley.com/busvalley_new/cron.log
```

---

## 6. Optional: DB migrations

If new tables/columns were added in code:

```bash
cd /path/to/busvalley_new
php spark migrate
```

Menus 151–156 can be added manually via SQL instead of migrate.

---

## 7. Smoke tests after deploy

| Test | URL / action |
|------|----------------|
| Admin login | `https://data.busvalley.com/busvalley_new/` |
| API locations | `GET .../modules/api/v1/locations` |
| Seat map | Book flow — steering/seat icons load |
| Geidea payment | Test booking — callback `.../tickets/payment-sucess` |
| Offers | Admin → Offers list |
| Scheduled notification | Create 2 min ahead → check `cron.log` |
| Role permissions | Add Permission shows menus 151–156 |

---

## 8. Config summary (already in codebase)

| Setting | Live value |
|---------|------------|
| `app/Config/App.php` → `baseURL` | `https://data.busvalley.com/busvalley_new` |
| `app/Config/App.php` → `appTimezone` | `Africa/Cairo` |
| `app/Config/ApiCors.php` | Allows `busvalley.com`, `busvalley.net`, `data.busvalley.com` |
| Geidea `callbackUrl` | `base_url('modules/api/v1/tickets/payment-sucess')` |
| Debug toolbar | Off when `CI_ENVIRONMENT = production` |

---

## 9. Flutter / website API base

```text
https://data.busvalley.com/busvalley_new/modules/api/v1/
```
