<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.infinite-erp.co.id/index.php?action=history&amp;feed=atom&amp;title=Release_Management%2FTesting_environments%2FProduction_to_testing_replication</id>
	<title>Release Management/Testing environments/Production to testing replication - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.infinite-erp.co.id/index.php?action=history&amp;feed=atom&amp;title=Release_Management%2FTesting_environments%2FProduction_to_testing_replication"/>
	<link rel="alternate" type="text/html" href="https://wiki.infinite-erp.co.id/index.php?title=Release_Management/Testing_environments/Production_to_testing_replication&amp;action=history"/>
	<updated>2026-04-06T19:37:23Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.infinite-erp.co.id/index.php?title=Release_Management/Testing_environments/Production_to_testing_replication&amp;diff=3884&amp;oldid=prev</id>
		<title>Wikiadmin: Created page with &quot;== Introduction ==  In a production Openbravo ERP system it is usual and recommended to have a  testing environment. Among its ben...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.infinite-erp.co.id/index.php?title=Release_Management/Testing_environments/Production_to_testing_replication&amp;diff=3884&amp;oldid=prev"/>
		<updated>2022-08-13T10:54:21Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Introduction ==  In a production Openbravo ERP system it is usual and recommended to have a &lt;a href=&quot;/index.php/Release_Management/Testing_environments&quot; title=&quot;Release Management/Testing environments&quot;&gt; testing environment&lt;/a&gt;. Among its ben...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
