Skip to content

chore: pin pm2 process definition in the repo - #6

Open
varffs wants to merge 2 commits into
masterfrom
chore/pm2-ecosystem-config
Open

chore: pin pm2 process definition in the repo#6
varffs wants to merge 2 commits into
masterfrom
chore/pm2-ecosystem-config

Conversation

@varffs

@varffs varffs commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Adds ecosystem.config.cjs so the pm2 process definition is declarative instead of living only in ~/.pm2/dump.pm2 on the device.

Why it matters: NODE_ENV=production is load-bearing — RTK's dev-mode serializable/immutable checks cost ~157ms/action at a full history ring (measured on the Pi, 2026-07-27). Until now a pm2 dump rebuild would silently drop it and the device would degrade over the following two days. With this file the deploy step becomes:

pm2 startOrReload ecosystem.config.cjs && pm2 save

Also enables time: true — log lines get timestamps. The 2026-07-28 push-failure investigation (EAI_AGAIN / 520 lines in the error log) had nothing to date the errors with except the log file's mtime.

.cjs because the package is "type": "module" and pm2 loads config via require(). Config mirrors the process exactly as it runs today (name, script, cwd, fork mode) — verified against pm2 describe on the device. File validated loadable with node.

No app code changes.

🤖 Generated with Claude Code

NODE_ENV=production lived only in pm2's saved dump — a dump rebuild
dropped it silently and RTK's dev-mode state checks cost ~157ms/action
at a full history ring. ecosystem.config.cjs makes it declarative:

  pm2 startOrReload ecosystem.config.cjs && pm2 save

Also enables log timestamps (time: true); the 2026-07-28 push-failure
investigation had only the log file's mtime to date errors with.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a declarative PM2 process definition to the repository to prevent configuration drift during deploys (notably ensuring NODE_ENV=production is consistently set) and to enable timestamped log lines for better operational debugging.

Changes:

  • Added ecosystem.config.cjs defining the PM2 app configuration (including NODE_ENV=production and time: true).
  • Updated CHANGELOG.md to document the addition.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
ecosystem.config.cjs Introduces a repo-pinned PM2 process definition to stabilize deploy behavior and improve log observability.
CHANGELOG.md Notes the new PM2 ecosystem config in the Unreleased changelog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ecosystem.config.cjs
Review flagged the hardcoded /home/polyteknix/polyteknix — __dirname
keeps the config portable to a fresh device or different user.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants