Production setup for second instance in single machine

We have a machine hosted on Azure where the first Frappe Bench instance is running successfully in production. Now, I need to create a second instance on the same server. However, when I attempt to run the bench setup production command for the second instance, I encounter an error stating “sudo: bench: command not found.” I would like assistance in identifying the issue and properly configuring multiple production benches on the same server.

Can you make sure that you are in the correct directory on the machine? By default, this is frappe-bench, or it may be called something else depending on how you initialized your frappe instance.

Since the command bench cannot be found with sudo i suspect the error there.

Try these commands

which bench
bench --version
sudo which bench
sudo bench --version

Hi,

I checked the commands as suggested.

  • which bench returns the correct bench path from the user environment.

  • bench --version works as expected and shows the installed version.

  • However, when running with sudo, sudo which bench does not return any path, and sudo bench --version results in “sudo: bench: command not found.”

It looks like the bench executable is available only in the current user’s PATH and not in the root/sudo environment. Please let me know if you would like me to run the commands using the full bench path or adjust the environment variables.

Then try this and only execute it in the correct bench directory:

cd /home/frappe/<your-second-bench-instance>
sudo -H "$(which bench)" setup production

You just have to make sure that your two instances don’t mess up each other’s nginx configs. For setups like this, I would rather recommend running them using Frappe Docker.