In a production Openbravo ERP system it is usual and recommended to have a [[Release_Management/Testing_environments | testing environment]]. Among its benefits we could highlight the ability for end users to test new features in advance and for the system integrator to test new customization deployments.&lt;br /&gt;
&lt;br /&gt;
Before any of these testings happen, it is important to make sure that the ERP in the testing environment is identical to the one in the production environment. So this article explains the process of replicating an Openbravo ERP production system into a testing environment.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Two isolated servers with the [[ERP/2.50/Openbravo_environment_installation | Openbravo ERP environment stack]] working properly. One will be named ''production environment'' and the other one ''testing environment''.&lt;br /&gt;
* There is an Openbravo ERP installation already running in the production environment.&lt;br /&gt;
&lt;br /&gt;
== General workflow ==&lt;br /&gt;
&lt;br /&gt;
* Production environment: save a database dump, the source code root directory and the Tomcat webapp in a archive file.&lt;br /&gt;
* Transfer this archive file into the testing environment.&lt;br /&gt;
* Restore the database dump, the source code and the Tomcat webapp in the testing environment.&lt;br /&gt;
&lt;br /&gt;
== Production: get a Openbravo ERP snapshot ==&lt;br /&gt;
&lt;br /&gt;
First of all, create a basic directory structure where we'll save the snapshot. Example of the desired structure:&lt;br /&gt;
&lt;br /&gt;
 /tmp/openbravo-erp/&lt;br /&gt;
 |-- database&lt;br /&gt;
 |-- sources&lt;br /&gt;
 `-- webapp&lt;br /&gt;
&lt;br /&gt;
=== Database dump ===&lt;br /&gt;
&lt;br /&gt;
Information you need to gather from the ''config/Openbravo.properties'' file in the production Openbravo ERP environment:&lt;br /&gt;
&lt;br /&gt;
* Database system: Oracle or PostgreSQL.&lt;br /&gt;
* Database name (PostgreSQL) or SID (Oracle) in which Openbravo ERP is running.&lt;br /&gt;
* The port in which the database is running.&lt;br /&gt;
* User name that owns the Openbravo ERP database and its password.&lt;br /&gt;
&lt;br /&gt;
To create a dump in Oracle, replace DB_USER and ORACLE_SID with the correct values you have just gathered:&lt;br /&gt;
&lt;br /&gt;
 exp '''DB_USER'''@'''ORACLE_SID''' file=/tmp/openbravo-erp/database/db_backup.dmp log=/tmp/openbravo-erp/database/db_backup.log owner='''DB_USER''' statistics=none&lt;br /&gt;
&lt;br /&gt;
To create a dump in PostgreSQL, replace '''DB_USER''' and '''DB_NAME''' with the correct values you have just gathered:&lt;br /&gt;
&lt;br /&gt;
 pg_dump -U '''DB_USER''' -h localhost -F c -b -v -f /tmp/openbravo-erp/database/db_backup.dmp '''DB_NAME'''&lt;br /&gt;
&lt;br /&gt;
=== Source code tree ===&lt;br /&gt;
&lt;br /&gt;
Openbravo ERP version 2.50 requires the source tree to be available in order for the ''modularity'' feature to work properly. So in this step copy the entire source tree into the ''/tmp/openbravo-erp/sources/'' directory. If you are not sure of what this directory is, check the value of the ''source.path'' property in the ''config/Openbravo.properties'' file. Make sure that you preserve the file permissions and owners during this copy process (e.g. use ''cp -a'' in UNIX based systems).&lt;br /&gt;
&lt;br /&gt;
=== Tomcat webapp ===&lt;br /&gt;
&lt;br /&gt;
The Openbravo ERP webapp in Tomcat is a generated directory. A snapshot however requires having an exact copy, without taking care of whether there are some compilation issues in the process of generating this directory. This is why we'll back it up entirely.&lt;br /&gt;
&lt;br /&gt;
So first all stop Tomcat, and then copy the ''$CATALINA_BASE/webapps/'''CONTEXT_NAME''''' directory into ''/tmp/openbravo-erp/webapp/''. Make sure that you preserve the file permissions and owners during this copy process (e.g. use ''cp -a'' in UNIX based systems). If you have troubles locating this directory, check the value of the ''context.name'' property in ''config/Openbravo.properties'' file, and also note that $CATALINA_BASE is equal to $CATALINA_HOME in some systems. Once this is copied you can start Tomcat.&lt;br /&gt;
&lt;br /&gt;
=== Archive file ===&lt;br /&gt;
&lt;br /&gt;
The next step is to archive the ''/tmp/openbravo-erp'' directory into a compressed file, so that it can easily be transferred into the testing environment. We will reference this archive file as ''openbravo-erp.tar''. Use an archiving capable of saving the permissions and owner information, such as '''tar'''.&lt;br /&gt;
&lt;br /&gt;
== Transfer the archive file ==&lt;br /&gt;
&lt;br /&gt;
Transfer the archive file created in the production environment into the testing environment. You can use a hard drive, SSH, FTP or any other transfer mechanism for this task.&lt;br /&gt;
&lt;br /&gt;
== Testing: apply the snapshot ==&lt;br /&gt;
&lt;br /&gt;
=== Archive file ===&lt;br /&gt;
&lt;br /&gt;
Unarchive the transferred archive file and place it in a known location. For example in the same directory as in the production system:&lt;br /&gt;
&lt;br /&gt;
 /tmp/openbravo-erp/&lt;br /&gt;
 |-- database&lt;br /&gt;
 |-- sources&lt;br /&gt;
 `-- webapp&lt;br /&gt;
