|
All checks were successful
Deploy Trade-In / deploy (push) Successful in 36s
Deploy Trade-In / changes (push) Successful in 5s
Deploy Trade-In / build-frontend (push) Has been skipped
Deploy Trade-In / build-browser (push) Has been skipped
Deploy Trade-In / test (push) Successful in 30s
Deploy Trade-In / build-backend (push) Successful in 42s
Co-authored-by: bot-backend <bot-backend@gendsgn.local> Co-committed-by: bot-backend <bot-backend@gendsgn.local> |
||
|---|---|---|
| .. | ||
| install.sh | ||
| README.md | ||
| tradein-scrape-trigger.service | ||
| tradein-scrape-trigger.timer | ||
TradeIn systemd scrape trigger
Replaces the in-app asyncio scheduler with a systemd timer that calls the admin API every 60s.
Install
Run as root on the VPS after deploy:
cd /opt/gendesign/tradein-mvp/ops/systemd
bash install.sh
install.sh copies the unit files to /etc/systemd/system/, reloads systemd, and
enables + starts the timer.
Environment variables
Create /etc/tradein/trigger.env before enabling the timer:
# psycopg v3 connection string (postgresql://... or postgresql+psycopg://...)
TRADEIN_DATABASE_URL=postgresql://tradein:<password>@localhost:5432/tradein
# Admin username from roles.yaml with role=admin — passed as X-Authenticated-User header
TRADEIN_ADMIN_TOKEN=admin
# Backend base URL (no trailing slash). Default: http://localhost:8000
TRADEIN_API_BASE=http://localhost:8000
Diagnostic commands
# Follow live timer logs
journalctl -u tradein-scrape-trigger -f
# List all active timers and next trigger times
systemctl list-timers
# Check timer status
systemctl status tradein-scrape-trigger.timer
# Check last service run
systemctl status tradein-scrape-trigger.service
# Manual one-shot trigger (for testing)
systemctl start tradein-scrape-trigger.service
Notes
- The script uses
flockon/var/run/tradein-trigger.lockto prevent overlapping runs if the previous invocation is still running. - Sources without a dedicated admin endpoint (e.g.
rosreestr_dkp_import,listing_source_snapshot) are logged as warnings and skipped. SetSCHEDULER_ENABLE=truein the backend env to handle them via the in-app scheduler.