diff --git a/hole-punch-interop/impl/rust/v0.52/Makefile b/hole-punch-interop/impl/rust/v0.52/Makefile index fc355beab..f12521369 100644 --- a/hole-punch-interop/impl/rust/v0.52/Makefile +++ b/hole-punch-interop/impl/rust/v0.52/Makefile @@ -1,5 +1,5 @@ image_name := rust-v0.52 -commitSha := bb251a4f88d44a64447f1c66b8a7918cfaea9afb +commitSha := 919f49e8374bbe1a24654aac56414f2e83aa5484 all: image.json diff --git a/hole-punch-interop/router/Dockerfile b/hole-punch-interop/router/Dockerfile index aaf61fdab..df1f4e980 100644 --- a/hole-punch-interop/router/Dockerfile +++ b/hole-punch-interop/router/Dockerfile @@ -6,4 +6,6 @@ RUN --mount=type=cache,target=/var/cache/apt apt-get update && apt-get -y instal COPY *.sh /scripts/ RUN chmod +x /scripts/*.sh +HEALTHCHECK CMD [ "sh", "-c", "test $(cat /var/setup_done) = 1" ] + ENTRYPOINT ["./scripts/run.sh"] diff --git a/hole-punch-interop/router/run.sh b/hole-punch-interop/router/run.sh index d39731e7a..fac37bd11 100644 --- a/hole-punch-interop/router/run.sh +++ b/hole-punch-interop/router/run.sh @@ -13,7 +13,9 @@ nft add table ip nat nft add chain ip nat postrouting { type nat hook postrouting priority 100 \; } nft add rule ip nat postrouting ip saddr $SUBNET_INTERNAL oifname "eth1" snat $ADDR_EXTERNAL -tc qdisc add dev eth0 root netem delay 30ms -tc qdisc add dev eth1 root netem delay 30ms +tc qdisc add dev eth0 root netem delay 30ms # Internal latency +tc qdisc add dev eth1 root netem delay 50ms # External latency + +echo "1" > /var/setup_done # This will be checked by our docker HEALTHCHECK tail -f /dev/null diff --git a/hole-punch-interop/src/compose-runner.ts b/hole-punch-interop/src/compose-runner.ts index 6c9f40eff..f62450189 100644 --- a/hole-punch-interop/src/compose-runner.ts +++ b/hole-punch-interop/src/compose-runner.ts @@ -34,7 +34,7 @@ export async function run(namespace: string, compose: ComposeSpecification, logD const stderrLogFile = path.join(logDir, `${sanitizedComposeName}.stderr`); try { - const { stdout, stderr } = await exec(`docker compose -f ${path.join(dir, "compose.yaml")} up --exit-code-from alice --abort-on-container-exit`, { timeout: 15 * 1000 }) + const { stdout, stderr } = await exec(`docker compose -f ${path.join(dir, "compose.yaml")} up --exit-code-from alice --abort-on-container-exit`, { timeout: 30 * 1000 }) await fs.writeFile(stdoutLogFile, stdout) await fs.writeFile(stderrLogFile, stderr) diff --git a/hole-punch-interop/src/generator.ts b/hole-punch-interop/src/generator.ts index 990d47076..5e3bcf53a 100644 --- a/hole-punch-interop/src/generator.ts +++ b/hole-punch-interop/src/generator.ts @@ -91,12 +91,6 @@ function buildSpec(containerImages: { [key: string]: () => string }, { let startupScriptFn = (actor: "alice" | "bob") => (` set -ex; - # Wait for router to be online - while ! ping -c 1 -w 1 "${actor}_router"; do sleep 1; done - - # Wait for redis to be online - while ! ping -c 1 -w 1 "redis"; do sleep 1; done - ROUTER_IP=$$(dig +short ${actor}_router) INTERNET_SUBNET=$$(curl --silent --unix-socket /var/run/docker.sock http://localhost/networks/${internetNetworkName} | jq -r '.IPAM.Config[0].Subnet') @@ -107,12 +101,8 @@ function buildSpec(containerImages: { [key: string]: () => string }, { let relayStartupScript = ` set -ex; - - # Wait for redis to be online - while ! ping -c 1 -w 1 "redis"; do sleep 1; done - - # Add RTT when using the relay - tc qdisc add dev eth0 root netem delay 50ms; + + tc qdisc add dev eth0 root netem delay 50ms; # Add a delay to all relayed connections /usr/bin/relay `; @@ -141,14 +131,15 @@ function buildSpec(containerImages: { [key: string]: () => string }, { cap_add: ["NET_ADMIN"] }, alice: { - depends_on: ["relay", "alice_router"], + depends_on: ["relay", "alice_router", "redis"], image: containerImages[aliceImage](), init: true, command: ["/bin/sh", "-c", startupScriptFn("alice")], environment: { TRANSPORT: transport, MODE: "dial", - RUST_LOG: "debug" + RUST_LOG: "debug", + REDIS_TIMEOUT: 30 }, networks: { alice_lan: {}, @@ -169,14 +160,15 @@ function buildSpec(containerImages: { [key: string]: () => string }, { cap_add: ["NET_ADMIN"] }, bob: { - depends_on: ["relay", "bob_router"], + depends_on: ["relay", "bob_router", "redis"], image: containerImages[bobImage](), init: true, command: ["/bin/sh", "-c", startupScriptFn("bob")], environment: { TRANSPORT: transport, MODE: "listen", - RUST_LOG: "debug" + RUST_LOG: "debug", + REDIS_TIMEOUT: 30 }, networks: { bob_lan: {}, @@ -188,8 +180,8 @@ function buildSpec(containerImages: { [key: string]: () => string }, { }, redis: { image: "redis:7-alpine", - environment: { - REDIS_ARGS: "--loglevel warning" + healthcheck: { + test: ["CMD-SHELL", "redis-cli ping | grep PONG"] }, networks: { internet: {