Deploy scripts: compose version check, ovpmon_backup.db in native backups

Docker: variant B needs Docker Compose 2.17+ (additional_contexts); install.sh
and update.sh check it in the preflight. Native: backup.sh, update.sh,
restore.sh and --rollback now copy and restore ovpmon_backup.db (Backup and
Restore settings) as an optional file. Verified install, update, backup,
restore and rollback on Debian 12 (systemd), Alpine 3.23 (OpenRC) and both
container variants.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ayurishchevandClaude Sonnet 5.5 committed 2026-10-07 12:58:42 +03:00
1 parent f8cdcd0fc6
commit 3fac8d70d8
11 files changed
+178 -7

No files matched your search

@@ -55,6 +55,7 @@ Cron example (nightly, 14 kept): `30 3 * * * /opt/OpenVPN-Monitoring-Simple/depl
| Content | File in the backup |
|---|---|
| both databases, consistent copies from the SQLite backup API (integrity-checked, owner and mode kept) | `db/monitor.db`, `db/profiler.db` |
| `ovpmon_backup.db` (settings, destinations and encrypted secrets of the Backup and Restore page; next to the profiler database), same method; optional: skipped if the file does not exist | `db/backupcfg.db` |
| `/etc/ovpmon` (environment, helper configuration, certificate, state) | `etc-ovpmon.tar.gz` |
| `/etc/openvpn` (`server.conf`, `crl.pem`, scripts, `ipp.txt`) | `etc-openvpn.tar.gz` |
| PKI `APP_PROFILER/easy-rsa` | `easy-rsa.tar.gz` |
@@ -74,7 +75,7 @@ deploy/native/restore.sh /var/backups/ovpmon/20261005T101500Z # asks,
deploy/native/restore.sh /var/backups/ovpmon/20261005T101500Z --yes --start
```
It verifies the backup, stops the three application services, saves the **current state** to `/var/backups/ovpmon/<time>-pre-restore` (`OVPMON_NO_SAFETY_BACKUP=1` skips this), then restores code, databases, `/etc/ovpmon`, `/etc/openvpn`, PKI, client profiles, helper, service definitions, nginx site, UI and doas rules. A replaced database is kept as `<db>.failed-<time>`. OpenVPN is not stopped. On a new host run `install.sh` first, then `restore.sh`.
It verifies the backup, stops the three application services, saves the **current state** to `/var/backups/ovpmon/<time>-pre-restore` (`OVPMON_NO_SAFETY_BACKUP=1` skips this), then restores code, databases, `/etc/ovpmon`, `/etc/openvpn`, PKI, client profiles, helper, service definitions, nginx site, UI and doas rules. A replaced database is kept as `<db>.failed-<time>`; `ovpmon_backup.db` is restored from `db/backupcfg.db` if the backup has it (backups of older versions do not: the live file is kept). The local backup packages of the Backup and Restore page (`/var/lib/ovpmon/backups`) are **not** part of the host backup. OpenVPN is not stopped. On a new host run `install.sh` first, then `restore.sh`.
Manual equivalent (services stopped, paths for the default prefix):
@@ -86,6 +87,7 @@ tar -xzpf $B/easy-rsa.tar.gz -C /opt/OpenVPN-Monitoring-Simple/APP_PROFILER
tar -xzpf $B/client-config.tar.gz -C /opt/OpenVPN-Monitoring-Simple/APP_PROFILER
cp -p $B/db/profiler.db /var/lib/ovpmon/ovpn_profiler.db # the backup was made with the sqlite backup API
cp -p $B/db/monitor.db /var/lib/ovpmon/openvpn_monitor.db
cp -p $B/db/backupcfg.db /var/lib/ovpmon/ovpmon_backup.db # only if the backup has it
tar -xzpf $B/etc-ovpmon.tar.gz -C / && tar -xzpf $B/etc-openvpn.tar.gz -C /
tar -xzpf $B/system.tar.gz -C / # helper, service definitions, nginx site
```
+1 -1
View File
@@ -13,7 +13,7 @@ Paths and owners, the environment file, the root helper configuration and securi
| Profiler log | `<prefix>/APP_PROFILER/profiler.log` | `ovpmon:ovpmon` 640 |
| Shipped settings file | `<prefix>/APP_CORE/config.ini`, `<prefix>/APP_PROFILER/config.ini` | `root:root`; the environment file overrides it |
| **Databases** | `/var/lib/ovpmon/openvpn_monitor.db`, `ovpn_profiler.db`, migration copies `*.db.bak-*` | `ovpmon:ovpmon` |
| **Local backup packages** (Backup and Restore page), `ovpmon_backup.db` | `/var/lib/ovpmon/backups/` (created by the service, folders 700, files 600; root set by `OVPMON_BACKUP_LOCAL_ROOT`), `/var/lib/ovpmon/ovpmon_backup.db` | `ovpmon:ovpmon` |
| **Local backup packages** (Backup and Restore page), `ovpmon_backup.db` | `/var/lib/ovpmon/backups/` (created by the service, folders 700, files 600; root set by `OVPMON_BACKUP_LOCAL_ROOT`), `/var/lib/ovpmon/ovpmon_backup.db` (included in the host backup as `db/backupcfg.db`; the packages folder is not) | `ovpmon:ovpmon` |
| Staging of `server.conf` | `/var/lib/ovpmon/staging/` | `ovpmon:ovpmon` 750 |
| Service environment | `/etc/ovpmon/env` | `root:root` 600 |
| Helper configuration | `/etc/ovpmon/helper.conf` | `root:root` 644 |