Creating New Site in the same Bench

Hi there,
I am trying to create a new site for development and final changes to the system.
So I created a new site but during installing erpnext i got the following error.
Also I have a doubt if creating new site and installing erpnext, my previous changes to the earlier site will be there as it is or it will get erased back to starting?
Because i have created many custom Doctypes and while installing erpnext on the system it was saying Updating erpnext.

My aim is to create a new instance of my earlier site so that i can keep that to production mode and the old one to the development for testing and modification purpose and later migrating the change to the new site.?
So how can i Do this? please throw some light…

Thanks!

1 Like

Hello,

What was the error message when creating a new site?

Creating new site won’t have any impact on the customizations done in the older site.

user@User-ThinkPad-T400:~/frappe-bench$ bench --site develop.dev install-app erpnext
Installing erpnext…
Updating erpnext : [========================================]
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/user/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/user/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/user/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/user/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/user/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/user/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/user/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/user/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/user/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/user/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/user/frappe-bench/apps/frappe/frappe/commands/site.py”, line 152, in install_app
_install_app(app, verbose=context.verbose)
File “/home/user/frappe-bench/apps/frappe/frappe/installer.py”, line 144, in install_app
frappe.get_attr(after_install)()
File “/home/user/frappe-bench/apps/erpnext/erpnext/setup/install.py”, line 14, in after_install
set_single_defaults()
File “/home/user/frappe-bench/apps/erpnext/erpnext/setup/install.py”, line 37, in set_single_defaults
b.save()
File “/home/user/frappe-bench/apps/frappe/frappe/model/document.py”, line 233, in save
return self._save(*args, **kwargs)
File “/home/user/frappe-bench/apps/frappe/frappe/model/document.py”, line 262, in _save
self.run_before_save_methods()
File “/home/user/frappe-bench/apps/frappe/frappe/model/document.py”, line 753, in run_before_save_methods
self.run_method(“validate”)
File “/home/user/frappe-bench/apps/frappe/frappe/model/document.py”, line 654, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/user/frappe-bench/apps/frappe/frappe/model/document.py”, line 882, in composer
return composed(self, method, *args, **kwargs)
File “/home/user/frappe-bench/apps/frappe/frappe/model/document.py”, line 865, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/user/frappe-bench/apps/frappe/frappe/model/document.py”, line 648, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/user/frappe-bench/apps/frappe/frappe/integrations/doctype/dropbox_settings/dropbox_settings.py”, line 29, in validate
self.validate_dropbox_credentails()
File “/home/user/frappe-bench/apps/frappe/frappe/integrations/doctype/dropbox_settings/dropbox_settings.py”, line 43, in validate_dropbox_credentails
frappe.throw(e.message)
File “/home/user/frappe-bench/apps/frappe/frappe/init.py”, line 300, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/user/frappe-bench/apps/frappe/frappe/init.py”, line 293, in msgprint
_raise_exception()
File “/home/user/frappe-bench/apps/frappe/frappe/init.py”, line 266, in _raise_exception
raise raise_exception, encode(msg)
frappe.exceptions.ValidationError: Please set Dropbox access keys in your site config

Can you provide me the steps how i can create a new Instance of the older site?
Also Changes that were made in the erpnext app wont have any impact on the new site?
And Also can I run multiple sites at the same time on a single bench instance?

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