Production Deployment
Before you deploy
- Define the Gates. OpConsole is fail-closed outside
local— see Authentication & Authorization. - Point the lock store at shared storage if you run more than one server. The default file lock only coordinates a single server — see Permissions & Security Policies.
- Decide your audit policy.
best_effort(default) never blocks an operation on an audit failure;requiredrefuses actions, log deletes, and log downloads unless their audit row is written first. - Review the action allow-list. Disable anything you don't want available in this environment (for example, leave
storage_linkoff unless needed).
Deployment and caching
OpConsole is fully compatible with Laravel's production optimization commands:
bash
php artisan migrate --force
php artisan vendor:publish --tag=opconsole-assets --force
php artisan config:cache
php artisan route:cache
php artisan view:cacheconfig/opconsole.php contains plain arrays and scalars only — no closures — so config:cache never needs special handling.
Verification checklist
After deploying:
- An unauthenticated request to
/admin/opconsoleredirects to your namedloginroute, or returns HTTP401whenauthentication.login_routeisnullor absent — never a500. - An authenticated non-admin user receives HTTP
403. - An authorized administrator loads
/admin/opconsole(200), views grouped health checks, inspects logs, and sees entries appear in History after running an operation.
Multi-server considerations
- Action lock store: point
OPCONSOLE_LOCK_STOREat a dedicated Redis or database store with separate lock storage. See Permissions & Security Policies. - Heartbeat store:
heartbeats.storemust be a cache store shared by every server, or the scheduler/queue heartbeat checks become meaningless. - Security scan store:
security.storeshould be a shared, lock-capable cache store too, so concurrent scans across servers are still serialized.
Monitoring integration
- Schedule
php artisan opconsole:health --fail-on=warning(orcritical) in CI/CD to gate a deploy on application health. - Enable the JSON health endpoint for external uptime monitors — see Health Checks & Health Score. Use it as a readiness, not liveness, probe in Kubernetes.
- Enable
notificationsand scheduleopconsole:health --notifyfor health-transition alerts (mail, Slack-compatible webhook, generic webhook).
Rolling back or disabling quickly
dotenv
OPCONSOLE_ENABLED=falsebash
php artisan optimize:clearThis registers zero OpConsole routes without a code change or a deploy — useful if you need to pull the console during an incident investigation into itself.
Updating the package
bash
composer update ashraftalha/laravel-opconsole
php artisan migrate
php artisan config:clearComposer never touches files you've published. If you published assets, views, or config, see the republishing guidance in the Upgrade Guide for each specific version jump.