INNER CODE UNIT · TypeScript

waitForForgejo

PerryTS/perry · example-code/forgejo-deployment/main.ts:137

async function waitForForgejo(stack: number, timeoutMs: number): Promise<boolean> {
  const deadline = Date.now() + timeoutMs;
  let attempt = 0;
  while (Date.now() < deadline) {
    attempt++;
    try {
      // Forgejo's `/api/healthz` is a no-auth liveness endpoint that
      // returns 200 with a pass/fail JSON body once the web server is
      // up AND the database / cache subsystems pinged successfully.
      // (`/api/v1/version` is auth-gated when `REQUIRE_SIGNIN_VIEW` is
      // on, which would make `wget` exit 8 on HTTP 401.)
      // Probing from INSIDE the forgejo container so we don't depend
      // on the host's port forward being live yet — the docker proxy
      // has a brief window where the container is up but the bind
      // hasn't been established.
      await exec(stack, 'forgejo', [
        'wget', '-q', '-O', '/dev/null',
        '--timeout=2', '--tries=1',

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…