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:
co-authored by
Claude Sonnet 5
parent
873699e23e
commit
853686f3f3
@@ -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
|
||||
```
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user