fix: start WireGuard to generate wg0.conf before key injection
This commit is contained in:
parent
97b52bbbea
commit
00ab41ba19
1 changed files with 14 additions and 1 deletions
|
|
@ -80,9 +80,22 @@ fi
|
||||||
ok "Backups found."
|
ok "Backups found."
|
||||||
|
|
||||||
[ -d "$OPERATOR_DIR" ] || fail "operator-docker not found. Run 01 first."
|
[ -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."
|
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
|
for CONTAINER in operator-api mysql; do
|
||||||
STATUS=$(docker inspect -f '{{.State.Running}}' "$CONTAINER" 2>/dev/null || echo "false")
|
STATUS=$(docker inspect -f '{{.State.Running}}' "$CONTAINER" 2>/dev/null || echo "false")
|
||||||
[ "$STATUS" = "true" ] || fail "Container '$CONTAINER' is not running."
|
[ "$STATUS" = "true" ] || fail "Container '$CONTAINER' is not running."
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue