chore: template the pm2 config and stop it being the only copy - #70
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The production pm2 process definition at
/home/ubuntu/apps/event-source/ecosystem.config.jsonapp.cambiatus.iois 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 variablesrc/config/prod.jsactually 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..gitignorefix — the FuseBox cache entry and a config path had been concatenated into a single nonexistent path (.fusebox/src/config/fresh.js), so neither.fusebox/norsrc/config/fresh.jswas 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