# Certificate verification deployment

Issued certificate PDFs are private artifacts. Production must use persistent storage and a queue worker that consumes the `certificates` queue.

```dotenv
QUEUE_CONNECTION=redis
CERTIFICATE_QUEUE=certificates
CERTIFICATE_STORAGE_DISK=local
```

`local` stores PDFs under `storage/app/certificates`. Keep that directory on persistent storage and include it in backups, or point `CERTIFICATE_STORAGE_DISK` at the configured `s3` disk.

After deploying the application code:

```bash
php artisan migrate --force
php artisan optimize:clear
php artisan certificates:backfill-verification --chunk=100
php artisan queue:restart
```

The persistent worker must include the new queue before `default`:

```bash
php artisan queue:work redis --queue=certificates,whatsapp,default --tries=3 --timeout=180
```

The backfill command is resumable and may safely be run again. It skips certificates that already have a ready current revision and reports legacy rows that cannot be reconstructed.
