# Runtime Deployment Guide

This package is intended for the first real VPS/cPanel runtime test.

## Minimum server

- PHP 8.3+
- Composer
- MySQL 8+ / MariaDB equivalent
- HTTPS
- Cron
- Queue worker support

Recommended:
- Redis
- Supervisor/systemd
- Nginx or Apache
- Laravel Reverb / Ably / Pusher for realtime

## Clean installation

1. Create a new Laravel 13 project.
2. Copy `laravel-overlay/` into the Laravel root.
3. Merge `composer.vtu.json` dependencies into the real `composer.json`.
4. Configure `.env` or use `/install`.
5. Run:

```bash
./scripts/php_syntax_check.sh
python3 scripts/validate_release.py
./scripts/install_runtime.sh
```

6. Start queue worker using the Supervisor example.
7. Install the cron entry from `deploy/cron.example.txt`.

## Runtime validation

Run:

```bash
./scripts/runtime_check.sh
```

This checks:
- Laravel boot
- route registration
- migration state
- DB/cache/storage health
- scheduler registrations
- PHPUnit suite

## Reconciliation

The scheduler queues pending/processing transactions every 5 minutes.

Manual command:

```bash
php artisan vtu:reconcile --limit=200
```

## Backups

Application-level snapshot:

```bash
php artisan vtu:backup-snapshot
```

This is not a replacement for `mysqldump`/MariaDB backups. For production:
- daily database backup
- encrypted off-server copy
- periodic restore test

## Live-money gate

Do not switch to live providers until:
- sandbox purchases pass
- duplicate purchase tests pass
- duplicate webhook tests pass
- reconciliation works
- queue worker is stable
- backups are tested
- security review is complete
