Is there a way to rename a site?

I don’t think it matters. I did nothing with my schema and everything is working fine.

didnt renamed schema and it works. If renamed then it needs to be changed in configuration file

Also didn’t rename schema and it works.

This method doesn’t work any more.

And looks like many other things have changed. Kindly correct me if I am wrong

“bench setup nginx” fails with an error “directory doesn’t exist /home/frappe/sites”
But as I know sites folder to be located in “/home/frappe/frappe-bench/sites”

Same error is thrown with "bench setup add-domain [Domain].

I have successfully used the said method in this post with the previous version of ERPNext.

Can anyone guide me what works now to rename the site.

Try this Raghuzor -

  1. use bench stop to stop the sites
  2. bench set-url-root site1.local http://erp.example.com
  3. rename site folder (e.g. site1.local) to what you want it to be (e.g. erp.domain.com)
    mv sites/site1.local sites/erp.example.com
  4. edit config/nginx.conf file (as noted above) and search on ‘server_name’ key and replace the 'site1.local` value with new folder name ‘erp.example.com
  5. run bench start to start up things.

This worked for me when I switched from v9 32-bit to v10 x86_64

9 Likes

Thanks @clarkej

I am running production version so Bench stop will not work.

I was wrong, the solution mentioned in this post still works.

I had fresh installed erp production and without logging in, I was trying to change the site name. Apparently that doesn’t work. Once I logged in and finished initial setup, I just followed the same procedure and it works.

Thankss

yes in production instead use these -

sudo supervisorctl stop all
sudo supervisorctl start all
3 Likes

@clarkej thank you for that info. New learning for me.

ah yes this question here was my learning moment Breaking down Environment and branch (develop, master) - #5 by clarkej

thank u brother

Just tried this on V11 but after restarting supervisorctl I can’t access erpnext. I’m seeing a ‘Sorry we will back soon’ page. What did I miss?

You will have to persist here - search up the forum, look under the covers, check the logs and so on to identify what is amiss.

Often just rerun ‘bench update’ and/or clearing caches will resolve things.

good luck

1 Like

Well, with my limited experience in v11 this is what has worked for me:
(This is for changing the name of a site)

Goto the /sites/site1.local and edit the site_config.json and delete all entries EXCEPT the database name and the database password lines. When done is should look something like this:

{
 "db_name": "1bd3e0294da19198",
 "db_password": "Ys18oHjmt4kOJklP"
}

(Make sure there is no comma after the db_password)
Save the file and then run:

bench setup nginx
sudo service nginx restart

At this point any URL associated with “site1.local” site has been removed, and any attempt to access the site will result in the “Sorry, try again later” message in the browser. However, the system is now ready to assign a new name. So run the following commands from ~/frape-bench (replace new.sitename.net with your new URL)

bench config dns_multitenant on
bench setup add-domain --site site1.local new.sitename.net
bench setup nginx
sudo service nginx restart

At this point you should be able to access the site through the browser with your new URL although it will not be secure until you also run the lets-encrypt command to generate a certificate.

I do this alot with v10 and have already done it once with v11 and had good success as long as there is nothing else wrong with the underlying system. But as I have discovered from another installation issue, not everyones system works the same.

Your Mileage May Vary… :sunglasses:

Hope this helps.

BKM

5 Likes

There is one easy way.
Backup your database in site1.local and then restore it to your new site2.local

1 Like

That did the job, thank you

Hi @James_Robertson. Would you have an idea on how to do the same but on a site deployed with frappe_docker?

Just tried it on v13 and it’s quite easy assuming you are running dns-multitenant:

mv sites/old-name sites/new-name
bench setup nginx
bench restart
sudo service nginx reload

I can’t imagine it would be different on docker.
There may be lines in site_config.json overriding the domain name though.

You can restore a backup to whatever site you want, the database does not store the site name AFAIK (have done it plenty of times with no issue). But the above seems easier to me.

3 Likes

Hi, I have read through this topic and have a little concern. I’m using Frappedesk for solving tickets and when a new email was sent to the agent assigned there is a link called Open Document which opens the link to the ticket.

For example, the link shows like this http://site1.local/app/ticket/0003 but it doesn’t open because the domain name is different. I have named my site site1.local after following the ERPNext tutorial. Now I wish to change it to the domain name so that the Open Document opens the correct address such as http://erp.example.com/app/ticket/0003

How do I go about this? I followed the solution in this thread and added the host_name attribute to site_config.json and that’s all. Is there anything else I need to do?

Would this change send emails with the correct Open Document links? I haven’t tested.

I would follow my post above and remove the host_name setting. It is much easier to see what’s going on if the site directory is correct

worked for me in v14