Files
errors.bitreport.pt/deploy/lxc/env.example
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

33 lines
1.3 KiB
Plaintext

# Copy to /etc/error-reporting/env (mode 640, root:root or root:error-reporting).
# systemd parses this as EnvironmentFile= — use KEY=value only, no "export".
# --- Checkout root: this repository (contains database/, ingest-api/, admin-ui/, ...) ---
ER_REPO_ROOT=/opt/errors.bitreport.pt
# Legacy variable name (still read by run-migrate.sh if ER_REPO_ROOT is unset):
# OTT_ROOT=/opt/errors.bitreport.pt
# --- MariaDB / MySQL (single LXC: localhost; split DB LXC: set host in URL) ---
# Percent-encode special characters in user/password (RFC 3986) when building the URL.
DATABASE_URL=mysql://er_app:[email protected]:3306/error_reporting
# --- ingest-api ---
PORT=3041
NODE_ENV=production
INGEST_RATE_LIMIT_MAX=300
INGEST_RATE_LIMIT_WINDOW_MS=60000
# --- collector-worker ---
INGEST_BASE_URL=http://127.0.0.1:3041
TICK_INTERVAL_MS=3000
SOURCE_REFRESH_MS=15000
HTTP_FETCH_TIMEOUT_MS=15000
MAX_BACKOFF_EXPONENT=8
# --- admin-ui (Next.js server-side API calls) — target the Fastify `api/` service (default PORT 3200) ---
ERROR_REPORTING_ADMIN_API_BASE=http://127.0.0.1:3200
# ERROR_REPORTING_UI_DEMO=1
# --- Demo / staging only: token must match seed SQL for project-alpha HTTP fixture ---
# ER_COLLECTOR_PROJECT_ALPHA_TOKEN=er_tst_a_secret_one
# COLLECTOR_DEFAULT_INGEST_TOKEN=