/** * 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}`); }