Files
pyre/ecosystem.config.cjs
RogueWave d159ad5196 feat(web+infra): polished front page, app at /, tracker at /status
- apps/web: redesigned landing (Hero/Scanner/HowItWorks/Features/Footer),
  honest live-vs-coming-soon badges, same-origin /api/scan, ember theme.
- ecosystem.config.cjs: runnable — pyre-api/worker via `node --import tsx`,
  pyre-web via `next start`, fork mode, env wired. pm2 web+api verified online
  (api /health 200, scan 200, web 200).
- infra/nginx/feedthepyre.com.conf: app at / (proxy :3000), API at /api
  (proxy :4000, prefix preserved), dev tracker at /status (static).
- scripts/deploy-web.sh: sudo cutover (install vhost, nginx -t, reload,
  certbot --nginx --keep-until-expiring).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-31 03:24:58 +00:00

83 lines
2.9 KiB
JavaScript

// PYRE / Prometheus Protocol — PM2 ecosystem (process manager) config.
//
// Process names match docs/PYRE_MVP_DESIGN.md §12: pyre-web, pyre-api, pyre-worker.
// Start (from repo root): pm2 start ecosystem.config.cjs --only pyre-api,pyre-web
// Persist for boot: pm2 save (systemd unit infra/systemd/pm2-pyre.service
// runs `pm2 resurrect` on boot)
//
// PM2 is installed at user level: ~/.local/share/pnpm/bin/pm2
// Logs go to /home/pyre/pyre/logs/ (rotated by infra/logrotate/pyre).
// Each process is capped at 400M (8GB VPS shared with postgres/redis/nginx).
//
// NOTE: api/worker run their TypeScript directly via `node --import tsx` (no
// separate build step; tsx resolves the workspace `@pyre/*` source packages).
// The web app runs Next.js in production mode and requires a prior `next build`.
const REPO = __dirname;
module.exports = {
apps: [
{
// Next.js frontend (production) — port 3000 per .env.example (WEB_PORT).
// Requires `pnpm --filter @pyre/web build` first.
name: "pyre-web",
cwd: `${REPO}/apps/web`,
script: "node_modules/next/dist/bin/next",
args: "start",
instances: 1,
exec_mode: "fork",
autorestart: true,
max_memory_restart: "500M",
env: {
NODE_ENV: "production",
PORT: 3000,
HOSTNAME: "127.0.0.1",
},
out_file: `${REPO}/logs/pyre-web-out.log`,
error_file: `${REPO}/logs/pyre-web-err.log`,
},
{
// Fastify HTTP API — port 4000 per .env.example (API_PORT).
// Runs TS directly via tsx (resolves workspace @pyre/* source).
name: "pyre-api",
cwd: `${REPO}/apps/api`,
script: "src/index.ts",
interpreter: "node",
interpreter_args: "--import tsx",
instances: 1,
exec_mode: "fork",
autorestart: true,
max_memory_restart: "400M",
env: {
NODE_ENV: "production",
PORT: 4000,
HOST: "127.0.0.1",
WEB_PUBLIC_URL: "https://feedthepyre.com",
// Public RPC by default — override with a Helius/Triton/QuickNode URL
// (set SOLANA_RPC_URL in the environment) to avoid mainnet rate limits.
SOLANA_RPC_URL: "https://api.mainnet-beta.solana.com",
},
out_file: `${REPO}/logs/pyre-api-out.log`,
error_file: `${REPO}/logs/pyre-api-err.log`,
},
{
// BullMQ background worker (no HTTP port). Not started by default in
// Phase 1 (no jobs implemented yet). Runs TS via tsx when enabled.
name: "pyre-worker",
cwd: `${REPO}/apps/worker`,
script: "src/index.ts",
interpreter: "node",
interpreter_args: "--import tsx",
instances: 1,
exec_mode: "fork",
autorestart: true,
max_memory_restart: "400M",
env: {
NODE_ENV: "production",
},
out_file: `${REPO}/logs/pyre-worker-out.log`,
error_file: `${REPO}/logs/pyre-worker-err.log`,
},
],
};