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
+32
-2
@@ -2,6 +2,8 @@
|
||||
# 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 (comma-separated origins; off by default, UI is same-origin via Nginx)
|
||||
# Optional: 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)
|
||||
|
||||
x-secret: &jwt-secret
|
||||
OVPMON_API_SECRET_KEY: ${JWT_SECRET:?JWT_SECRET must be set in .env (openssl rand -hex 32)}
|
||||
@@ -12,7 +14,7 @@ services:
|
||||
container_name: ovp-ui
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
- "${OVPMON_HTTP_PORT:-80}:80"
|
||||
depends_on:
|
||||
- app-api
|
||||
- app-profiler
|
||||
@@ -23,6 +25,13 @@ services:
|
||||
OVP_API_PORT: 5001
|
||||
OVP_PROFILER_HOST: ovp-profiler
|
||||
OVP_PROFILER_PORT: 8000
|
||||
healthcheck:
|
||||
# busybox wget exists in nginx:alpine
|
||||
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1/"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
|
||||
app-gatherer:
|
||||
build:
|
||||
@@ -41,6 +50,13 @@ services:
|
||||
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
|
||||
healthcheck:
|
||||
# Process check: the gatherer is PID 1 of its container (CMD python openvpn_gatherer_v3.py)
|
||||
test: ["CMD", "python", "-c", "import sys; sys.exit(0 if b'openvpn_gatherer_v3.py' in open('/proc/1/cmdline', 'rb').read() else 1)"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
app-api:
|
||||
build:
|
||||
@@ -66,6 +82,13 @@ services:
|
||||
OVPMON_INITIAL_ADMIN_USER: ${OVPMON_INITIAL_ADMIN_USER:-}
|
||||
OVPMON_INITIAL_ADMIN_PASSWORD: ${OVPMON_INITIAL_ADMIN_PASSWORD:-}
|
||||
OVPMON_CORS_ORIGINS: ${OVPMON_CORS_ORIGINS:-}
|
||||
healthcheck:
|
||||
# TCP connect to the Flask port
|
||||
test: ["CMD", "python", "-c", "import socket; socket.create_connection(('127.0.0.1', 5001), 3).close()"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
app-profiler:
|
||||
build: ./APP_PROFILER
|
||||
@@ -79,7 +102,7 @@ services:
|
||||
- "/dev/net/tun:/dev/net/tun"
|
||||
ports:
|
||||
# VPN port only; the profiler API (8000) is reached through app-ui
|
||||
- "1194:1194/udp"
|
||||
- "${OVPMON_VPN_PORT:-1194}:1194/udp"
|
||||
expose:
|
||||
- "8000"
|
||||
volumes:
|
||||
@@ -94,6 +117,13 @@ services:
|
||||
<<: *jwt-secret
|
||||
OVPMON_PROFILER_DB_PATH: /app/db/ovpn_profiler.db
|
||||
OVPMON_CORS_ORIGINS: ${OVPMON_CORS_ORIGINS:-}
|
||||
healthcheck:
|
||||
# GET / of the FastAPI app must answer 200
|
||||
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/', timeout=3)"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
networks:
|
||||
ovp-net:
|
||||
|
||||
Reference in new issue
Block a user