init commit

This commit is contained in:
Антон
2026-01-09 01:05:50 +03:00
commit c9af0a5bb1
28 changed files with 3934 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
# OpenRC Service Installation Guide
This guide explains how to install and enable the `ovpmon-api` and `ovpmon-gatherer` services on an Alpine Linux (or other OpenRC-based) system.
## Prerequisites
- **Paths**: The scripts assume the application is installed at `/opt/ovpmon`.
- **Virtualenv**: A python virtual environment should exist at `/opt/ovpmon/venv`.
If your paths differ, you can edit the scripts directly or create configuration files in `/etc/conf.d/`.
## Installation Steps
1. **Copy the scripts to `/etc/init.d/`**:
```sh
cp ovpmon-api /etc/init.d/
cp ovpmon-gatherer /etc/init.d/
```
2. **Make them executable**:
```sh
chmod 755 /etc/init.d/ovpmon-api
chmod 755 /etc/init.d/ovpmon-gatherer
```
3. **Add to default runlevel** (to start on boot):
```sh
rc-update add ovpmon-api default
rc-update add ovpmon-gatherer default
```
4. **Start the services**:
```sh
rc-service ovpmon-api start
rc-service ovpmon-gatherer start
```
## Configuration (Optional)
You can override default variables without editing the script by creating files in `/etc/conf.d/`.
**Example `/etc/conf.d/ovpmon-api`**:
```sh
# Override installation directory
directory="/var/www/ovpmon/APP"
# Override command arguments
command_args="/var/www/ovpmon/APP/openvpn_api_v3.py --debug"
```

View File

@@ -0,0 +1,16 @@
#!/sbin/openrc-run
name="ovpmon-api"
description="OpenVPN Monitor API Service"
supervisor="supervise-daemon"
: ${directory:="/opt/ovpmon/APP"}
: ${command_user:="root"}
command="/opt/ovpmon/venv/bin/python"
command_args="/opt/ovpmon/APP/openvpn_api_v3.py"
depend() {
need net
after firewall
}

View File

@@ -0,0 +1,16 @@
#!/sbin/openrc-run
name="ovpmon-gatherer"
description="OpenVPN Monitor Gatherer Service"
supervisor="supervise-daemon"
: ${directory:="/opt/ovpmon/APP"}
: ${command_user:="root"}
command="/opt/ovpmon/venv/bin/python"
command_args="/opt/ovpmon/APP/openvpn_gatherer_v3.py"
depend() {
need net
after firewall
}