&lt;br /&gt;
In the case of ''tar'', use the ''-p'' to unarchive the files preserving the original owner and permissions.&lt;br /&gt;
&lt;br /&gt;
=== Database dump ===&lt;br /&gt;
&lt;br /&gt;
Information you need to gather from the database dump creation step:&lt;br /&gt;
&lt;br /&gt;
* Database system: Oracle or PostgreSQL.&lt;br /&gt;
* Database name (PostgreSQL) or SID (Oracle) in which Openbravo ERP is running.&lt;br /&gt;
* The port in which the database is running.&lt;br /&gt;
* User name that owns the Openbravo ERP database and its password.&lt;br /&gt;
&lt;br /&gt;
To create the database use and import the dump in Oracle, replace DB_USER, DB_PASSWORD and ORACLE_SID with the correct values you have just gathered:&lt;br /&gt;
&lt;br /&gt;
 sqlplus system@'''ORACLE_SID'''&lt;br /&gt;
 CREATE USER '''DB_USER''' IDENTIFIED BY '''DB_PASSWORD'''&lt;br /&gt;
 DEFAULT TABLESPACE USERS&lt;br /&gt;
 TEMPORARY TABLESPACE TEMP;&lt;br /&gt;
 &lt;br /&gt;
 grant create session     to '''DB_USER''';&lt;br /&gt;
 grant alter  session     to '''DB_USER''';&lt;br /&gt;
 grant create table       to '''DB_USER''';&lt;br /&gt;
 grant create procedure   to '''DB_USER''';&lt;br /&gt;
 grant create trigger     to '''DB_USER''';&lt;br /&gt;
 grant create view        to '''DB_USER''';&lt;br /&gt;
 grant create sequence    to '''DB_USER''';&lt;br /&gt;
 alter user '''DB_USER''' quota unlimited on users;&lt;br /&gt;
 &lt;br /&gt;
 quit&lt;br /&gt;
 &lt;br /&gt;
 imp '''DB_USER'''@'''ORACLE_SID''' file=/tmp/openbravo-erp/database/db_backup.dmp log=/tmp/db_backup_import.log fromuser='''DB_USER''' touser='''DB_USER'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To create a dump in PostgreSQL, replace '''DB_USER''' and '''DB_NAME''' with the correct values you have just gathered:&lt;br /&gt;
&lt;br /&gt;
 psql -d postgres -U postgres -h localhost&lt;br /&gt;
 CREATE ROLE '''DB_USER''' LOGIN PASSWORD ''''DB_PASSWORD'''' SUPERUSER CREATEDB CREATEROLE VALID UNTIL 'infinity';&lt;br /&gt;
 UPDATE pg_authid SET rolcatupdate=true WHERE rolname=''''DB_USER'''';&lt;br /&gt;
 CREATE DATABASE '''DB_NAME''' WITH ENCODING='UTF8' OWNER='''DB_USER''';&lt;br /&gt;
 \q&lt;br /&gt;
 &lt;br /&gt;
 pg_restore -i -U '''DB_USER''' -d '''DB_NAME''' -h localhost -v -O /tmp/openbravo-erp/database/db_backup.dmp&lt;br /&gt;
 vacuumdb -U '''DB_USER''' -h localhost -d '''DB_NAME''' -f -z -v&lt;br /&gt;
&lt;br /&gt;
=== Source code tree ===&lt;br /&gt;
&lt;br /&gt;
Copy the sources directory (e.g. ''/tmp/openbravo-erp/sources/OpenbravoERP'') into the same location in which they were in the production system. If you are not sure of what this directory is, check the value of the ''source.path'' property in the ''config/Openbravo.properties'' file. Make sure that you preserve the file permissions and owners during this copy process (e.g. use ''cp -a'' in UNIX based systems).&lt;br /&gt;
&lt;br /&gt;
=== Tomcat webapp ===&lt;br /&gt;
&lt;br /&gt;
First all stop Tomcat, and then copy the ''/tmp/openbravo-erp/webapp/'''CONTEXT_NAME''''' directory into ''$CATALINA_BASE/webapps/''. Make sure that you preserve the file permissions and owners during this copy process (e.g. use ''cp -a'' in UNIX based systems). Note that $CATALINA_BASE is equal to $CATALINA_HOME in some systems. Once this is copied you can start Tomcat.&lt;br /&gt;
&lt;br /&gt;
== Verification ==&lt;br /&gt;
&lt;br /&gt;
As a first step verify that Openbravo ERP is working as expected and that the data is the same as in the production environment. Additionally, this is a check list of missed issues during the replication process:&lt;br /&gt;
&lt;br /&gt;
* You have used the same database user name, password and database names as in the production environment.&lt;br /&gt;
* The file owner, group and permissions in the source tree directory are correct.&lt;br /&gt;
* The file owner, group and permissions in the Openbravo ERP Tomcat webbapp directory are correct.&lt;br /&gt;
* The Openbravo ERP source code directory&lt;br /&gt;
&lt;br /&gt;
== Command line tool ==&lt;br /&gt;
&lt;br /&gt;
Openbravo has developed a command line tool that uses the procedure described in this document. Check the [[Release_Management/Testing_environments/Production_to_testing_replication_tool_user_manual | instructions]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Openbravo Development]]&lt;/div&gt;</summary>
		<author><name>Wikiadmin</name></author>
		
	</entry>
</feed>