Skip to content

bench setup production <user> create wrong node path in supervisor.conf #1615

@tamburro92

Description

@tamburro92

Issue: Bug report

Do the checklist before filing an issue:

  • Can you replicate the issue on the supported bench versions?
  • Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome

Describe the bug 📉
When running sudo bench setup production <user> the nodejs path is wrong in supervisor.conf, bench loads node from system path instead using the user environment installed like nvm install 18.
This behavior creates problem on OS which ship node < 16 like Ubuntu 22 and consequentially fail to start socketio process
This is the affected row in supervisor.conf

[program:frappe-15-node-socketio]
command=/usr/bin/node /home/ubuntu/frappe-15/apps/frappe/socketio.js

To Reproduce 📃
Steps to reproduce the behavior:
Install node

nvm install 18
sudo bench setup production <user>

Expected behavior 📈
supervisor.conf should use node from user environment like:
command=/home/ubuntu/.nvm/versions/node/v18.20.5/bin/node /home/ubuntu/frappe-15/apps/frappe/socketio.js

Screenshots 🔮
If applicable, add screenshots to help explain your problem.

OS (please complete the following information): 🌀

  • Linux: Ubuntu:22

Version Information

Can be found out by running bench version in your respective bench folder.

  • Bench Branch: latest,
  • Frappe Version: v15

Additional context 📄
Add any other context about the problem here.

Possible Solution 📑
In git which("node") should use user context instead of sudo

	config = template.render(
		**{
			"bench_dir": bench_dir,
			"sites_dir": os.path.join(bench_dir, "sites"),
			"user": user,
			"use_rq": use_rq(bench_path),
			"http_timeout": config.get("http_timeout", 120),
			"redis_server": which("redis-server"),
			"node": which("node") or which("nodejs"),

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions