SPB Git

spb/llmindex Public

The discriminative, contamination-resistant, fully transparent LLM ranking — updated live.

TypeScript 77.9% TeX 15.2% Python 3.7% SQL 1.4% JavaScript 1.1% Shell 0.5%
1.9 KB · 63 lines javascript
Raw Blame History
1/**2 * llmindex.io — PM2 process definitions for the m3u96b node3 * Author:  Simon-Pierre Boucher4 * Contact: contact@spboucher.ai5 * License: Proprietary — © Simon-Pierre Boucher, all rights reserved6 *7 * m3u96b is macOS (no systemd); PM2 provides the auto-restart layer. The8 * systemd units in infra/systemd/ are the Linux equivalent.9 * Usage: pm2 startOrReload infra/ecosystem.config.cjs10 */11const fs = require('node:fs');12const path = require('node:path');1314const APP_DIR = path.resolve(__dirname, '..');1516/** Minimal .env parser (no dotenv dependency at the PM2 layer). */17function loadEnv() {18  const envPath = path.join(APP_DIR, '.env');19  const env = {};20  if (fs.existsSync(envPath)) {21    for (const line of fs.readFileSync(envPath, 'utf8').split('\n')) {22      const m = line.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/);23      if (m && !line.trim().startsWith('#')) {24        env[m[1]] = m[2].replace(/^["']|["']$/g, '');25      }26    }27  }28  return env;29}3031const env = loadEnv();3233module.exports = {34  apps: [35    {36      name: 'llmindex-web',37      cwd: APP_DIR,38      script: 'apps/web/.next/standalone/apps/web/server.js',39      env: { ...env, NODE_ENV: 'production', PORT: '3100', HOSTNAME: '127.0.0.1' },40      max_memory_restart: '1G',41      autorestart: true,42    },43    {44      name: 'llmindex-worker',45      cwd: path.join(APP_DIR, 'apps/worker'),46      // .bin/tsx is a shell shim PM2 would feed to node — use the real JS entry47      script: 'node_modules/tsx/dist/cli.mjs',48      args: 'src/index.ts',49      env: { ...env, NODE_ENV: 'production' },50      max_memory_restart: '1G',51      autorestart: true,52    },53    {54      name: 'llmindex-ngrok',55      script: '/opt/homebrew/bin/ngrok',56      args: 'http 3100 --url=https://www.llmindex.io --log=stdout',57      interpreter: 'none',58      env: env.NGROK_AUTHTOKEN ? { NGROK_AUTHTOKEN: env.NGROK_AUTHTOKEN } : {},59      autorestart: true,60    },61  ],62};63