# Deployment Runbook

Recommended topology: Cloudflare/CDN -> Nginx -> Laravel PHP-FPM; Node SSR process on localhost; Redis; managed MySQL/PostgreSQL; S3-compatible object storage; queue workers under Supervisor.

## Deploy sequence
1. Build immutable release from Git commit.
2. `composer install --no-dev --prefer-dist --optimize-autoloader`.
3. `npm ci && npm run build && npm run build:ssr`.
4. Link shared `.env`, storage and persistent uploads.
5. `php artisan migrate --force`.
6. Cache config/routes/views/events.
7. Health check release locally.
8. Switch symlink/target atomically.
9. Restart PHP-FPM if needed, queue workers and SSR process.
10. Run smoke tests and rollback on failure.

## Backup policy matching requirements
- Database snapshot daily.
- Media/object storage versioning where feasible.
- Weekly offsite copy.
- Quarterly restore drill.
- Target recovery time for critical failure: <= 4 hours.

## Monitoring
Track HTTP 5xx, latency, queue depth/failures, SSR process status, CPU/RAM/disk, certificate expiry, database connections, LCP/INP/CLS (RUM), backup success and security events.
