Commit Graph

9 Commits

Author SHA1 Message Date
王性驊 8c1be42f4a prod: throttle persona scrape jobs, cap worker CPU, add job-failure alerting + offsite backup
- job: cap concurrent persona_analyze_account (real headless-Chromium scrape)
  jobs per owner to 1 in flight via CountActiveByOwnerAndTemplate; rejects
  with the new ErrTooManyActive (429) instead of letting a member queue up
  many scrapes and pin the shared 1-vCPU host, or double-schedule the same
  persona while a previous run is still executing.
- harbor-worker@.service: CPUQuota=70% so nginx/gateway keep headroom while
  a scrape job briefly saturates Chromium.
- backup.sh: default BACKUP_DIR now matches the systemd unit (/var/backups/harbor)
  instead of the stale /var/backups/haixun default.
- add harbor-job-health.timer (every 5m): queries Mongo for jobs that failed
  in the last 15 minutes and writes a node-exporter textfile-collector
  metric (haixun_job_failures_recent), with new Prometheus alerts
  (PersonaScrapeJobsFailing / BackgroundJobsFailing / JobHealthMetricStale)
  so a stuck worker surfaces on its own instead of only via member reports —
  this would have caught the recent Playwright headless-shell bug directly.
- add harbor-offsite-backup.timer + backup/offsite-sync.sh: pushes
  backup.sh's local backups to an off-host restic repository (client-side
  encrypted). Installed and enabled by default but a safe no-op until
  RESTIC_REPOSITORY/RESTIC_PASSWORD are set in harbor.env.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 17:38:36 +00:00
王性驊 d1e876629a prod: bundle threads-profile scrape release, fix headless-shell install, add reset-data tooling
- release layout now ships scripts/threads-profile/scrape.mjs + node_modules;
  activate-release.sh verifies it exists before activating a release
- profile_scrape.go resolves the script path relative to the release dir
  (bin/{gateway,worker} -> ../scripts/threads-profile/scrape.mjs) in prod,
  falling back to the dev-tree relative paths for local runs
- bootstrap.sh: Playwright 1.49+ needs a separate chromium-headless-shell
  build for headless launches; the idempotency check only looked for
  chromium-*, so a stalled/partial headless-shell download from an earlier
  run was never retried. Now checks and installs both builds.
- add reset-data.sh (local wrapper + remote script) to wipe Mongo/Redis/MinIO
  and reseed the admin account for a clean-slate redeploy

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 16:26:30 +00:00
王性驊 fb8100825f fix frontend 2026-07-15 15:23:59 +00:00
王性驊 8ef6fe470b fix frontend 2026-07-13 08:59:13 +00:00
王性驊 ef6322b635 fix frontend 2026-07-13 03:18:08 +00:00
王性驊 e41c1f96a2 fix frontend 2026-07-13 01:15:30 +00:00
王性驊 fcc76911bb fix frontend 2026-07-10 12:54:45 +00:00
王性驊 c57987f6a8 fix frontend 2026-07-10 05:10:31 +00:00
王性驊 2e0b625735 fix all 2026-07-09 03:45:28 +00:00