Scenario 2: install and update as system services (Alpine, Debian, Ubuntu)
- deploy/native: install.sh, update.sh (backup, new code prepared aside, stop services, separate DB migration phase, start, automatic rollback; OpenVPN keeps running), backup.sh, restore.sh, build-ui.sh (Node 20 container), lib.sh OS adapter (OpenRC and systemd). - Root helper reads /etc/ovpmon/helper.conf (service manager, unit, config path), validated strictly; process.py/server.py honour OVPMON_RUNTIME, OVPMON_OPENVPN_SERVICE, OVPMON_OPENVPN_CONFIG. Debian/Ubuntu use openvpn-server@server and /etc/openvpn/server/server.conf. - Service definitions rewritten (systemd, OpenRC). Fixes found by real runs: no seccomp-based options in the profiler unit (they imply NoNewPrivileges and break setuid doas); OpenRC start_pre extends PATH instead of replacing it; helper syntax check works on a read-only tree. - Verified in containers with real init systems (Debian 12, Ubuntu 24.04, Alpine 3.23): install, PKI/server config/OpenVPN start, update on pre-versioned databases, rollback, backup/restore. - Test: test_helper_config.py. Docs: Scenario 2 guide, change summary, README, Index. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1c49d0b9c2
commit
4abd2044f0
26 files changed
+3326
-255
No files matched your search
Regular → Executable
+29
-5
@@ -1,16 +1,40 @@
|
||||
#!/sbin/openrc-run
|
||||
# managed by ovpmon deploy/native (install.sh / update.sh replace this file only while this marker line is present)
|
||||
#
|
||||
# OpenVPN Profiler API (FastAPI under uvicorn, APP_PROFILER), OpenRC (Alpine): PKI (easy-rsa),
|
||||
# profiles, server settings. Install: see ovpmon-api. Settings come from /etc/ovpmon/env.
|
||||
#
|
||||
# Runs as ovpmon. Anything that needs root (install server.conf, publish the CRL, start/stop OpenVPN)
|
||||
# goes through `doas /usr/local/sbin/ovpmon-helper <fixed args>` (rules: /etc/doas.conf or
|
||||
# /etc/doas.d/ovpmon.conf, configuration: /etc/ovpmon/helper.conf).
|
||||
# Started without --reload and without depending on openvpn.
|
||||
|
||||
name="ovpmon-profiler"
|
||||
description="OpenVPN Monitor Profiler Service (FastAPI)"
|
||||
description="OpenVPN Profiler API (uvicorn)"
|
||||
|
||||
supervisor="supervise-daemon"
|
||||
respawn_delay=3
|
||||
respawn_max=0
|
||||
|
||||
: ${directory:="/opt/ovpmon/NEW_MODULES"}
|
||||
: ${command_user:="root"}
|
||||
command_user="ovpmon:ovpmon"
|
||||
directory="/opt/OpenVPN-Monitoring-Simple/APP_PROFILER"
|
||||
command="/opt/OpenVPN-Monitoring-Simple/APP_PROFILER/venv/bin/python"
|
||||
command_args="-m uvicorn main:app --host 127.0.0.1 --port 8000"
|
||||
|
||||
command="/opt/ovpmon/venv/bin/python"
|
||||
command_args="/opt/ovpmon/NEW_MODULES/main.py"
|
||||
output_log="/var/log/ovpmon/ovpmon-profiler.log"
|
||||
error_log="/var/log/ovpmon/ovpmon-profiler.log"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
after firewall
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
checkpath -f -m 0640 -o ovpmon:ovpmon "$output_log" || return 1
|
||||
[ -r /etc/ovpmon/env ] || { eerror "/etc/ovpmon/env is missing"; return 1; }
|
||||
set -a
|
||||
. /etc/ovpmon/env
|
||||
set +a
|
||||
# extend, never replace: OpenRC itself needs /lib/rc/bin (ebegin, eend) on the PATH
|
||||
export PATH="/usr/local/sbin:/usr/local/bin:$PATH"
|
||||
}
|
||||
Reference in new issue
Block a user