Diffinery

codician/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

Docker on hosted runners: a second docker command no longer waits forever while the daemon starts (#225)

* Docker on hosted runners: a second docker command no longer waits forever while the daemon starts
test-bot authored 1 parent 4eedb68commit 0c1a4786578be2d7fd4be781fce1519f121a6bcbBrowse files
2 files changed+7−3
modifiedcontainers/runner/image/docker+4−2View file
@@ -32,7 +32,7 @@
3232 # Under web-only egress the relay's own HTTPS needs the egress CA (src/egress.ts).
3333 env -i PATH="$sys_path" ${NODE_EXTRA_CA_CERTS:+"NODE_EXTRA_CA_CERTS=$NODE_EXTRA_CA_CERTS"} DIFFINERY_RELAY_HOST="$host" DIFFINERY_RELAY_UPSTREAM="https://$host" DIFFINERY_RELAY_PORT="$relay_port" \
3434 DIFFINERY_RELAY_CERT="$state/relay.crt" DIFFINERY_RELAY_KEY="$state/relay.key" \
35- setsid -f node /opt/diffinery/agent.mjs --registry-relay >/var/log/diffinery-relay.log 2>&1 </dev/null
35+ setsid -f node /opt/diffinery/agent.mjs --registry-relay >/var/log/diffinery-relay.log 2>&1 </dev/null 9>&-
3636 for _ in $(seq 1 80); do
3737 if (exec 3<>"/dev/tcp/127.0.0.1/$relay_port") 2>/dev/null; then
3838 echo "$host" >"$state/relay.host"
@@ -56,7 +56,9 @@
5656 echo "The registry relay did not start, so image layers over 100 MB can't be pushed to $host:" >&2
5757 tail -n 5 /var/log/diffinery-relay.log >&2 2>/dev/null
5858 fi
59- env -i PATH="$sys_path" "${proxy[@]}" setsid -f dockerd >/var/log/dockerd.log 2>&1 </dev/null
59+ # The daemons must not inherit the lock (fd 9): they would hold it for good, and a second
60+ # docker command that arrives while this one is still starting the daemon would wait forever.
61+ env -i PATH="$sys_path" "${proxy[@]}" setsid -f dockerd >/var/log/dockerd.log 2>&1 </dev/null 9>&-
6062 for _ in $(seq 1 240); do "$real" version >/dev/null 2>&1 && break; sleep 0.25; done
6163 "$real" version >/dev/null 2>&1 || { echo "The Docker daemon did not start:" >&2; tail -n 20 /var/log/dockerd.log >&2; exit 1; }
6264 fi
modifiedcontainers/runner/src/main.ts+3−1View file
@@ -150,7 +150,9 @@
150150 // two are for cancelling the steps and reporting the result before SIGKILL.
151151 drainOnSigtermMs: args.spec ? undefined : 13 * 60_000,
152152 // A hosted runner is its own machine (Cloudflare sets the Durable Object id in its container).
153- prewarmDocker: !!env.CLOUDFLARE_DURABLE_OBJECT_ID,
153+ // Off until the docker wrapper's lock fix (image/docker) is live and verified: a docker command
154+ // that ran while the head start was still starting the daemon waited on the lock forever.
155+ prewarmDocker: false,
154156 measureUsage: !!env.CLOUDFLARE_DURABLE_OBJECT_ID || env.DIFFINERY_MEASURE_USAGE === "1" ? new UsageSampler({ cores: Number(env.DIFFINERY_RUNNER_VCPU) || undefined }) : false,
155157 });
156158 process.stdout.write(`[diffinery-runner] job finished: ${completion.conclusion}\n`);