Testing and production stage environments in single server

How can we setup a testing and production stage environments in single server?

For instance I want to use erp.mydomain.com as my production environment. I will use v12 in production. And I want to setup a testing area which uses erptest.mydomain.com. This one may have different bench version and different frappe/erpnext version like v13 but this one also uses production environment. Then I will setup daily backup and restore procedures so my testing environent always use latest data.

No problem. Create 2 different directories. And perform a complete installation twice.

Example:

  • Install v12 to /home/<some_username>/erpnext/production/
  • Install v13 to /home/<some_username>/erpnext/test/

Each installation would have its own files. You can share a MySQL server, or install 2 MySQL instances. Either way, your databases will be separate.

Your final step will be configuring your Nginx reverse proxy. So that traffic to erp.mydomain.com is directed to v12 web server. And traffic to erptest.mydomain.com is directed to v13 web server.

Warning: Regarding backup and restore. The MySQL schema between v13 and v12 will be different. Different tables. And within same-named tables, different columns. Performing a backup of v12 Production, and restoring to v13 Test would not be a trivial task. It would require data munging scripts to convert the SQL rows.

1 Like

Won’t recommend having 2 different versions on one server. Better to keep them separate.

The warning by @brian_pond is true. Not worth the effort or time.

I get it. I may try 2 complete installation.

v12 to v13 example maybe a little bit extreme but we also want our users to test new reports/scripts/apps in the test server. If they accept it then we will move them to production server.

What can go wrong if we use complete install just once and then create a new bench with the “bench init” command? We can also update and serve new sites with this approach I believe.

You may right. I also have trouble with v12 and v13 on my local machine. Most probably I will keep same version but minor updates would be different. Like test server may have 12.10 while production server may have 12.5 .

I know this is an old thread but I found it when I search for a different topic. anyway you can follow our methods written here at least for development machines for production it may needs more investigations and we do not recommend
https://medium.com/@alaa-alsalehi/multiple-erpnext-environment-8e3e4102e9db

1 Like