2026-01-28 22:37:47 +03:00
|
|
|
#!/sbin/openrc-run
|
2026-10-05 10:45:24 +03:00
|
|
|
# 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.
|
2026-01-28 22:37:47 +03:00
|
|
|
|
|
|
|
|
name="ovpmon-profiler"
|
2026-10-05 10:45:24 +03:00
|
|
|
description="OpenVPN Profiler API (uvicorn)"
|
|
|
|
|
|
2026-01-28 22:37:47 +03:00
|
|
|
supervisor="supervise-daemon"
|
2026-10-05 10:45:24 +03:00
|
|
|
respawn_delay=3
|
|
|
|
|
respawn_max=0
|
2026-01-28 22:37:47 +03:00
|
|
|
|
2026-10-05 10:45:24 +03:00
|
|
|
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"
|
2026-01-28 22:37:47 +03:00
|
|
|
|
2026-10-05 10:45:24 +03:00
|
|
|
output_log="/var/log/ovpmon/ovpmon-profiler.log"
|
|
|
|
|
error_log="/var/log/ovpmon/ovpmon-profiler.log"
|
2026-01-28 22:37:47 +03:00
|
|
|
|
|
|
|
|
depend() {
|
|
|
|
|
need net
|
|
|
|
|
after firewall
|
|
|
|
|
}
|
2026-10-05 10:45:24 +03:00
|
|
|
|
|
|
|
|
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"
|
|
|
|
|
}
|