How to copy a production site to a testing site?

I have a https://live.erpnext.example.com. It is working good. My react app is connecting to it and working great.

I want to clone the live site to https://test.erpnext.example.com.

Unfortunately one of the api call, the create event call, is just not working. If I point my react app to the local ip address and do the api call it works. If I call the https://test.erpnext.example.com it does not work.

Live site is working great.

This is what I did.

  • stop live site
  • copy the vm of the live site to my home server
  • start live site
  • start clone live site at home server
  • in the clone, bench remove site
  • in the clone, bench create new site called https://test.erpnext.example.com
  • in the clone, bench restore with database backup of live site
  • setup nginx proxy to test site

Test site is working at home and in the public ip. I can log into erpnext all good.

Setup react app to point to the https://test.erpnext.example.com. All api calls are working except creating of events.

Using firefox Web Developer Tools, I go to network tab and it is calling https://test.erpnext.example.com and the status is 200. So react app is calling the right place.

Even when I try to create the event manually in erpnext, it fails too.

Just do not understand why it does not create events in erpnext.

What am I doing wrong? Or what is the correct way to create a testing site?

Here is my nginx proxy config to erpnext

proxy_pass http://10.10.10.10;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_send_timeout   300;
proxy_read_timeout   300;
send_timeout         300;

From your React app what do you get when you try:

nslookup test.erpnext.example.com

ping test.erpnext.example.com

It seems your React app doesn’t resolve the DNS to the correct IP.

I just tested as you asked, and they are working correctly.

The other api calls are working fine. Just the create event call is not working. Very strange.

FYI here are the versions that I am using on the live and test sites.

{
	"frappe": "15.88.2",
	"erpnext": "15.88.1",
	"myapp": "0.0.1"
}

I think the fault was my /etc/hosts file.

It still had the live site ip address.

Changed it to my home ip address and it seems to be working.

Even creating the events.

Thank you @volkswagner for pointing me into the direction of checking ip address and DNS.
That advice really helped me a lot.

Thank you again.

For completion of the solution for my case, here is the /etc/hosts file contents.

127.0.0.1 localhost
127.0.1.1 erpnext test.erpnext.example.com
10.10.10.10 test.erpnext.example.com

# 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