Skip to content

chore: template the pm2 config and stop it being the only copy - #70

Merged
lucca65 merged 1 commit into
masterfrom
chore/ecosystem-config-template
Aug 22, 2026
Merged

chore: template the pm2 config and stop it being the only copy#70
lucca65 merged 1 commit into
masterfrom
chore/ecosystem-config-template

Conversation

@lucca65

@lucca65 lucca65 commented Aug 22, 2026

Copy link
Copy Markdown
Member

The production pm2 process definition at /home/ubuntu/apps/event-source/ecosystem.config.js on app.cambiatus.io is untracked, holds the production database password in plaintext, and has no backup anywhere. If the box is lost, so are those credentials.

A copy has now been taken off-box and stored privately (chmod 600, verified byte-identical by md5). This PR closes the repo half.

What's here

  • ecosystem.config.example.js — a documented template listing every variable src/config/prod.js actually reads, with placeholders instead of values. Includes where the live file lives and a note that it needs backing up when changed.
  • .gitignore: ecosystem.config.js — so a copy pulled onto a dev machine can never be committed with live credentials in it.
  • .gitignore fix — the FuseBox cache entry and a config path had been concatenated into a single nonexistent path (.fusebox/src/config/fresh.js), so neither .fusebox/ nor src/config/fresh.js was ignored. Harmless today (no such file exists) but wrong.

What this deliberately does NOT do

The server file is left exactly as it is. The obvious "fix" — have it read from a sourced env file like the backend's .env.production — would mean an unattended pm2 restart (a reboot, a crash) comes up with no database configuration at all, because nothing sources that file outside an interactive shell. Inline env in the pm2 config is what makes restarts survivable. Changing that is a real ops change, not a cleanup, and shouldn't ride along here.

Credential rotation

The password in that file should be rotated regardless of this PR: it sits in plaintext on a shared box, and it is the same credential used for the read-only prod tunnel. Rotating means updating the file on the server, pm2 restart event-source --update-env, and updating any local env files.

🤖 Generated with Claude Code

The production pm2 process definition at
/home/ubuntu/apps/event-source/ecosystem.config.js is untracked, holds the
production database password in plaintext, and has no backup anywhere — losing
the box means reconstructing the credentials by hand.

Adds ecosystem.config.example.js documenting every variable src/config/prod.js
reads, and gitignores the real ecosystem.config.js so a future copy on a dev
machine cannot be committed with live credentials in it.

The server file is deliberately left alone: it is what pm2 replays on reboot,
and rewiring it to read from a sourced env file would mean an unattended restart
comes up with no database configuration at all.

Also fixes a .gitignore line where the FuseBox cache entry and a config path had
been concatenated into a single nonexistent path, so neither was ignored.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@lucca65
lucca65 merged commit 7b7a396 into master Aug 22, 2026
2 checks passed
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.

1 participant