File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737
3838Перед использованием замените ` YOUR_SERVER_IP ` на реальный IP/домен сервера.
3939
40+
41+ ### Проверка конфигов
42+ ``` bash
43+ ./scripts/validate.sh
44+ ```
45+
46+ Скрипт проверяет YAML/JSON синтаксис, наличие обязательных файлов и запускает ` docker compose config ` , если Docker доступен в системе.
47+
4048### Запуск
4149``` bash
4250docker compose up -d
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ ROOT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd) "
5+ cd " $ROOT_DIR "
6+
7+ echo " [1/4] Validate docker-compose YAML syntax"
8+ ruby -e ' require "yaml"; YAML.load_file("docker-compose.yml"); puts "docker-compose.yml: OK"'
9+
10+ echo " [2/4] Validate JSON configs"
11+ python - << 'PY '
12+ import json
13+ from pathlib import Path
14+
15+ files = [
16+ 'v2ray/server-config.json',
17+ 'client/v2ray-client.example.json',
18+ ]
19+
20+ for f in files:
21+ json.loads(Path(f).read_text(encoding='utf-8'))
22+ print(f"{f}: OK")
23+ PY
24+
25+ echo " [3/4] Check required config files exist"
26+ required=(
27+ " docker-compose.yml"
28+ " wireguard/wg_confs/wg0.conf"
29+ " proxy/3proxy.cfg"
30+ " v2ray/server-config.json"
31+ " client/proxy.env.example"
32+ " client/proxychains.conf"
33+ " client/v2ray-client.example.json"
34+ )
35+
36+ for file in " ${required[@]} " ; do
37+ if [[ ! -f " $file " ]]; then
38+ echo " Missing file: $file " >&2
39+ exit 1
40+ fi
41+ echo " $file : OK"
42+ done
43+
44+ echo " [4/4] Docker Compose semantic validation (if docker exists)"
45+ if command -v docker > /dev/null 2>&1 ; then
46+ docker compose config > /dev/null
47+ echo " docker compose config: OK"
48+ else
49+ echo " docker not found: skip docker compose config"
50+ fi
51+
52+ echo " Validation completed"
You can’t perform that action at this time.
0 commit comments