recent-errors built its result by ranking ALL occurrences of every matching incident with ROW_NUMBER() before applying LIMIT, so status=resolved (the majority, longest-lived incident state) forced a scan of the full historical occurrence log just to return one page. admin/incidents.ts already filters/orders er_incidents directly for this reason; apply the same pattern here: page through er_incidents first (small, indexed by current_state), then rank occurrences only for that page. The q= search path is kept on the old occurrence-first query since it needs to match occurrence content across an incident's full history. Adds er_incidents_state_seen_idx (current_state, last_seen_at) so the new incident-first path stays indexed even without a project_slug filter, and backfills the docker/local migration runners that had drifted behind deploy/lxc/run-migrate.sh (missing three prior migrations), since the new migration needs to run through them too. Verified locally against MariaDB (docker compose) with 3k resolved / 20 open incidents and ~90k synthetic occurrences: the reported repro curls now return HTTP 200 in <100ms (previously reproduced as a hang via manual EXPLAIN/timing of the old query, ~2s at this seed size and scaling with total occurrence history).
Native LXC deploy (no Docker)
Scripts and unit files for running ingest-api, admin-ui, and collector-worker on Debian/Ubuntu LXC with MariaDB (or MySQL 8+) on the same CT or another host.
Authoritative runbook: docs/deployment/bitreport-error-reporting-lxc-proxmox.md.
| Path | Purpose |
|---|---|
env.example |
Template for /etc/error-reporting/env |
run-migrate.sh |
Apply migrations + seed (after MariaDB is up) |
write-version-json.sh |
Emit runtime/version.json (BIT-465); set ER_VERSION_JSON_PATH in env |
webhook-deploy.sh |
Example full promote: git pull, builds, write-version-json, verify, restarts |
verify.sh |
curl ingest /health; validates version.json when ER_VERSION_JSON_PATH is set |
systemd/*.service |
Unit files (adjust WorkingDirectory if not /opt/errors.bitreport.pt) |
nginx/*.conf.example |
TLS reverse proxy sketch |
Docker-based path remains in ../../docker-compose.yml and ../../docs/deployment/bitreport-error-reporting-compose-proxmox.md.
Nota: em alguns LXCs o git clone https://git.bitreport.pt/... falha sem credenciais (Gitea não expõe leitura anónima a partir de todas as redes). Alternativas: rsync/CI a partir de um host com clone, ou PAT read-only na URL (guardar fora do git).