← back to Claude Webdev Accelerator
ecosystem.config.js
52 lines
// pm2 ecosystem for the accelerator preview fleet.
// 5 app servers (localhost 3901-3905) + 5 basic-auth gate-proxies (4901-4905).
// The dw-followup cloudflared tunnel points <slug>.agentabrams.com -> 127.0.0.1:490x (the proxy).
// Start: pm2 start preview-fleet.ecosystem.js && pm2 save
// Reboot persistence: run the sudo line printed by `pm2 startup` (Steve-gated).
const HOME = process.env.HOME;
const ACCEL = __dirname;
const GATE = process.env.PREVIEW_GATE || 'admin:DW2024!';
const APPS = [
{ slug: 'estimate-instant', app: 3901, proxy: 4901 },
{ slug: 'trade-portal', app: 3902, proxy: 4902 },
{ slug: 'sample-box', app: 3903, proxy: 4903 },
{ slug: 'reno-visualizer', app: 3904, proxy: 4904 },
{ slug: 'permit-radar', app: 3905, proxy: 4905 },
];
const apps = [];
for (const { slug, app, proxy } of APPS) {
apps.push({
name: `prev-${slug}`,
cwd: `${HOME}/Projects/${slug}`,
script: 'server.js',
env: { PORT: String(app) }, // app runs plain on localhost; the proxy is the gate
autorestart: true, max_restarts: 20, min_uptime: '5s',
});
apps.push({
name: `gate-${slug}`,
cwd: ACCEL,
script: 'scripts/gate-proxy.js',
env: { PORT: String(proxy), UPSTREAM: `127.0.0.1:${app}`, GATE_AUTH: GATE },
autorestart: true, max_restarts: 20, min_uptime: '5s',
});
}
// Accelerator repo viewer (serves this repo read-only) + its gate-proxy.
apps.push({
name: 'prev-accelerator',
cwd: ACCEL,
script: 'scripts/repo-viewer.js',
env: { PORT: '3906', ROOT: ACCEL },
autorestart: true, max_restarts: 20, min_uptime: '5s',
});
apps.push({
name: 'gate-accelerator',
cwd: ACCEL,
script: 'scripts/gate-proxy.js',
env: { PORT: '4906', UPSTREAM: '127.0.0.1:3906', GATE_AUTH: GATE },
autorestart: true, max_restarts: 20, min_uptime: '5s',
});
module.exports = { apps };