Docs restructure, code review, gatherer reliability, JWT key fail-closed

Documentation
- Three levels: DOCS/General (overview, configuration), DOCS/Deployment
  (choose a method, first steps), details per method in Containers/ and
  System_Services/; new root README and DOCS/README map.
- Remove superseded pages (Deployment.md, Deployment_Docker/Native.md, Index.md);
  split the two scenario guides by section.
- Isolate the Timeweb/Hysteria2 records in DEPLOYMENTS/timeweb-hysteria2/
  (not linked from DOCS, listed in .graphifyignore).
- Add DOCS/code_review/ with a time-stamped analysis of the code base.

Gatherer (BUG-02, BUG-03)
- Session key (CN, address, connected_since_ts), baseline from the
  active_sessions snapshot, grace period for sessions missing from the status.
- Status file integrity (TITLE/TIME/END) and freshness; a torn read skips the tick.
- Cache applied after commit; main loop survives exceptions, backs off, and
  stops cleanly on SIGTERM/SIGINT; new client rows start with the first
  frame's totals; five tests.

JWT signing key (SEC-01)
- No built-in default: Core and Profiler refuse to start with a missing,
  placeholder or short (< 32) key; shipped config.ini has an empty value.
- Same rule in install.sh, update.sh (issues a new key when missing or weak),
  docker lib/entrypoint; five tests, conftest.py for the test key.

Each change has a plan and a summary under DOCS/Changes/.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ayurishchevandClaude Sonnet 5.5 committed 2026-10-05 20:30:45 +03:00
1 parent f95a0b63e6
commit ad6995bb63
85 files changed
+2805 -1280

No files matched your search

@@ -0,0 +1,59 @@
# Documentation refactoring: plan (2026-10-05)
## Goal
A newcomer who has never seen the project can bring up a working environment by **any** supported method, using the documentation alone. The documentation is split into three categories; everything specific to one concrete host (Hysteria2 chain on Timeweb) is taken out of the general documentation.
## Problems found (from the knowledge graph and a read of all documents)
| Problem | Evidence |
|---|---|
| No single place says which installation method to pick | the README has three one-line quick starts, `DOCS/General/Index.md` lists four deployment pages |
| Outdated guide competes with the current ones | `General/Deployment.md` (port 5000, `UI/client`, `OVPMON_SECRET_KEY`) contradicts Scenario 1 and 2; `Deployment_Docker.md` and `Deployment_Native.md` are pointers only (the native pointer still says "build the UI with Docker first") |
| Two 260-500 line files mix quick start, reference, operations and troubleshooting | `Scenario1_Containers.md` (261 lines), `Scenario2_System_Services.md` (493 lines) |
| No common "after the install" path | the same three sentences are repeated in each scenario and in the README |
| The README carries a 14-row change log and security notes before the newcomer reaches the install | README sections order |
| Host-specific records sit in the general tree | `DOCS/Operations/` (IPs, login, certificate fingerprint of the Timeweb host) and `Changes/2026-09-30_Egress_via_Hysteria2.md` |
## Target structure
```
README.md what it is, architecture, install in 3 steps, map of the docs
DOCS/README.md documentation map by goal ("I want to ...")
DOCS/General/ 1. general information
Overview.md components, ports, data, glossary
Configuration.md config.ini and environment variables
Security_Architecture.md (kept)
Database_Migrations.md (kept)
systemd/ openrc/ privilege-separation/ service files and the helper: used by the install scripts, not moved
DOCS/Deployment/ 2. installation methods
README.md choose a method, requirements side by side
First_Steps.md the same for every method: sign in, PKI, server, first profile
Containers/ 3a. details: containers (variants A and B)
README.md Operations.md Reference.md Troubleshooting.md
System_Services/ 3b. details: Alpine, Debian, Ubuntu without containers
README.md Operations.md Reference.md Web_UI.md Firewall.md Nginx.md Troubleshooting.md
DOCS/Core_Monitoring, Profiler_Management, UI API and component reference (kept)
DOCS/Changes/ records of changes, with an index (README.md)
DEPLOYMENTS/timeweb-hysteria2/ isolated: records of the Hysteria2 chain and the host on Timeweb
```
## Steps
1. Isolate the host-specific records: `git mv DOCS/Operations` and the Hysteria2 change to `DEPLOYMENTS/timeweb-hysteria2/`; nothing in the general documentation links there; the folder is added to `.graphifyignore`.
2. Split Scenario 1 and Scenario 2 by their sections into the folders above (content is moved, not rewritten); add a short quick start on top of each folder `README.md`.
3. Write the new documents: `Overview`, `Configuration`, `Deployment/README`, `First_Steps`, `DOCS/README`, `Changes/README`.
4. Remove the superseded pages (`General/Deployment.md`, `Deployment_Docker.md`, `Deployment_Native.md`, `Index.md`); move `Service_Management.md` and `Nginx_Configuration.md` under `System_Services/`.
5. Rewrite the root `README.md` and fix the references: comments in `deploy/*` scripts and compose files (comments only), component READMEs, other documents.
6. Check every relative Markdown link and every script reference; `bash -n` on the changed scripts.
## Rules
- Content is not lost: sections are moved as they are; only duplicated text is replaced by a link.
- Install scripts keep working: the paths they read (`DOCS/General/systemd`, `openrc`, `privilege-separation`) do not change.
- Documents stay in English like the rest of the repository.
- No code or behaviour changes; script edits are comments only.
## Out of scope
Translating the documents, rewriting the API references, rebuilding the knowledge graph (the moved files need a `/graphify --update`).