Files
OpenVPN-Monitoring-Simple/DOCS/Deployment/Containers/Reference.md
T
ayurishchevandClaude Sonnet 5.5 3fac8d70d8 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>
2026-10-07 12:58:42 +03:00

5.6 KiB

Containers: reference

Configuration (.env), ports and volumes of the container installation. Install: Containers.

.env reference

Variable Required Default Meaning
JWT_SECRET yes none (compose refuses to start) Signing key of both APIs (OVPMON_API_SECRET_KEY). At least 32 characters, no change-me/changeme: install.sh, update.sh and the all-in-one container refuse a weak value. Changing it logs every user out. Keep the same value across updates
OVPMON_INITIAL_ADMIN_USER, OVPMON_INITIAL_ADMIN_PASSWORD first start only empty Seed for the first user, used only while the users table is empty. Removed by install.sh afterwards
OVPMON_CORS_ORIGINS no empty (off) Comma-separated extra origins; the UI is same-origin behind nginx
OVPMON_HTTP_PORT no 80 Host port of the UI
OVPMON_VPN_PORT no 1194 Host UDP port of OpenVPN (the container side is always 1194)

Variables of the scripts (environment of the shell, not .env): OVPMON_BACKUP_DIR (backup root, default ./backups), OVPMON_BACKUP_IMAGE (helper image, default alpine:3), OVPMON_HEALTH_TIMEOUT (seconds, default 180), OVPMON_MIN_FREE_MB (docker data, default 2048), OVPMON_MIN_FREE_BACKUP_MB (backups, default 1024).

OVPMON_VPN_PORT changes only the host side of the mapping. If you change the OpenVPN port in the server settings of the UI, the client profiles carry that port; keep the two consistent.

Ports

Port Published Purpose
${OVPMON_HTTP_PORT:-80}/tcp yes UI and reverse proxy to both APIs (plain HTTP)
${OVPMON_VPN_PORT:-1194}/udp yes OpenVPN
5001 (monitoring API), 8000 (profiler API) no variant B: exposed on ovp-net only; variant A: listen on 127.0.0.1 inside the container

Volumes: what is stored where

Volume Path in the container Content Mounted by (B)
ovp_logs /var/log/openvpn openvpn-status.log and OpenVPN logs gatherer, profiler
ovp_config /etc/openvpn server.conf generated by the profiler profiler
ovp_pki /app/easy-rsa easy-rsa scripts and pki/ (CA, server and client keys and certificates, CRL, ta.key, dh.pem) profiler
ovp_client_config /app/client-config generated client .ovpn files profiler
db_data /app/db ovpn_profiler.db, openvpn_monitor.db, ovpmon_backup.db (settings of the Backup and Restore page), migration backups *.db.bak-* gatherer, api, profiler
ovp_backups /app/backups local backup packages of the Backup and Restore page (OVPMON_BACKUP_LOCAL_ROOT=/app/backups) profiler

ovp_backups is not one of the five data volumes: deploy/docker/backup.sh and update.sh do not copy it (packages are not put inside copies of the volumes). Back it up separately or use a remote destination. See Backup and Restore.

Variant B, profiler image: besides APP_PROFILER it holds /opt/core (migrations.py, migrate.py, db.py of APP_CORE, standard library only; OVPMON_CORE_DIR=/opt/core), added at build time through the build context core (additional_contexts in docker-compose.yml, docker compose 2.17+; install.sh and update.sh check the version before the build). The restore of a backup package uses it to migrate the monitoring database of the package.

Not stored in volumes (lost when the container is recreated): the container file system, profiler.log and openvpn_gatherer.log (written into the working directory), supervisor state. Application logs go to docker logs.

Volume names are <project>_<volume>; the scripts find them by the compose labels, so any project name works.

Layout of variant A

The code is in /app/APP_CORE and /app/APP_PROFILER; the volumes are mounted at the same paths as in variant B (/app/db, /app/easy-rsa, /app/client-config, /etc/openvpn, /var/log/openvpn).

The profiler resolves easy-rsa/ and client-config/ relative to its working directory (services/pki.py, routers/profiles.py), and stores client-config/<name>.ovpn as a relative path in its database. In variant B that directory is /app. Variant A keeps it that way: supervisord starts the profiler with working directory /app (uvicorn --app-dir /app/APP_PROFILER main:app), so /app/easy-rsa and /app/client-config are the volumes. No symlinks are used, and the database paths are identical in both variants (so a volume set can be used by either variant). The monitoring API and the gatherer run with working directory /app/APP_CORE, where config.ini lives; their database path comes from OVPMON_OPENVPN_MONITOR_DB_PATH=/app/db/openvpn_monitor.db.

Processes in ovp-allinone (deploy/allinone/supervisord.conf, started in this order, all with autorestart, logs to stdout/stderr): gatherer, api (gunicorn -w 2 -b 127.0.0.1:5001 openvpn_api_v3:app), profiler (uvicorn on 127.0.0.1:8000, no reload), nginx. OpenVPN is started by the profiler API on request (direct start inside containers), as in variant B.

deploy/allinone/entrypoint.sh runs before supervisord: secret mapping (JWT_SECRET → OVPMON_API_SECRET_KEY when only the first is set), /dev/net/tun, easy-rsa workspace (copied only when the volume does not have it yet), NAT and MSS rules without duplicates, the nginx configuration rendered from APP_UI/default.conf.template for 127.0.0.1, then the database migration as an explicit step: the container does not start if it fails. The services then run with OVPMON_AUTO_MIGRATE=0 (they only verify the schema).