# Deployment Guide — Southend School

## Environment

```env
APP_ENV=production
APP_DEBUG=false
APP_URL=https://your-domain.com

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=southend
DB_USERNAME=
DB_PASSWORD=

MAIL_MAILER=smtp
MAIL_HOST=
MAIL_PORT=587
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_FROM_ADDRESS=noreply@southend.edu

QUEUE_CONNECTION=database

# Payment gateways — see docs/PAYMENTS.md
PAYCHANGU_ENABLED=false
ONE_KHUSA_ENABLED=false
```

## Setup commands

```bash
composer install --no-dev --optimize-autoloader
php artisan key:generate
php artisan migrate --force
php artisan db:seed --force   # first deploy only
php artisan storage:link
php artisan config:cache
php artisan route:cache
php artisan view:cache
```

## Queue worker (required for email/database notifications)

```bash
php artisan queue:work --tries=3
```

Supervisor example:

```ini
[program:southend-queue]
command=php /path/to/southend/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
```

## Scheduler (cron)

```cron
* * * * * cd /path/to/southend && php artisan schedule:run >> /dev/null 2>&1
```

Scheduled tasks include daily fee/exam reminders (`southend:send-reminders` at 07:00).

## Pre-deploy checks

```bash
php artisan southend:audit
php artisan test
```

## API documentation

Browse `/api/docs` after deployment (YAML spec in `docs/openapi.yaml`).
