Multi-tenant issue

Hi, I want to run two erpnext instances on same server with different port, I tried with ‘’–server port" command, it is working fine but when I close the terminal/putty the site is getting down. Can anybody please help me. I need to run the both sites on different port and it should not get down when I close putty.

I think it would be best to hook up with a sysadmin.

I didn’t get you… Can I run multiple sites using bench start command @rmehta

can you describe in detail what you did so far (including the steps to setup your sites)?
I guess that would make useful feedback more likely

I have created two sites using bench, site1 and site2. Then I run site1 on 8000 using bench start, then I run site2 on 8001 using ‘bench site site2 serve --port 8001’, It is working fine until I close the terminal. After closing the terminal I can able to access site1 which is running on 8000 but not site2(8001). I want both sites available until I stop the server. Hope you are getting my proble @vrms

https://frappe.github.io/frappe/user/en/bench/guides/setup-multitenancy.html

I followed the link, but the site is not running @ganas:unamused:

The steps I followed:

Creating and hosting first site:

  1. bench new-site site1
    2.bench start

The site is available @ localhost:8000

Creating second site (first approach):

  1. bench new-site site2
  2. bench use site2
  3. bench site site2 serve --port8001

When I check, the site is available at localhost:8001 until I close the terminal (localhost:8000 is available if I am closing the terminal also)

Creating second site (second approach -https://frappe.github.io/frappe/user/en/bench/guides/setup-multitenancy.html):

  1. bench new-site site3
  2. bench set-nginx-port site3 8002
  3. bench setup nginx
  4. sudo service nginx reload

The site is not available at localhost:8002 but still localhost:8000 is alive.

Is there anything else I must do to make my both sites alive for users.

Please help me @ganas @vrms @rmehta

bench config dns_multitenant off bench set-nginx-port [site-name] #PortNumber bench setup nginx sudo service nginx restart
Friendly advice follow the first replay and seek the help of an experience sysadmin since you don’t know much about ports. Also you shouldn’t tag people when asking for help :slight_smile: its a community forum who can help will help when see your post

2 Likes

@shamsheer did the method described by ganas work?

@vrms Nop…:disappointed:

what do you get if you run
netstat -atn | #portNumber
for each one of your sites?

@shamsheer
multi tenant can be run if your erpnext is production and must make supervisor autostart.

step:

  1. sudo systemctl enable supervisor
  2. sudo reboot
  3. bench config dns_multitenant off
  4. bench set-nginx-port [site-name] #PortNumber
  5. bench setup nginx
  6. sudo service nginx restart
1 Like

Thank you friends for you valuable replies… Finally I found the solution. I added “nohup” as prefix and “&” as postfix for my bench command. And the site is still alive if I close the terminal also.
Now my command looks like:
nohup bench --site site2 serve --port 9000

:slight_smile: Once again, Thank you all

2 Likes

what would be the replacement for systemctlon a non-systemd machine (like the ubuntu 14-04 from the ‘official’ ERPNext production VM)?

Also … isn’t the supervisor service on ‘autostart’ by default?

can you please post all steps from creating second site to running both sites on web browser.

Thank you.

If you on production mode, and after installing the second site by:
-Bench new-site site2

You can follow these steps:
-bench setup supervisor
-bench config dns_multitenant off
-bench set-nginx-port site #portnum
-bench setup nginx
-sudo service nginx reload
-bench restart
-reboot server

Thank you! it worked for me.

bench start is for develop mode. In develop mode, the bench server stops with you get out of terminal.

I think you want production mode. Production mode runs automatically when you boot up the server, you don’t need bench start to start it up. If you want to restart the server, the command is bench restart.

If you have develop mode setup, you can setup production mode by this command:

bench setup production frappe

where frappe is the ubuntu sudo user.