fix: start WireGuard to generate wg0.conf before key injection

This commit is contained in:
Zenaku 2026-09-30 22:11:17 +02:00
parent 97b52bbbea
commit 00ab41ba19

View file

@ -80,9 +80,22 @@ fi
ok "Backups found."
[ -d "$OPERATOR_DIR" ] || fail "operator-docker not found. Run 01 first."
[ -f "$WG_CONF" ] || fail "wg0.conf not found: $WG_CONF"
ok "operator-docker found."
# ─── Start WireGuard once to generate wg0.conf ───────────────────────────────
if [ ! -f "$WG_CONF" ]; then
info "wg0.conf not found — starting WireGuard to generate it..."
cd "$OPERATOR_DIR"
docker compose up -d wireguard
for i in $(seq 1 15); do
[ -f "$WG_CONF" ] && break
sleep 2
done
[ -f "$WG_CONF" ] || fail "wg0.conf not generated after 30s. Check: docker logs wireguard"
docker compose stop wireguard
ok "wg0.conf generated."
fi
for CONTAINER in operator-api mysql; do
STATUS=$(docker inspect -f '{{.State.Running}}' "$CONTAINER" 2>/dev/null || echo "false")
[ "$STATUS" = "true" ] || fail "Container '$CONTAINER' is not running."