Operations
Production deployments need the web application and, depending on the features in use, queue workers and a scheduler. This chapter covers the configuration and operational checks for the kit’s additions.
Run commands from the application root. Adapt connection settings and process supervision to your deployment environment.
The Access blocking checklist summarizes capabilities and operational checks, with checked items for this edition and notes on prerequisites and unimplemented features.
Production configuration
Section titled “Production configuration”Application and connections
Section titled “Application and connections”.env.example is a starting configuration for development. Review at least these settings for production.
| Setting | What to check |
|---|---|
APP_ENV |
Set to production. |
APP_DEBUG |
Set to false to avoid displaying error details. |
APP_URL |
Set the public HTTPS URL. It is also used for mail links and passkey configuration. |
APP_KEY |
Store the initially generated key securely; do not regenerate it on every deployment. |
DB_* |
Set the production database connection and credentials. |
SESSION_DRIVER |
Use database for this kit’s session list and revocation. |
CACHE_STORE |
Used by rate limits and alert suppression. Use shared storage across instances. |
MAIL_* |
Configure a real transport. MAIL_MAILER=log does not deliver to recipients. |
ALERT_MAIL_TO |
Set the operator address for exception and failed-job alerts. |
AUDIT_SECURITY_VIEWERS |
Comma-separated allowed viewer email addresses. |
AUDIT_SECURITY_RETENTION_DAYS |
Positive integer retention period; defaults to 365 days. |
For passkeys, ensure the public hostname matches APP_URL. Event viewers need a verified email address in addition to allowlist membership.
Production also strengthens the default password rules: at least 12 characters, uppercase and lowercase letters, numbers, symbols, and a compromised-password check.
Applying a deployment
Section titled “Applying a deployment”Prepare dependencies and frontend build output, then apply schema changes and configuration. Review migrations and take necessary backups before running these example commands.
php artisan migrate --forcephp artisan config:cachephp artisan view:cacheDeploy public/build/ generated by npm run build. Point the web server document root at public/ and allow the runtime user to write to storage/ and bootstrap/cache/.
When configuration is cached, editing .env alone does not update it. Run config:cache again and restart long-running processes such as queue workers.
Queues and scheduler
Section titled “Queues and scheduler”Queue workers
Section titled “Queue workers”Run a worker when jobs are dispatched to an asynchronous connection such as QUEUE_CONNECTION=database. For database queues, migrations also prepare tables such as jobs and failed_jobs.
php artisan queue:workIn production, keep workers running under a process supervisor and restart them when they exit. Workers retain loaded code and configuration, so request a restart after deployment.
php artisan queue:restartThis command does not launch new workers. Workers finish their current jobs and exit; configure the supervisor to launch replacements.
This kit’s GeneralNotification does not itself use a queue. After-response account change emails are not retried by queue workers either. See Notifications and alerts for delivery behavior and limitations.
Scheduler
Section titled “Scheduler”routes/console.php registers security event retention cleanup once per day. Registration alone does not run it. In production, arrange to call schedule:run every minute, for example through cron.
* * * * * cd /path/to/application && php artisan schedule:run >> /dev/null 2>&1Adjust the application and PHP paths. The cleanup task does not enforce single-server execution, so choose which instance runs the scheduler in a multi-instance deployment.
Inspect tasks and their next execution times with:
php artisan schedule:listTimes follow the application timezone, which defaults to UTC in this project. Use php artisan schedule:work for continuous development execution.
If retention days are not a positive integer, cleanup is not registered and a configuration error is reported. See Security events for manual cleanup and retention details.
Operational checks
Section titled “Operational checks”After startup or deployment
Section titled “After startup or deployment”| Area | Check |
|---|---|
| Application | Confirm /up responds, and test login and key pages. |
| Confirm account change emails and alerts arrive at the intended addresses. | |
| Sessions | Confirm the list loads and unwanted sessions can be revoked. |
| Event viewing | Confirm only allowed users can access /admin/security-events. |
| Queues | Confirm workers run and jobs do not accumulate. |
| Retention | Confirm the scheduler runs and cleanup is registered. |
| Storage | Review database, log, and backup capacity and retention. |
A response from /up alone does not establish that mail, workers, and scheduling are healthy. Check their outcomes separately.
Investigating alerts and failed jobs
Section titled “Investigating alerts and failed jobs”Alerts suppress exceptions with the same class, file, and line for five minutes. Email counts therefore do not equal error counts. Inspect application logs too; the initial log destination is storage/logs/laravel.log.
List failed jobs with:
php artisan queue:failedAfter fixing the cause, retry only jobs that are safe to run again. Operations such as email delivery or external registration might already have partially completed; check the impact of duplicates.
php artisan queue:retry <job-id>If alert delivery itself fails, look for Failed to send alert notification. in warning logs. Check recipients, transport configuration, and provider errors.
Responding to suspicious activity and preserving records
Section titled “Responding to suspicious activity and preserving records”Review Security events for unexpected account changes or suspected unauthorized logins. If needed, revoke the user’s sessions from the CLI. This requires database sessions and also invalidates existing “Remember me” logins.
Recording and notification failures do not stop the original account operation. Missing logs or mail alone do not prove that no operation occurred.
The security event model rejects updates and deletes, but does not prevent direct SQL or bulk operations. Retention cleanup also uses bulk deletion. Preserve investigation records before cleanup, and separately manage database permissions and backups. IP addresses and User-Agent values are not automatically recorded in these security events; source tracing requires separately collected evidence.