diff --git a/10-systems/applications/gnexus-book.md b/10-systems/applications/gnexus-book.md index 6190a1c..c0b523c 100644 --- a/10-systems/applications/gnexus-book.md +++ b/10-systems/applications/gnexus-book.md @@ -1,7 +1,7 @@ --- owner: gmikcon status: active -last_reviewed: 2026-09-24 +last_reviewed: 2026-10-09 review_interval: 30d confidence: high source_of_truth: ssh-host-verified @@ -32,6 +32,18 @@ - UI (LAN): `http://192.168.1.170:80/` (nginx serves the built SPA). - Services run as user-level systemd units under `user@1000.service`: `gnexus-book-backend.service` (uvicorn :8000) and `gnexus-book-mcp.service` (MCP server). +## Backups (set up 2026-10-09 by rei, owner-requested) + +- **Script**: `/home/ubuntu/gnexus-book-backup.sh` (700, owner ubuntu) on gnbook. +- **What**: full snapshot of the whole repo directory `/home/ubuntu/gnexus-book` as `tar.gz` (includes `.git` history, modified `40-inventory/*.yml`, and all untracked `90-maintenance/pending-changes/*.json` — 271 pending files are NOT in git, so a git-only backup would lose them) + `git bundle create --all` as a restorable history insurance. +- **Schedule**: ubuntu crontab, daily 03:10 UTC (06:10 Europe/Kyiv), log: `/opt/backups/gnexus-book/backup.log` + cron.log. +- **Retention**: 10 days (`find -mtime +10 -delete` for both `gnexus-book-*.tar.gz` and `gnexus-book-*.bundle`). +- **Sanity checks**: tar must be non-empty and listable (contains README.md); bundle must pass `git bundle verify` (complete history). Any failure → exit 1, logged. +- **Typical size**: tar.gz ~34.5 MB, bundle ~615 KB. Disk on gnbook: 15G total, 2.2G free — retention is mandatory, do not raise without checking disk. +- **Verified**: manual run 2026-10-09 09:45 UTC, EXIT=0, gnexus-book-20261009-094532.tar.gz 34564532 bytes + bundle 614785 bytes, bundle verify OK ("complete history"). +- **Restore sketch**: `tar xzf gnexus-book-.tar.gz -C /home/ubuntu` restores the full repo including pending changes; or `git clone gnexus-book-.bundle restored` for history-only restore (working-tree modifications and untracked pending JSONs are NOT in the bundle — use the tar.gz for full restore). +- **Caveat**: `master` is ahead of `origin/master` by 185 commits (origin is stale) — local backups are currently the only copy of recent history. Consider pushing to GitBucket (git.gnexus.space) as an off-host copy. + ## Maintenance Model Agents should prefer structured inventory changes, validation, pending changes, and local commits through the maintenance API. diff --git a/90-maintenance/pending-changes/20261009094609-1b509d3c.json b/90-maintenance/pending-changes/20261009094609-1b509d3c.json new file mode 100644 index 0000000..1e28674 --- /dev/null +++ b/90-maintenance/pending-changes/20261009094609-1b509d3c.json @@ -0,0 +1,19 @@ +{ + "id": "20261009094609-1b509d3c", + "kind": "doc", + "target": "10-systems/applications/gnexus-book.md", + "summary": "gnexus-book: добавлен раздел Backups — ежедневный cron 03:10 UTC, tar.gz всего репо + git bundle, ротация 10 дней, sanity-проверки, restore-набросок", + "reason": "Owner requested daily backups with 10-day retention; setup verified live on gnbook 2026-10-09 (manual run EXIT=0, cron installed).", + "payload": { + "content": "---\nowner: gmikcon\nstatus: active\nlast_reviewed: 2026-10-09\nreview_interval: 30d\nconfidence: high\nsource_of_truth: ssh-host-verified\n---\n\n# Gnexus Book\n\nGnexus Book is the canonical infrastructure knowledge base and maintenance API for the personal digital and server infrastructure.\n\n## Deployment\n\n- Runs as KVM VM `gnbook` (192.168.1.170) on hypervisor `hp-proliant-dl380-g6` (192.168.1.130).\n- SSH: `ubuntu` on 192.168.1.170 (credentials in gnexus-creds, secret `gnauth-gnbook-ssh`).\n- Repository path: `/home/ubuntu/gnexus-book` (branch `master`).\n- Source of truth: Markdown, YAML inventory, JSON Schema, and Git history.\n\n## Runtime Components\n\n- Backend: FastAPI under `server/`.\n- Agent interface: MCP server under `server/app/mcp_server.py`.\n- UI: Vue/Vite under `ui/`.\n- UI dependency: `gnexus-ui-kit`.\n\n## Endpoints\n\n- REST API: `http://192.168.1.170:8000/` (uvicorn, openapi at `/openapi.json`).\n- MCP (SSE): `http://192.168.1.170:8001/sse`.\n- UI (LAN): `http://192.168.1.170:80/` (nginx serves the built SPA).\n- Services run as user-level systemd units under `user@1000.service`: `gnexus-book-backend.service` (uvicorn :8000) and `gnexus-book-mcp.service` (MCP server).\n\n## Backups (set up 2026-10-09 by rei, owner-requested)\n\n- **Script**: `/home/ubuntu/gnexus-book-backup.sh` (700, owner ubuntu) on gnbook.\n- **What**: full snapshot of the whole repo directory `/home/ubuntu/gnexus-book` as `tar.gz` (includes `.git` history, modified `40-inventory/*.yml`, and all untracked `90-maintenance/pending-changes/*.json` — 271 pending files are NOT in git, so a git-only backup would lose them) + `git bundle create --all` as a restorable history insurance.\n- **Schedule**: ubuntu crontab, daily 03:10 UTC (06:10 Europe/Kyiv), log: `/opt/backups/gnexus-book/backup.log` + cron.log.\n- **Retention**: 10 days (`find -mtime +10 -delete` for both `gnexus-book-*.tar.gz` and `gnexus-book-*.bundle`).\n- **Sanity checks**: tar must be non-empty and listable (contains README.md); bundle must pass `git bundle verify` (complete history). Any failure → exit 1, logged.\n- **Typical size**: tar.gz ~34.5 MB, bundle ~615 KB. Disk on gnbook: 15G total, 2.2G free — retention is mandatory, do not raise without checking disk.\n- **Verified**: manual run 2026-10-09 09:45 UTC, EXIT=0, gnexus-book-20261009-094532.tar.gz 34564532 bytes + bundle 614785 bytes, bundle verify OK (\"complete history\").\n- **Restore sketch**: `tar xzf gnexus-book-.tar.gz -C /home/ubuntu` restores the full repo including pending changes; or `git clone gnexus-book-.bundle restored` for history-only restore (working-tree modifications and untracked pending JSONs are NOT in the bundle — use the tar.gz for full restore).\n- **Caveat**: `master` is ahead of `origin/master` by 185 commits (origin is stale) — local backups are currently the only copy of recent history. Consider pushing to GitBucket (git.gnexus.space) as an off-host copy.\n\n## Maintenance Model\n\nAgents should prefer structured inventory changes, validation, pending changes, and local commits through the maintenance API.\n\nPending-change queue lives in `90-maintenance/pending-changes/` (untracked JSON files; 11 older ones are git-tracked). Repository-wide validation scans every pending JSON, so a single invalid pending file blocks all applies and commits.\n\nPoisoned-pending protection (since 2026-09-24, commit c77bcb1):\n\n- Create (`propose_doc_change`, `propose_inventory_item_change`, `update_doc`): payloads with secret patterns or unsafe doc targets (outside repo root) are rejected BEFORE any file is written — a rejected request leaves no pending file behind.\n- Apply: on validation failure the target file is rolled back AND the change's own pending JSON is removed (full rollback, both doc and inventory-item paths).\n- `delete_pending_change` (MCP) / `DELETE /changes/{id}` (REST): deletes pending or corrupt records; applied records are refused (409).\n- `list_pending_changes` tolerates corrupt JSON files and reports them with status `corrupt`; corrupt records can be deleted but not applied.\n- `update_doc` cleans up its own pending JSON automatically if apply or commit fails.\n\nFor agent-facing MCP usage rules, see [../../90-maintenance/agent-mcp-usage.md](../../90-maintenance/agent-mcp-usage.md).\n\nNo raw credentials are documented here." + }, + "status": "applied", + "created_at": "2026-10-09T09:46:09Z", + "updated_at": "2026-10-09T09:46:10Z", + "applied_at": "2026-10-09T09:46:10Z", + "validation": { + "status": "ok", + "issue_count": 0, + "issues": [] + } +}