Scenario 1: container install and update (all-in-one and per-component)
- Variant B: docker-compose.yml gets configurable host ports and health checks. Variant A: deploy/allinone image (nginx, supervisord, gunicorn, uvicorn, gatherer, OpenVPN) with an explicit database migration step before any service; docker-compose.allinone.yml. Same five volumes and paths in both variants. - deploy/docker: install.sh, update.sh (backup, build, stop, separate DB migration phase, start, automatic rollback), backup.sh, restore.sh, lib.sh. - Verified on Docker: install A/B, update with pre-versioned databases, rollback after an injected failure, backup/restore. - Docs: Scenario1_Containers guide, change summary, README, Index; .dockerignore, .gitignore additions. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e556d6d4b9
commit
1c49d0b9c2
17 files changed
+1930
-50
No files matched your search
@@ -0,0 +1,64 @@
|
||||
# OpenVPN Monitor & Profiler: ALL components in ONE container (scenario 1, variant A)
|
||||
# Required: JWT_SECRET in .env (openssl rand -hex 32)
|
||||
# First start only: OVPMON_INITIAL_ADMIN_USER / OVPMON_INITIAL_ADMIN_PASSWORD in .env
|
||||
# Optional: OVPMON_CORS_ORIGINS, OVPMON_HTTP_PORT (host port of the UI, default 80),
|
||||
# OVPMON_VPN_PORT (host UDP port of OpenVPN, default 1194)
|
||||
# Install/update with the scripts in deploy/docker (see DOCS/Deployment/Scenario1_Containers.md)
|
||||
#
|
||||
# Variants A (this file) and B (docker-compose.yml) publish the same host ports and use fixed
|
||||
# container names (ovp-*): run only ONE variant per host. Both use the same five volumes with the
|
||||
# same in-container paths, so backups are identical and data of one variant can be used by the other.
|
||||
|
||||
services:
|
||||
ovpmon:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: deploy/allinone/Dockerfile
|
||||
container_name: ovp-allinone
|
||||
restart: unless-stopped
|
||||
stop_grace_period: 20s
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
sysctls:
|
||||
- net.ipv4.ip_forward=1
|
||||
devices:
|
||||
- "/dev/net/tun:/dev/net/tun"
|
||||
ports:
|
||||
# UI (Nginx) and VPN port only; both APIs listen on 127.0.0.1 inside the container
|
||||
- "${OVPMON_HTTP_PORT:-80}:80"
|
||||
- "${OVPMON_VPN_PORT:-1194}:1194/udp"
|
||||
volumes:
|
||||
- ovp_logs:/var/log/openvpn
|
||||
- ovp_config:/etc/openvpn
|
||||
- ovp_pki:/app/easy-rsa
|
||||
- ovp_client_config:/app/client-config
|
||||
- db_data:/app/db
|
||||
environment:
|
||||
OVPMON_API_SECRET_KEY: ${JWT_SECRET:?JWT_SECRET must be set in .env (openssl rand -hex 32)}
|
||||
OVPMON_API_PORT: 5001
|
||||
OVPMON_PROFILER_DB_PATH: /app/db/ovpn_profiler.db
|
||||
OVPMON_OPENVPN_MONITOR_DB_PATH: /app/db/openvpn_monitor.db
|
||||
OVPMON_OPENVPN_MONITOR_LOG_PATH: /var/log/openvpn/openvpn-status.log
|
||||
OVPMON_LOGGING_LEVEL: INFO
|
||||
# Initial admin: used only while the users table is empty (remove after first start)
|
||||
OVPMON_INITIAL_ADMIN_USER: ${OVPMON_INITIAL_ADMIN_USER:-}
|
||||
OVPMON_INITIAL_ADMIN_PASSWORD: ${OVPMON_INITIAL_ADMIN_PASSWORD:-}
|
||||
OVPMON_CORS_ORIGINS: ${OVPMON_CORS_ORIGINS:-}
|
||||
healthcheck:
|
||||
# UI through Nginx, profiler root (FastAPI) and TCP connect to the Flask API
|
||||
test:
|
||||
- "CMD"
|
||||
- "python"
|
||||
- "-c"
|
||||
- "import socket, urllib.request as u; u.urlopen('http://127.0.0.1/', timeout=3); u.urlopen('http://127.0.0.1:8000/', timeout=3); socket.create_connection(('127.0.0.1', 5001), 3).close()"
|
||||
interval: 30s
|
||||
timeout: 8s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
|
||||
volumes:
|
||||
ovp_logs:
|
||||
ovp_config:
|
||||
ovp_pki:
|
||||
ovp_client_config:
|
||||
db_data:
|
||||
Reference in new issue
Block a user