Setup script fixes: - _cidr_to_mask: pad to 4 octets (/24 -> 255.255.255.0) - UCI quoting: remove embedded shell quotes from uci set calls - Bridge ports: auto-detect zt* interface instead of hardcoding ztabc0 - Bridge netmask: default to /23 (255.255.254.0) for ZT+WIBLAN - DHCP/WiFi AP: reference interface name (zt_wiblan) not device name (br_zt) - Firewall zone: add zt_wiblan to LAN zone for nftables fw4 - ZT IP persistence: ensure ZT-assigned IP stays on interface for ARP - Exit gateway routing: table 100/101 route via exit gateway, not self - New setup-wifi-ap subcommand for WIBLAN WiFi AP UBUS handler: - Add setup-wifi-ap to validation regex and error message Deploy task: - Auto-discover files from root/ and htdocs/ instead of hardcoded list - Clear LuCI cache before restarting services Documentation: - New docs/SETUP-GATEWAY.md with architecture, config, pitfalls, checklist - Updated docs/INSTALL.md with deploy task and setup wizard sections - Updated docs/PROGRESS.md with session log and learnings
118 lines
3.5 KiB
TOML
118 lines
3.5 KiB
TOML
[tools]
|
|
node = "22.17.0"
|
|
|
|
[tasks.setup]
|
|
description = "Install Node deps and Playwright browsers"
|
|
run = """
|
|
if [ ! -d node_modules ]; then npm install; fi
|
|
npx playwright install chromium
|
|
"""
|
|
|
|
[tasks."docker:build"]
|
|
description = "Build OpenWRT LuCI image with podman (seccomp bypass for apk)"
|
|
run = "podman build --security-opt seccomp=unconfined -t zt-gateway-luci:dev -f Dockerfile.openwrt ."
|
|
[tasks."docker:up"]
|
|
description = "Build image + start the full test stack (router + ZT gateways + LuCI)"
|
|
depends = ["docker:build"]
|
|
run = "docker compose up -d"
|
|
|
|
[tasks."docker:down"]
|
|
description = "Stop the test stack"
|
|
run = "docker compose down"
|
|
|
|
[tasks."docker:logs"]
|
|
description = "View OpenWRT LuCI container logs"
|
|
run = "docker compose logs -f openwrt-luci"
|
|
|
|
[tasks."docker:shell"]
|
|
description = "Open shell in the OpenWRT LuCI container"
|
|
run = "docker compose exec openwrt-luci sh"
|
|
|
|
[tasks."test:e2e"]
|
|
description = "Run Playwright E2E tests (assumes stack is up)"
|
|
depends = ["setup"]
|
|
run = "npx playwright test"
|
|
|
|
[tasks."test:e2e:ui"]
|
|
description = "Run Playwright tests in interactive UI mode"
|
|
depends = ["setup"]
|
|
run = "npx playwright test --ui"
|
|
|
|
[tasks."test:e2e:headed"]
|
|
description = "Run Playwright tests in headed (visible) browser"
|
|
depends = ["setup"]
|
|
run = "npx playwright test --headed"
|
|
|
|
[tasks."test:e2e:debug"]
|
|
description = "Run Playwright tests in debug mode"
|
|
depends = ["setup"]
|
|
run = "npx playwright test --debug"
|
|
|
|
[tasks."inspect"]
|
|
description = "Start stack and open headed browser for manual inspection"
|
|
depends = ["docker:up"]
|
|
run = "npx playwright open chromium http://localhost:8080/cgi-bin/luci/admin/services/zt-gateway"
|
|
|
|
[tasks."reset"]
|
|
description = "Reset gateway state to amsterdam (default) via docker exec"
|
|
run = """
|
|
docker exec openwrt-luci /usr/sbin/zt-gateway-switch 10.99.12.3 force
|
|
docker exec openwrt-luci sh -c "uci set zt-gateway.global.active_gateway=amsterdam && uci commit zt-gateway" || true
|
|
"""
|
|
|
|
[tasks.ci]
|
|
description = "Full CI: build stack + install browsers + run E2E"
|
|
depends = ["docker:up", "setup"]
|
|
run = "npx playwright test"
|
|
|
|
|
|
# ===============================
|
|
# Deployment
|
|
# ===============================
|
|
|
|
[tasks."deploy:install"]
|
|
description = "SCP app files to an OpenWrt device and restart services"
|
|
run = '''
|
|
set -e
|
|
|
|
HOST="${HOST:-root@192.168.15.1}"
|
|
|
|
echo "==> Checking connectivity to ${HOST}..."
|
|
if ! ssh -o ConnectTimeout=5 -o BatchMode=yes "$HOST" true 2>/dev/null; then
|
|
echo "ERROR: Cannot reach ${HOST}. Check SSH access."
|
|
echo " ssh-copy-id ${HOST} # if needed"
|
|
exit 1
|
|
fi
|
|
echo " ${HOST} is reachable."
|
|
|
|
echo "==> Uploading files..."
|
|
|
|
# Auto-discover files from root/ and htdocs/, map to device paths.
|
|
# root/usr/sbin/foo → /usr/sbin/foo
|
|
# htdocs/luci-static/... → /www/luci-static/...
|
|
UPLOADED=0
|
|
find root/ htdocs/ -type f | sort | while IFS= read -r src; do
|
|
case "$src" in
|
|
root/*) dest="/${src#root/}" ;;
|
|
htdocs/*) dest="/www/${src#htdocs/}" ;;
|
|
*) echo "SKIP: $src (unknown prefix)"; continue ;;
|
|
esac
|
|
destdir="${dest%/*}"
|
|
ssh -q "$HOST" mkdir -p "$destdir"
|
|
scp -O -q "$src" "$HOST:$dest"
|
|
echo " ${src#./}"
|
|
UPLOADED=$((UPLOADED + 1))
|
|
done
|
|
|
|
echo "==> Setting permissions..."
|
|
ssh -q "$HOST" find /usr/sbin -name 'zt-gateway-*' -exec chmod +x {} +
|
|
|
|
echo "==> Clearing LuCI cache and restarting services..."
|
|
ssh -q "$HOST" rm -rf /tmp/luci-* 2>/dev/null || true
|
|
ssh -q "$HOST" /etc/init.d/rpcd restart
|
|
ssh -q "$HOST" /etc/init.d/uhttpd restart
|
|
|
|
DEVICE_IP=$(echo "$HOST" | sed 's/.*@//')
|
|
echo ""
|
|
echo "==> Done! Open: http://${DEVICE_IP}/cgi-bin/luci/admin/services/zt-gateway"
|
|
''' |