Files
indiekit-server/scripts/preflight-startup-gate.mjs
Sven 6a005c0999
Deploy Indiekit Server / deploy (push) Has been cancelled
fix: inbox processor never started after activitypub upgrade (startup-gate)
The new fork version added @rmdes/indiekit-startup-gate which defers
background tasks until /app/data/.indiekit-ready exists (a Cloudron
convention). On this FreeBSD server the file never gets created, so
the inbox queue processor never started — all inbound AP activities
queued up at attempts=0 indefinitely.

Fix: preflight-startup-gate.mjs creates the signal file on every
serve startup, so waitForReady() fires immediately.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 18:51:09 +02:00

26 lines
1.1 KiB
JavaScript

/**
* Preflight: ensure the @rmdes/indiekit-startup-gate signal file exists.
*
* The startup-gate module polls for /app/data/.indiekit-ready before starting
* background tasks (inbox processor, key refresh, batch refollow). This path
* is a Cloudron convention; on this FreeBSD server it never gets created
* automatically, so the inbox queue processor never starts.
*
* This preflight creates the file unconditionally on every serve, which makes
* waitForReady() fire immediately at startup rather than waiting forever.
*/
import { mkdirSync, closeSync, openSync, constants } from "node:fs";
const SIGNAL_PATH = "/app/data/.indiekit-ready";
try {
mkdirSync("/app/data", { recursive: true });
// O_CREAT | O_WRONLY — creates file if missing, no-ops if it exists
closeSync(openSync(SIGNAL_PATH, constants.O_CREAT | constants.O_WRONLY));
console.log(`[preflight] startup-gate signal file ready: ${SIGNAL_PATH}`);
} catch (error) {
// Non-fatal — log and continue; startup-gate will poll instead
console.warn(`[preflight] Could not create startup-gate signal: ${error.message}`);
}