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>
43 lines
4.3 KiB
Markdown
43 lines
4.3 KiB
Markdown
# Scenario 1: containers, variants A and B (2026-10-05)
|
|
|
|
Phase 2 of [Deployment_Scenarios_PLAN](2026-10-05_Deployment_Scenarios_PLAN.md). Guide: [Scenario 1: containers](../Deployment/Containers/README.md).
|
|
|
|
## What was added
|
|
|
|
| Area | Content |
|
|
|---|---|
|
|
| Variant B (one container per component) | The existing `docker-compose.yml`, extended: host ports `OVPMON_HTTP_PORT` / `OVPMON_VPN_PORT` (defaults 80 and 1194), health checks for all four services. Nothing else changed |
|
|
| Variant A (all in one container) | `deploy/allinone/` (`Dockerfile`: UI built in a Node 20 stage; Alpine, nginx, supervisord, gunicorn, uvicorn, gatherer, OpenVPN), `entrypoint.sh` (TUN, easy-rsa workspace, NAT without duplicates, nginx config, **explicit database migration before any service**), `supervisord.conf`, `docker-compose.allinone.yml` |
|
|
| Same data layout | Both variants use the same five named volumes with the same in-container paths: backups are identical and a volume set can be used by either variant (one variant per host: same ports and container names) |
|
|
| `deploy/docker/install.sh` | `--variant a|b`, preflight, `.env` with a random secret (mode 600), generated administrator password shown once, build, start, health wait, removal of the admin seed from `.env` once a user exists |
|
|
| `deploy/docker/update.sh` | Phases: preflight, **backup of all volumes** (verified), source update, build (old stack keeps running, current images tagged `:previous`), stop, **database migration as its own step** (`migrate.py --check` / apply / check, abort before start on failure), start with health wait, **automatic rollback** (volumes restored from this run's backup, `:previous` images started); `--rollback` for a manual rollback; last 5 backups kept |
|
|
| `backup.sh`, `restore.sh`, `lib.sh` | Stand-alone backup (cron friendly) and restore with confirmation; shared functions |
|
|
| Housekeeping | root `.dockerignore`; `.gitignore` gets `.env`, `backups/`, deploy state files |
|
|
| Docs | `DOCS/Deployment/Scenario1_Containers.md`; `DOCS/General/Deployment_Docker.md` is now a pointer |
|
|
|
|
## Verification (real Docker on this host)
|
|
|
|
| Check | Result |
|
|
|---|---|
|
|
| `install.sh --variant b` on a clean host state | built, healthy, administrator seed removed, password shown once |
|
|
| Variant B: PKI init, server config, client, note | all `200`; stack healthy |
|
|
| `update.sh` variant B on databases without a version (version table and `note` column removed from real data) | backup, migration phase applied the baseline to both databases with their own backups, start healthy, profile and PKI intact |
|
|
| `update.sh` variant B with a broken new Profiler image (injected syntax error) | build ok, migration ok, start unhealthy, **automatic rollback**: volumes restored, previous images started, healthy, data intact |
|
|
| `install.sh --variant a` | built and healthy; UI and both APIs through nginx; PKI init, server config, client, note; **OpenVPN started inside the container** (process running) |
|
|
| `update.sh` variant A on databases without a version | explicit migration phase, healthy, data intact |
|
|
| `backup.sh`, then a change, then `restore.sh` | archives verified; after the restore the later change is gone and the data is as at backup time |
|
|
| Cleanup | test projects, volumes, images and files removed; the 8089 stand was restarted on its own volumes, data intact |
|
|
|
|
## Notes and limits
|
|
|
|
- OpenVPN is not started automatically after a container is recreated (update, rollback): start it from the UI. This was already so; an automatic start when `server.conf` exists is a worthwhile follow-up.
|
|
- Variant A runs everything as root in one container (as the Profiler container in B); the blast radius is wider than in B.
|
|
- After a rollback the stack runs from the `:previous` images through a generated override; the next `update.sh` run rebuilds and returns to the normal compose file.
|
|
- Not tested: `docker-compose` v1, switching a volume set between A and B, adoption of a hand-started B stack by `update.sh`.
|
|
- Two backups started in the same UTC second collide (the second refuses).
|
|
- A container is not a production host: run the procedure once on the target host before relying on it.
|
|
|
|
## Existing installations
|
|
|
|
A stack started by hand (`docker-compose up`) can be adopted: `update.sh --variant b` records its state on the first run. Data stays in the named volumes.
|