# home-collector Feeds the private dashboard at `/start` (also the browser new-tab page). The app container has no Docker socket and must not get one, so a small stdlib-only Python script runs on the host every minute (systemd **user** timer `home-collector.timer`) and upserts two rows into `home.snapshots`: | key | contents | | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `host` | CPU %, load, uptime, RAM, swap, disk; every Docker container (state, health, restart count, CPU/mem via `sudo docker`); systemd timers (`stan-backup*`, `postgres-backup*`, `disk-guard-*`, `house-scrape`, `b2-cost`, `groceries-import`, `money-sync`, `ned-collector-*`) with last/next run and result; HTTP up/down + latency for each self-hosted service; latest `~/backups-cost/daily/*.json` | | `ntfy` | the last 40 messages (72 h) from the ntfy topics in `~/.config/disk-guard.env` (`NTFY_URL`) and `~/.config/house-scrape.env` (`HOUSE_NTFY_URL`), plus `NTFY_EXTRA`. Only a label is stored, never the topic name. | The page reads both rows in the same parallel query batch as tasks and links, so a slow upstream never delays it; a snapshot older than 3 minutes is shown as stale. ## Setup 1. A login role that may only upsert snapshots (created once, cluster superuser): `CREATE ROLE home_collector LOGIN CONNECTION LIMIT 3 PASSWORD '…'; GRANT CONNECT ON DATABASE personal TO home_collector;` The `home` migration grants `USAGE` on the schema and `SELECT, INSERT, UPDATE` on `home.snapshots` when the role exists (re-run those two GRANTs by hand if the role is created later). 2. `~/.config/home-collector.env` (mode 600): ``` HOME_DB_URL=postgresql://home_collector:…@127.0.0.1:5440/personal # optional extra topics, e.g. the backup alerts from /etc/stan-backup: # NTFY_EXTRA=backups=https://ntfy.sh/ ``` 3. `bash deploy/home-collector/install.sh` (copies the script to `~/.local/bin/home-collector` and enables the timer). Re-run after editing the script, e.g. to add a service to `SERVICES`. Debug: `python3 ~/.local/bin/home-collector --print`, `journalctl --user -u home-collector -n 20`.