nomadro/apps/ebook/deploy/ecosystem.config.cjs
eric d93a355fd5 Migrate navmini/ebook/nomadweb into apps/ as same-origin portal subpaths.
Shield external portal jumps (keep EXTERNAL_* for later), serve /nav from static build, and proxy /book + /community to vertical Next apps with Caddy notes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-28 03:30:34 -05:00

52 lines
1.2 KiB
JavaScript

const fs = require('fs');
const path = require('path');
function parseEnvFile(file) {
const out = {};
if (!fs.existsSync(file)) return out;
for (const raw of fs.readFileSync(file, 'utf8').split(/\r?\n/)) {
const line = raw.trim();
if (!line || line.startsWith('#')) continue;
const eq = line.indexOf('=');
if (eq < 1) continue;
const key = line.slice(0, eq).trim();
let val = line.slice(eq + 1).trim();
if (
(val.startsWith('"') && val.endsWith('"')) ||
(val.startsWith("'") && val.endsWith("'"))
) {
val = val.slice(1, -1);
}
out[key] = val;
}
return out;
}
const secretEnv = {
...parseEnvFile(path.join(__dirname, 'nowpayments.env')),
...parseEnvFile(path.join(__dirname, '..', '.env')),
};
module.exports = {
apps: [
{
name: 'ebook',
script: 'server.js',
cwd: '/var/www/ebook/.next/standalone',
instances: 1,
exec_mode: 'fork',
autorestart: true,
watch: false,
max_memory_restart: '512M',
env: {
NODE_ENV: 'production',
PORT: 3022,
HOSTNAME: '0.0.0.0',
NEXT_PUBLIC_SITE_URL: 'https://book.nomadro.com',
NEXT_PUBLIC_SHARE_CAMPAIGN: 'nomad-code',
...secretEnv,
},
},
],
};