← back to NationalPaperHangers
ecosystem.kamatera.config.js
57 lines
// pm2 ecosystem file for Kamatera VPS deployment.
// Distinct filename (ecosystem.kamatera.config.js) so it never collides with
// the Mac2 ecosystem.config.js used by the local pm2 fleet.
//
// Usage on Kamatera:
// pm2 start /root/Projects/NationalPaperHangers/ecosystem.kamatera.config.js --env production
// pm2 save
'use strict';
module.exports = {
apps: [
{
name: 'national-paper-hangers',
// Entry point relative to cwd below.
script: 'server.js',
// Absolute path on Kamatera — never /root/public-projects/ (internal app).
cwd: '/root/Projects/NationalPaperHangers',
// Single process, fork mode. The app is stateless-session via PG so
// horizontal scale can be added later by bumping instances + switching
// to cluster mode, but start simple.
instances: 1,
exec_mode: 'fork',
// Restart automatically if the process exits unexpectedly.
autorestart: true,
// Conservative memory cap for a shared VPS. Raise to 512M if
// portfolo image processing is added server-side.
max_memory_restart: '400M',
// Delay between crash restarts: 1s → 2s → 4s … up to 10s.
exp_backoff_restart_delay: 100,
min_uptime: '10s',
// Do NOT inherit the shell environment — all secrets via env_production.
merge_logs: true,
log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
// ── Environment: production ──────────────────────────────────────────
// Fill in every value in /root/Projects/NationalPaperHangers/.env
// on Kamatera. The ecosystem file provides the NODE_ENV flag only;
// sensitive vars come from the .env file loaded by dotenv at boot.
env_production: {
NODE_ENV: 'production',
PORT: '9765'
// All secrets (SESSION_SECRET, STRIPE_*, PGPASSWORD, GEORGE_PASS, etc.)
// must be present in .env on Kamatera. They are NOT hard-coded here
// to avoid committing secrets to the repo.
}
}
]
};