Add supervised systemd queue worker (phase 8)

Runs php artisan queue:work as a systemd --user service (Restart=always,
hourly recycling) so OSINT lookups process automatically instead of
requiring a manually-run queue:work. All 8 planned phases now done.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
cedry2k1992
2026-07-20 10:40:37 +03:00
co-authored by Claude Sonnet 5
parent 873699e23e
commit 853686f3f3
3 changed files with 70 additions and 7 deletions
+31
View File
@@ -0,0 +1,31 @@
# Queue worker (systemd --user)
`QUEUE_CONNECTION=database`, so OSINT lookups only actually run while a
`queue:work` process is alive. This unit supervises one as a `systemd --user`
service — no root/sudo needed, survives crashes (`Restart=always`), and
restarts hourly (`--max-time=3600`) to pick up code/config changes and avoid
long-lived-process memory growth.
`--timeout=180` is intentionally above `config('osint.run_timeout')` (120s,
in `config/osint.php`) — the worker's timeout must exceed a runner's own
timeout, or the worker kills the job before the runner gets a chance to.
## Install
```
cp deploy/systemd/osint-queue-worker.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now osint-queue-worker.service
```
Requires lingering enabled so the service keeps running without an active
login session: `loginctl enable-linger $USER` (needs sudo once, or ask your
sysadmin — already enabled on this box).
## Operate
```
systemctl --user status osint-queue-worker.service
journalctl --user -u osint-queue-worker.service -f
systemctl --user restart osint-queue-worker.service # after deploying code/.env changes
```
+21
View File
@@ -0,0 +1,21 @@
[Unit]
Description=OSINT Laravel Queue Worker
After=network-online.target
Wants=network-online.target
StartLimitIntervalSec=0
[Service]
Type=simple
ExecStart=/usr/bin/php /home/m105/projects/osint/artisan queue:work --queue=default --sleep=3 --tries=1 --timeout=180 --max-time=3600
WorkingDirectory=/home/m105/projects/osint
Environment="PATH=/home/m105/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Restart=always
RestartSec=5
KillMode=mixed
KillSignal=SIGTERM
TimeoutStopSec=30
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=default.target