Files
errors.bitreport.pt/README.md
T
1sonhadorandPaperclip 4604606033 feat(errors): migrate error-reporting stack from PostgreSQL to MariaDB (BIT-255)
Replace Postgres with MariaDB 11 in docker-compose; convert all
database/error_reporting and db/migrations SQL to InnoDB-friendly syntax
(DATETIME(6), AUTO_INCREMENT, ON DUPLICATE KEY). Run admin portal DDL in the
same migrate one-shot as error_reporting.

Switch ingest-api, collector-worker, and api from pg to mysql2 (pools,
parameterized queries, transactions). Align ingest writes with
er_incident_occurrences and include project_id on idempotency inserts.

Add scripts/run-mysql-migrations.sh for host-side applies; update LXC
run-migrate/verify, deployment docs, and .env.example (mysql://, ER_MYSQL_*).

Verified: npm run build + npm test in ingest-api and collector-worker;
npm run build in api. Full docker compose not run here (no local daemon).

Co-Authored-By: Paperclip <[email protected]>
2026-03-22 19:29:11 +00:00

51 lines
1.9 KiB
Markdown

# errors.bitreport.pt
BitReport **central error reporting** platform: ingest API, collector worker, admin UI (incidents), MariaDB migrations, and optional **admin portal** (auth/RBAC) from BIT-183.
**Remote:** `https://git.bitreport.pt/BitReport.pt/errors.bitreport.pt.git`
**Tracking:** Paperclip **BIT-247** (migration from `OTT/error-reporting/`).
## Layout
| Path | Role |
|------|------|
| `ingest-api/` | Fastify HTTP ingest (BIT-154.x) |
| `collector-worker/` | Polls configured sources → ingest API |
| `admin-ui/` | Next.js operator UI (incidents) |
| `database/error_reporting/` | SQL migrations + dev seed (used by Compose + LXC) |
| `deploy/lxc/` | systemd, nginx examples, migrate script (no Docker) |
| `docker-compose.yml`, `.env.example` | Local / Proxmox Docker stack |
| `api/` | Fastify admin API — sessions, RBAC (BIT-183) |
| `web/` | Next.js admin login/UI for `api/` |
| `db/migrations/` | Admin-user schema (SQL); applied with error_reporting migrations via `scripts/docker-migrate.sh` |
| `docs/` | Permission matrix, deployment runbooks |
## Docker Compose (ingest stack)
From the **repository root**:
```bash
cp .env.example .env
docker compose up --build
curl -sf "http://127.0.0.1:${ER_PUBLISH_INGEST_PORT:-3041}/health"
```
## Docs
- Compose + TLS: [`docs/deployment/bitreport-error-reporting-compose-proxmox.md`](docs/deployment/bitreport-error-reporting-compose-proxmox.md)
- LXC + systemd: [`docs/deployment/bitreport-error-reporting-lxc-proxmox.md`](docs/deployment/bitreport-error-reporting-lxc-proxmox.md)
## Tests (local)
```bash
cd ingest-api && npm ci && npm test
cd ../api && npm ci && npm test
```
Integration tests for ingest (`ingest-api/src/integration.twoProjects.test.ts`) require a migrated MariaDB and:
```bash
export ERROR_REPORTING_TEST_DATABASE_URL='mysql://USER:[email protected]:3306/error_reporting'
cd ingest-api && npm test
```