bench icon indicating copy to clipboard operation
bench copied to clipboard

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

Open tamburro92 opened this issue 10 months ago • 2 comments
trafficstars

Issue: Bug report

Do the checklist before filing an issue:

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

Describe the bug :chart_with_downwards_trend: 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 :page_with_curl: Steps to reproduce the behavior: Install node

nvm install 18
sudo bench setup production <user>

Expected behavior :chart_with_upwards_trend: 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 :crystal_ball: If applicable, add screenshots to help explain your problem.

OS (please complete the following information): :cyclone:

  • [x] 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 :page_facing_up: Add any other context about the problem here.

Possible Solution :bookmark_tabs: 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"),

tamburro92 avatar Jan 09 '25 19:01 tamburro92