Files
OpenVPN-Monitoring-Simple/DOCS/Deployment/System_Services/Service_Management.md
T
ayurishchevandClaude Sonnet 5.5 ad6995bb63 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>
2026-10-05 20:30:45 +03:00

2.1 KiB

Service Setup Guide

The OpenVPN Monitor components run as three system services under the unprivileged user ovpmon. deploy/native/install.sh installs and enables them (see System services); this page is the day-to-day reference.

Service Command (working directory under the install dir, default /opt/OpenVPN-Monitoring-Simple) Listens
ovpmon-api APP_CORE/venv/bin/python -m gunicorn -w 2 -b 127.0.0.1:5001 openvpn_api_v3:app 127.0.0.1:5001
ovpmon-gatherer APP_CORE/venv/bin/python openvpn_gatherer_v3.py -
ovpmon-profiler APP_PROFILER/venv/bin/python -m uvicorn main:app --host 127.0.0.1 --port 8000 127.0.0.1:8000

Settings: /etc/ovpmon/env (root:root 600). The services start after the network and do not depend on OpenVPN.

Definitions

  • Alpine (OpenRC): openrc/ovpmon-* in /etc/init.d/ (supervise-daemon, command_user=ovpmon:ovpmon, environment sourced in start_pre, log in /var/log/ovpmon/).
  • Debian / Ubuntu (../../General/systemd): systemd/ovpmon-*.service in /etc/systemd/system/ (User=ovpmon, EnvironmentFile=/etc/ovpmon/env, moderate hardening, log in the journal).

Install them with the scripts (they adjust the install directory); by hand, copy a file, replace /opt/OpenVPN-Monitoring-Simple if needed and enable it as below.

Commands

OpenRC (Alpine) systemd (Debian, Ubuntu)
Enable at boot rc-update add ovpmon-api default systemctl enable ovpmon-api
Start / stop / restart rc-service ovpmon-api start|stop|restart systemctl start|stop|restart ovpmon-api
Status rc-service ovpmon-api status systemctl status ovpmon-api
Log tail -f /var/log/ovpmon/ovpmon-api.log journalctl -u ovpmon-api -f
After editing /etc/ovpmon/env restart the services restart the services
After editing a unit file - systemctl daemon-reload

The OpenVPN server itself (openvpn on Alpine, openvpn-server@server on Debian/Ubuntu) is started and stopped from the UI through the root helper (doas); it is not an ovpmon-* service.