Files
OpenVPN-Monitoring-Simple/DOCS/General/Service_Management.md
2026-01-28 22:37:47 +03:00

2.2 KiB

Service Setup Guide

This guide describes how to set up the OpenVPN Monitor components as system services.

Components

  1. ovpmon-api: The main Flask API (APP/openvpn_api_v3.py).
  2. ovpmon-gatherer: The background data gatherer (APP/openvpn_gatherer_v3.py).
  3. ovpmon-profiler: The new FastAPI profiler module (NEW_MODULES/main.py).

Common Prerequisites

  • Install Directory: /opt/ovpmon (Recommended)
  • Virtual Environment: /opt/ovpmon/venv

1. Alpine Linux (OpenRC)

Installation

  1. Copy Service Scripts: Copy the scripts from Deployment/APP/openrc/ to /etc/init.d/.

    cp DOCS/General/openrc/ovpmon-api /etc/init.d/
    cp DOCS/General/openrc/ovpmon-gatherer /etc/init.d/
    cp DOCS/General/openrc/ovpmon-profiler /etc/init.d/
    
  2. Set Permissions:

    chmod +x /etc/init.d/ovpmon-*
    
  3. Enable Services:

    rc-update add ovpmon-api default
    rc-update add ovpmon-gatherer default
    rc-update add ovpmon-profiler default
    
  4. Start Services:

    rc-service ovpmon-api start
    rc-service ovpmon-gatherer start
    rc-service ovpmon-profiler start
    

Configuration

To override defaults (e.g., if you installed to a different directory), create files in /etc/conf.d/:

File: /etc/conf.d/ovpmon-api (example)

directory="/var/www/my-monitoring"
command_args="/var/www/my-monitoring/APP_CORE/openvpn_api_v3.py"

2. Debian / Ubuntu (Systemd)

Installation Steps

  1. Copy Service Files: Copy the provided service files from DOCS/General/systemd/ to /etc/systemd/system/.

    cp DOCS/General/systemd/ovpmon-api.service /etc/systemd/system/
    cp DOCS/General/systemd/ovpmon-gatherer.service /etc/systemd/system/
    cp DOCS/General/systemd/ovpmon-profiler.service /etc/systemd/system/
    
  2. Reload Daemon:

    systemctl daemon-reload
    
  3. Enable Services (Start on boot):

    systemctl enable ovpmon-api ovpmon-gatherer ovpmon-profiler
    
  4. Start Services:

    systemctl start ovpmon-api ovpmon-gatherer ovpmon-profiler
    
  5. Check Status:

    systemctl status ovpmon-api