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>
138 lines
4.1 KiB
YAML
138 lines
4.1 KiB
YAML
# OpenVPN Monitor & Profiler (containers)
|
|
# Required: JWT_SECRET in .env (openssl rand -hex 32)
|
|
# First start only: OVPMON_INITIAL_ADMIN_USER / OVPMON_INITIAL_ADMIN_PASSWORD in .env
|
|
# Optional: OVPMON_CORS_ORIGINS (comma-separated origins; off by default, UI is same-origin via Nginx)
|
|
# Optional: OVPMON_HTTP_PORT (host port of the UI, default 80), OVPMON_VPN_PORT (host UDP port of OpenVPN, default 1194)
|
|
# Install/update with the scripts in deploy/docker (see DOCS/Deployment/Containers/README.md)
|
|
|
|
x-secret: &jwt-secret
|
|
OVPMON_API_SECRET_KEY: ${JWT_SECRET:?JWT_SECRET must be set in .env (openssl rand -hex 32)}
|
|
|
|
services:
|
|
app-ui:
|
|
build: ./APP_UI
|
|
container_name: ovp-ui
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${OVPMON_HTTP_PORT:-80}:80"
|
|
depends_on:
|
|
- app-api
|
|
- app-profiler
|
|
networks:
|
|
- ovp-net
|
|
environment:
|
|
OVP_API_HOST: ovp-api
|
|
OVP_API_PORT: 5001
|
|
OVP_PROFILER_HOST: ovp-profiler
|
|
OVP_PROFILER_PORT: 8000
|
|
healthcheck:
|
|
# busybox wget exists in nginx:alpine
|
|
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1/"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
app-gatherer:
|
|
build:
|
|
context: ./APP_CORE
|
|
dockerfile: Dockerfile.gatherer
|
|
container_name: ovp-gatherer
|
|
restart: unless-stopped
|
|
volumes:
|
|
- ovp_logs:/var/log/openvpn
|
|
- db_data:/app/db
|
|
depends_on:
|
|
- app-profiler
|
|
networks:
|
|
- ovp-net
|
|
environment:
|
|
OVPMON_OPENVPN_MONITOR_DB_PATH: /app/db/openvpn_monitor.db
|
|
OVPMON_OPENVPN_MONITOR_LOG_PATH: /var/log/openvpn/openvpn-status.log
|
|
OVPMON_LOGGING_LEVEL: INFO
|
|
healthcheck:
|
|
# Process check: the gatherer is PID 1 of its container (CMD python openvpn_gatherer_v3.py)
|
|
test: ["CMD", "python", "-c", "import sys; sys.exit(0 if b'openvpn_gatherer_v3.py' in open('/proc/1/cmdline', 'rb').read() else 1)"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 30s
|
|
|
|
app-api:
|
|
build:
|
|
context: ./APP_CORE
|
|
dockerfile: Dockerfile.api
|
|
container_name: ovp-api
|
|
restart: unless-stopped
|
|
# Not published: reached only through app-ui (Nginx) on ovp-net
|
|
expose:
|
|
- "5001"
|
|
volumes:
|
|
- db_data:/app/db
|
|
networks:
|
|
- ovp-net
|
|
depends_on:
|
|
- app-gatherer
|
|
environment:
|
|
<<: *jwt-secret
|
|
OVPMON_API_PORT: 5001
|
|
OVPMON_OPENVPN_MONITOR_DB_PATH: /app/db/openvpn_monitor.db
|
|
OVPMON_LOGGING_LEVEL: INFO
|
|
# Initial admin: used only while the users table is empty (remove after first start)
|
|
OVPMON_INITIAL_ADMIN_USER: ${OVPMON_INITIAL_ADMIN_USER:-}
|
|
OVPMON_INITIAL_ADMIN_PASSWORD: ${OVPMON_INITIAL_ADMIN_PASSWORD:-}
|
|
OVPMON_CORS_ORIGINS: ${OVPMON_CORS_ORIGINS:-}
|
|
healthcheck:
|
|
# TCP connect to the Flask port
|
|
test: ["CMD", "python", "-c", "import socket; socket.create_connection(('127.0.0.1', 5001), 3).close()"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 30s
|
|
|
|
app-profiler:
|
|
build: ./APP_PROFILER
|
|
container_name: ovp-profiler
|
|
restart: unless-stopped
|
|
cap_add:
|
|
- NET_ADMIN
|
|
sysctls:
|
|
- net.ipv4.ip_forward=1
|
|
devices:
|
|
- "/dev/net/tun:/dev/net/tun"
|
|
ports:
|
|
# VPN port only; the profiler API (8000) is reached through app-ui
|
|
- "${OVPMON_VPN_PORT:-1194}:1194/udp"
|
|
expose:
|
|
- "8000"
|
|
volumes:
|
|
- ovp_logs:/var/log/openvpn
|
|
- ovp_config:/etc/openvpn
|
|
- db_data:/app/db
|
|
- ovp_client_config:/app/client-config
|
|
- ovp_pki:/app/easy-rsa
|
|
networks:
|
|
- ovp-net
|
|
environment:
|
|
<<: *jwt-secret
|
|
OVPMON_PROFILER_DB_PATH: /app/db/ovpn_profiler.db
|
|
OVPMON_CORS_ORIGINS: ${OVPMON_CORS_ORIGINS:-}
|
|
healthcheck:
|
|
# GET / of the FastAPI app must answer 200
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/', timeout=3)"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
networks:
|
|
ovp-net:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
ovp_logs:
|
|
ovp_config:
|
|
ovp_pki:
|
|
ovp_client_config:
|
|
db_data:
|