Creating New Site in the same Bench

Hi,
Take a backup of your old site:

bench --site yoursitename backup

Then create a new site and install erpnext:

bench new-site newsitename
bench --site newsitename install-app erpnext

Then restore the backup file(can be found in your oldsite folder):

bench --site newsitename restore path/to/backup/file

Creating new site does not affect any other sites data.

5 Likes

But what if i make changes in the erpnext app so the changes will be affected in the new site as well isnt it?
Also i tried to run the new site as well but it is unable to load.
Can you guide me through the process?

And moreover I have done in the same way but when opening my new site it doesnt open.
How can i set the DNS for the new site?

If you make changes in erpnext app in oldsite, then you need to do
bench --site newsitename migrate

Are you trying to set it up on local machine or server?

On the same machine i am working on.
My aim is to create two site.
The one in which i ll be working on.
Other in which i ll keep migrating the modifications as well as the changes.
Now i am facing difficulty in how i can do the same.
I have created a new site installed the same erpnext.
but trying to launch the site, I am unable to do so.
So How i can accomplish the task.

For running multiple sites, you need to add the sitename into /etc/hosts file.

Just add this line at the end:

127.0.0.1 oldsitename
127.0.0.1 newsitename

Now you can access both sites, by entering their name followed by the port number.
For e.g newsitename:8000 in the browser

1 Like

I am doing that but i am unable to do so.
my old site site name is erpnext.dev
new sitename is develop.dev
When typing the url erpnext.dev:8000
It wont load the site.
But when i type in the url as localhost:8000
it loads the old site.
But the same scenario isnt for the new site.
I tried to do for the new site as well but getting error.

How does your /etc/hosts file look like?

i ll paste in my hosts file content as well.

127.0.0.1 localhost
127.0.1.1 User-ThinkPad-T400

The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

localhost http://erpnext.dev:8000
localhost http://develop.dev:8080

Replace these lines with

1 Like

Its Working.
My other Doubt is that if i make changes in the erpnext app so will the changes be justified in the new site as well?
And also in my new site i havent kept developer mode to 1.
still i can make changes in the standard doctypes through setup.
So What could be possibly be wrong?

As I said earlier, if you make changes in erpnext app in oldsite, it wont affect newsite until you do bench migrate on new site.

Also i am unable to understand how i can convert my new site to production mode.
so that i dont have to do bench start again and again for it.
Is there a way?

Hi there,
My other site isnt working.
I have set the port for develop.dev to 8080
and for erpnext.dev to 8000
So when typing the url to develop.dev:8080, the site does not gets load.
While i type develop.dev:8000 the site loads directly the erpnext.dev:8000
I can say this because when i launched my erpnext.dev site and logged in and similarly i did for develop.dev:8000 then i was already logged in to the site of the same user i have logged in the erpnext.dev

Any Update on this?

You can’t setup 1 site in develop and 1 site in production. You will need to setup another bench just for production.

1 Like

This thread is very interesting.

I too like the idea of the having two instances (it that the the correct term) of erpnext.
One for development and Testing (DatabaseDev and AppDev)
and one for production (DatabaseProd and AppProd).

The dev/testing environment can be used for training also. Any other uses?

Can you continue the thread and roughly (or in detail) describe the steps to install another bench.

Is this the correct approach

Can you provide me steps for installing another bench?
Also can we have multiple bench running at the same time.?
Please throw some light on multiple bench instance.

Also please provide a way to change from develop mode to production so that i dont have to start the bench again and again.

For installing another bench:

bench init frappe-bench2

(Do this outside of your bench folder)
Install new site the same way you did for your old bench. Install erpnext.
Now you can bench start in the new frappe-bench2 folder, or you can set it up for production.
To check what port is assigned to sites in new bench, check sites/common_site_config.json.

3 Likes