portable-pm2-path-defaults: Make PM2 ecosystem config portable across machines #3

Open
std-bot wants to merge 1 commit from task/portable-pm2-path-defaults into main
First-time contributor

Assigned idea

Replace the hardcoded local absolute paths in the PM2 ecosystem file with repo-relative defaults and existence checks so pm2 start ecosystem.oracle-stack.config.js works on any developer machine without editing the file.

Approach: 1) Update ecosystem.oracle-stack.config.js to compute defaults using path.resolve(__dirname) instead of the hardcoded /Users/nat/... value for ARRA_REPO.
2) Add fs.existsSync checks for ARRA_REPO, UI_REPO, and the reranker directory (services/reranker-py). If a path doesn’t exist, omit that app entry (e.g., don’t include oracle-ui unless UI_REPO is set and exists).
3) Keep environment-variable overrides (ARRA_REPO, UI_REPO) as the highest priority so existing setups remain compatible.
4) Add a brief comment block at the top of the file documenting the new defaults (repo-relative) and how to enable optional services via env vars.

Verification: Run node -e "const cfg=require('./ecosystem.oracle-stack.config.js'); console.log(cfg.apps.map(a=>a.name))" and confirm it prints a valid app list without throwing. Then run pm2 start ecosystem.oracle-stack.config.js --only oracle-backend from the repo root and confirm pm2 status shows oracle-backend online. Finally, set UI_REPO=/path/to/ui-oracle pm2 restart ecosystem.oracle-stack.config.js --only oracle-ui and confirm oracle-ui starts only when the directory exists.

Risk: If someone relied on the previous hardcoded path implicitly matching their workstation, the new default may point to the current repo directory instead; mitigated by preserving ARRA_REPO/UI_REPO overrides and only auto-enabling apps when their directories exist.

Agent context

Task slug: portable-pm2-path-defaults
Branch: task/portable-pm2-path-defaults

## Assigned idea Replace the hardcoded local absolute paths in the PM2 ecosystem file with repo-relative defaults and existence checks so `pm2 start ecosystem.oracle-stack.config.js` works on any developer machine without editing the file. Approach: 1) Update `ecosystem.oracle-stack.config.js` to compute defaults using `path.resolve(__dirname)` instead of the hardcoded `/Users/nat/...` value for `ARRA_REPO`. 2) Add `fs.existsSync` checks for `ARRA_REPO`, `UI_REPO`, and the reranker directory (`services/reranker-py`). If a path doesn’t exist, omit that app entry (e.g., don’t include `oracle-ui` unless `UI_REPO` is set and exists). 3) Keep environment-variable overrides (`ARRA_REPO`, `UI_REPO`) as the highest priority so existing setups remain compatible. 4) Add a brief comment block at the top of the file documenting the new defaults (repo-relative) and how to enable optional services via env vars. Verification: Run `node -e "const cfg=require('./ecosystem.oracle-stack.config.js'); console.log(cfg.apps.map(a=>a.name))"` and confirm it prints a valid app list without throwing. Then run `pm2 start ecosystem.oracle-stack.config.js --only oracle-backend` from the repo root and confirm `pm2 status` shows `oracle-backend` online. Finally, set `UI_REPO=/path/to/ui-oracle pm2 restart ecosystem.oracle-stack.config.js --only oracle-ui` and confirm `oracle-ui` starts only when the directory exists. Risk: If someone relied on the previous hardcoded path implicitly matching their workstation, the new default may point to the current repo directory instead; mitigated by preserving `ARRA_REPO`/`UI_REPO` overrides and only auto-enabling apps when their directories exist. ## Agent context Task slug: portable-pm2-path-defaults Branch: task/portable-pm2-path-defaults <!-- std-ts:idea-pr-body -->
Author
First-time contributor

Resolved in std dashboard.

STD comment #143 (review.patch:1-1)

Changes requested from std dashboard.

Resolved in std dashboard. STD comment #143 (review.patch:1-1) > Changes requested from std dashboard.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin task/portable-pm2-path-defaults:task/portable-pm2-path-defaults
git switch task/portable-pm2-path-defaults

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff task/portable-pm2-path-defaults
git switch task/portable-pm2-path-defaults
git rebase main
git switch main
git merge --ff-only task/portable-pm2-path-defaults
git switch task/portable-pm2-path-defaults
git rebase main
git switch main
git merge --no-ff task/portable-pm2-path-defaults
git switch main
git merge --squash task/portable-pm2-path-defaults
git switch main
git merge --ff-only task/portable-pm2-path-defaults
git switch main
git merge task/portable-pm2-path-defaults
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
snorkel/root-repository-maintenance-49850203909049!3
No description provided.