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:
1 parent
f95a0b63e6
commit
ad6995bb63
85 files changed
+2805
-1280
No files matched your search
@@ -0,0 +1,93 @@
|
||||
# Containers (variants A and B)
|
||||
|
||||
Install the whole suite with Docker: nothing but Docker is needed on the host. This page: choose a variant, check the requirements, install. Next pages: [Operations](Operations.md) (update, backup, rollback), [Reference](Reference.md) (`.env`, ports, volumes), [Troubleshooting](Troubleshooting.md).
|
||||
|
||||
## Quick start
|
||||
|
||||
On a host with Docker (root or a member of the `docker` group):
|
||||
|
||||
```bash
|
||||
git clone <repository> && cd OpenVPN-Monitoring-Simple
|
||||
deploy/docker/install.sh --variant b # or --variant a, see the table below
|
||||
```
|
||||
|
||||
The script prints the URL and the **administrator login and password (shown once)**. Open the URL, then follow [First steps](../First_Steps.md).
|
||||
|
||||
## Variants
|
||||
|
||||
Two variants, both installed and updated by the scripts in `deploy/docker/`:
|
||||
|
||||
| | Variant A: one container | Variant B: one container per component |
|
||||
|---|---|---|
|
||||
| Compose file | `docker-compose.allinone.yml` | `docker-compose.yml` |
|
||||
| Containers | `ovp-allinone` (nginx, gunicorn, gatherer, uvicorn, OpenVPN under `supervisord`) | `ovp-ui`, `ovp-api`, `ovp-gatherer`, `ovp-profiler` |
|
||||
| Image build | `deploy/allinone/Dockerfile` (build context: repository root) | one Dockerfile per component (`APP_UI`, `APP_CORE`, `APP_PROFILER`) |
|
||||
| Choose it when | one host, simplest operation, one thing to start/stop/back up | you want to restart, scale or inspect components separately, or follow the usual one-process-per-container practice |
|
||||
| Trade-off | a failing process is restarted by `supervisord`, the container stays up; one image to rebuild for any change | more moving parts, internal network `ovp-net` |
|
||||
|
||||
Both variants use the **same five named volumes with the same in-container paths**, the same environment variables and the same published ports. Backups look identical.
|
||||
|
||||
> **Only one variant can run per host.** Both publish the same host ports (`80/tcp`, `1194/udp` by default) and use fixed container names (`ovp-*`). The scripts refuse to start a variant while a container of the other one is running.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Docker Engine with the compose plugin (`docker compose`, v2, preferred) or `docker-compose`.
|
||||
- The Docker daemon running and usable by the user that runs the scripts (root, or a member of the `docker` group).
|
||||
- Access to `/dev/net/tun` on the host and the `NET_ADMIN` capability (already set in the compose files).
|
||||
- Free disk space: about 2 GB for images and builds, plus room for backups (the scripts check both).
|
||||
- Internet access for the first build (base images, npm, pip) and for the backup helper image (`alpine:3`). For offline hosts see [Troubleshooting](Troubleshooting.md).
|
||||
- `openssl` is optional (random secret otherwise comes from `/dev/urandom`).
|
||||
|
||||
## Install
|
||||
|
||||
Clone the repository, change into it and run the script (as root or a docker user):
|
||||
|
||||
```bash
|
||||
# Variant B: one container per component
|
||||
deploy/docker/install.sh --variant b
|
||||
|
||||
# Variant A: everything in one container
|
||||
deploy/docker/install.sh --variant a
|
||||
|
||||
# Options
|
||||
deploy/docker/install.sh --variant b --project ovpmon --http-port 8080 --vpn-port 1194 --admin-user admin
|
||||
```
|
||||
|
||||
| Option | Meaning |
|
||||
|---|---|
|
||||
| `--variant a\|b` | required |
|
||||
| `--project NAME` | compose project name = prefix of the volume names (default `ovpmon`: volumes `ovpmon_db_data`, ...) |
|
||||
| `--http-port N` | host port of the UI (written to `.env` as `OVPMON_HTTP_PORT`, default 80) |
|
||||
| `--vpn-port N` | host UDP port of OpenVPN (`OVPMON_VPN_PORT`, default 1194) |
|
||||
| `--admin-user NAME` | login of the first administrator (default `admin`) |
|
||||
|
||||
What `install.sh` does:
|
||||
|
||||
1. **Preflight:** docker and compose, running daemon, the other variant is not running, no foreign container with the same names, ports free, free disk space.
|
||||
2. **`.env`** next to the compose files, only if it does not exist: mode 600, random `JWT_SECRET`, initial administrator with a generated 24-character password. An existing `.env` is never overwritten (`--http-port` / `--vpn-port` only set their own keys in it).
|
||||
3. **Build, start** (`docker compose up -d`), write the state file `.ovpmon-deploy` (variant and project; used by `update.sh`, `backup.sh`, `restore.sh`), wait up to 3 minutes for the health checks.
|
||||
4. **Initial administrator:** when the users table is not empty, `OVPMON_INITIAL_ADMIN_*` are removed from `.env` and the container that reads them is recreated (variant B: `app-api`, variant A: `ovpmon`). If the table cannot be read or is empty, the lines stay in `.env` and a warning says so.
|
||||
5. **Result:** URL, ports, and the administrator login and password. **The password is shown once** and stored nowhere else. `JWT_SECRET` is never printed.
|
||||
|
||||
Running it again is safe: it rebuilds and starts, keeps `.env`, and makes no new administrator.
|
||||
|
||||
Then follow [First steps](../First_Steps.md) (sign in, initialize the PKI, start the VPN server). Put TLS in front of the UI (see [Security](Troubleshooting.md#security)).
|
||||
|
||||
### Without the script
|
||||
|
||||
```bash
|
||||
cat > .env <<EOT
|
||||
JWT_SECRET=$(openssl rand -hex 32)
|
||||
OVPMON_INITIAL_ADMIN_USER=admin
|
||||
OVPMON_INITIAL_ADMIN_PASSWORD=<strong password>
|
||||
EOT
|
||||
chmod 600 .env
|
||||
docker compose up -d --build # variant B
|
||||
docker compose -f docker-compose.allinone.yml up -d --build # variant A
|
||||
```
|
||||
|
||||
After the first start remove the two `OVPMON_INITIAL_ADMIN_*` lines from `.env` and recreate `app-api` (B) or `ovpmon` (A).
|
||||
|
||||
## Next
|
||||
|
||||
[First steps](../First_Steps.md) · [Operations](Operations.md) · [Reference](Reference.md) · [Troubleshooting](Troubleshooting.md) · [Choose another method](../README.md)
|
||||
Reference in new issue
Block a user