Blueprints · Laravel & PHP
Production
15 min · systemd
Laravel queue worker
Stages a queue worker that restarts after artisan queue:restart. It does not start the worker.
Live config
Baked-in protections
- The worker is not root
- RestartSec brings it back
- The unit is staged
Step 1 · ini
Worker unit
/root/portgate-blueprints/laravel-queue.service
Copy to /etc/systemd/system after the app user can read the .env file.
[Service] User=www-data WorkingDirectory=/var/www/app ExecStart=/usr/bin/php artisan queue:work --sleep=1 --tries=3 --max-time=3600 Restart=always RestartSec=3 NoNewPrivileges=true PrivateTmp=true
Step 2 · bash
Read-only check
/root/portgate-blueprints/queue-check.sh
Prints status. It does not change the service.
#!/bin/sh set -eu systemctl status laravel-queue --no-pager || echo "laravel-queue is not installed."