mirror of
https://github.com/angristan/openvpn-install.git
synced 2025-12-14 08:12:41 +01:00
## Summary - Add comprehensive logging system with color-coded log levels ([INFO], [WARN], [ERROR], [OK]) - Wrap all command executions with `run_cmd()` to capture output and prevent leaks to stdout - Add file logging with timestamps (default: `openvpn-install.log`) - Suppress interactive prompts in auto-install mode for cleaner CI/scripted usage - Show log file location hint on errors for easier debugging ## Changes - **openvpn-install.sh**: New logging functions (`log_info`, `log_warn`, `log_error`, `log_fatal`, `log_success`, `log_prompt`, `log_header`, `log_menu`, `run_cmd`), all `echo` statements converted to use logging functions - **test/validate-output.sh**: New E2E validator that ensures all script output uses proper log formatting (catches raw echo leaks) - **test/server-entrypoint.sh**: Integrates output validation into Docker tests - **test/Dockerfile.server**: Copies validation script into container ## Configuration - `VERBOSE=1` - Show command output in terminal - `LOG_FILE=path` - Customize log location (default: `openvpn-install.log`) - `LOG_FILE=""` - Disable file logging - `FORCE_COLOR=1` - Force colored output in non-TTY environments
56 lines
1.1 KiB
YAML
56 lines
1.1 KiB
YAML
---
|
|
services:
|
|
openvpn-server:
|
|
build:
|
|
context: .
|
|
dockerfile: test/Dockerfile.server
|
|
args:
|
|
BASE_IMAGE: ${BASE_IMAGE:-ubuntu:24.04}
|
|
container_name: openvpn-server
|
|
hostname: openvpn-server
|
|
cap_add:
|
|
- NET_ADMIN
|
|
devices:
|
|
- /dev/net/tun:/dev/net/tun
|
|
sysctls:
|
|
- net.ipv4.ip_forward=1
|
|
volumes:
|
|
- shared-config:/shared
|
|
networks:
|
|
vpn-test:
|
|
ipv4_address: 172.28.0.10
|
|
healthcheck:
|
|
test: ["CMD", "pgrep", "openvpn"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 30
|
|
|
|
openvpn-client:
|
|
build:
|
|
context: .
|
|
dockerfile: test/Dockerfile.client
|
|
container_name: openvpn-client
|
|
hostname: openvpn-client
|
|
cap_add:
|
|
- NET_ADMIN
|
|
devices:
|
|
- /dev/net/tun:/dev/net/tun
|
|
volumes:
|
|
- shared-config:/shared:ro
|
|
networks:
|
|
vpn-test:
|
|
ipv4_address: 172.28.0.20
|
|
depends_on:
|
|
openvpn-server:
|
|
condition: service_healthy
|
|
|
|
volumes:
|
|
shared-config:
|
|
|
|
networks:
|
|
vpn-test:
|
|
driver: bridge
|
|
ipam:
|
|
config:
|
|
- subnet: 172.28.0.0/24
|