Wire zappier-edge into the live stack and add billing department APIs
Some checks are pending
offline / test (push) Waiting to run

Fleet now spawns the real zappier and middleware processes. Metered
timestamp/receipt/hash calls proxy to middleware when ZAPPIER_UPSTREAM
is set. CS credits, sales per-customer pricing, and QuickBooks export
are separate repos plugged into zappier-edge admin.
This commit is contained in:
George Lambert 2026-09-11 15:15:55 -04:00
parent 65bfa544b2
commit a1a5b957fd
44 changed files with 822 additions and 18 deletions

View file

@ -16,6 +16,23 @@ import { sshSpawnWorker, sshKillWorker, sshHttp, sshCheck } from './ssh.js';
const WORKER = path.join(path.dirname(fileURLToPath(import.meta.url)), 'worker.js');
/**
* Real HTTP apps (zappier-edge, middleware) set `spawn` in services/*.json.
* Everything else is the fleet health worker.
*/
export function spawnLocal(root, spec, env, healthPort) {
const merged = { ...env, ...(spec.env || {}), PORT: String(healthPort) };
if (spec.spawn?.command) {
const cwd = path.resolve(root, spec.spawn.cwd || '.');
return spawn(spec.spawn.command, spec.spawn.args || [], {
env: merged,
cwd,
stdio: ['ignore', 'pipe', 'pipe'],
});
}
return spawn(process.execPath, [WORKER], { env: merged, stdio: ['ignore', 'pipe', 'pipe'] });
}
export class Supervisor {
/**
* @param {object} [opts]
@ -184,7 +201,7 @@ export class Supervisor {
return null;
}
} else {
child = spawn(process.execPath, [WORKER], { env, stdio: ['ignore', 'pipe', 'pipe'] });
child = spawnLocal(this.loaded.root, spec, env, healthPort);
pid = child.pid;
}
const rec = {