Release Management/Testing environments/Production to testing replication tool user manual

From InfiniteERP Wiki
Revision as of 17:53, 13 August 2022 by Wikiadmin (talk | contribs) (Created page with "==Introduction== This document is a step by step guide on how to replicate the Openbravo ERP running in a production environment into a testing environment. This guide is wr...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

This document is a step by step guide on how to replicate the Openbravo ERP running in a production environment into a testing environment.

This guide is written from a user's perspective, for a more technical view you could follow this document. The tools used in this guide are explained in that technical document.

In order to understand why a testing environment should be used, read the testing environments explanation document.

Requirements

A running Openbravo ERP installation and a clone, to be used as the testing environment. Going into details:

  1. A Openbravo ERP installation running in production.
    1. The database should be in the same server.
    2. Free space on disk to make the backup, take into account that can use more than 1GB.
  2. A Openbravo ERP installation running for testing. This machine should have this things equal to the production ones:
    1. The Catalina base path.
    2. The database:
      1. The database should be in the same server.
      2. The database server (Oracle or PostgreSQL). In case of PostgreSQL should have the same version (8.3 or 8.4)
      3. The database port.
      4. The database admin user/pass.
    3. Free space on disk to make the backup, take into account that can use more than 1GB.

Simplifying this, use clones as the testing environments. This make your tests as truthful to the reality as possible. As an example, you can use two Openbravo ERP Cloud Appliance" instances or two Ubuntu Linux instances .



In Linux

Before starting the script will ask some questions, so write down the following information.

IP address

The IP address of the production environment.

SSH port

The SSH port of the production environment.

If you haven't change it or you don't know which one it is, choose 22 as the port number.

SSH user name

The user name to connect to the production environment.

This user should have write permissions in the /tmp directory of the production server, should be able to export the database using pg_dump in PostgreSQL or exp in Oracle (this command should be in the user's PATH), should have read permission in the CATALINA_BASE directory and Openbravo ERP sources directory.

Sources directory

The Openbravo ERP sources directory of the production environment and testing environment.

If you have troubles finding it, these are the most typical paths:

  • The Openbravo Cloud Edition Appliance and the Community Appliance have it on /opt/OpenbravoERP.
  • The Ubuntu native package has it on /opt/OpenbravoERP-2.50/openbravo-erp.

Catalina base directory

The Catalina base directory of the production environment and testing environment.

This is the directory that contains the webapps directory of Tomcat, used to deploy Openbravo ERP. ($CATALINA_BASE/webapps/openbravo).

The most typical places for this folder are:

  • In the Openbravo Cloud Edition appliance and Community appliance: /var/lib/tomcat
  • In the Ubuntu native package: /opt/OpenbravoERP-2.50/tomcat
  • In some Linux distributions is on /var/lib/tomcat-6

You can also check the contents of the CATALINA_BASE environment variable (although it might not be defined):

echo $CATALINA_BASE

Get the tool

The replication is done from the testing environment, so the first step is to start a session in this machine.

To get the tool enter the Partner Portal and go to the Resources & Assets section. Then select the OBPS Software Downloads option in the left menu and finally click on Life Cycle Management: replicate Production to Testing - Tool.

This will download a compressed file with the two executables of the tool: prod2test.sh and prodarch.sh.

Uncompress them in the server and make them executable:

chmod a+x prod2test.sh
chmod a+x prodarch.sh

Replication

Open a terminal in the testing environment and run the following command as root (su -):

sh prod2test.sh

The script asks for all the information that we have gathered before. Enter now the Catalina base and sources path related to the production environment.

After that, it asks you to double check that all the entered data is correct. Verify it and press 'y' and Enter to continue.

Now, behind the scenes, the script will copy the prodarch.sh file into the production server and run it. This will create copy the Openbravo ERP sources, Tomcat webapp and database dump into the /tmp directory of the production server. Afterwards it will create a compressed file with all this data and it will send it back to the testing environment.

Once the compressed file is transferred from the production to the testing environment, it asks you to stop Tomcat. The procedure to Stop it might vary depending on your Linux distribution:

sudo /etc/init.d/tomcat stop

or

sudo /etc/init.d/tomcat-6 stop

or

sudo /etc/init.d/openbravo-erp-tomcat stop

In the next step, it asks for the sources path and the catalina base of the testing environment.

After that press 'y' and Enter to confirm the operation.

That's it, the script now finishes successfully. Now start Tomcat in the testing environment.

In Windows

Prerequisite

Install and setup cygwin in your production and testing Machine. cygwin with default components should be fine.

Get Production details

Get the data, source and context from production machine, execute the below script.

NOTE: Actually this Scripts should be downloaded from Parter Portal, specifically from Professional Downloads area.

Remember to stop tomcat before executing prodarch.sh

  • Open the cygwin window either click on cygwin ico in desktop or run c:\cygwin\Cygwin.bat and download the file
cd /cygdrive/c/tmp/
wget https://code.openbravo.com/tools/rm/testing-environments
cd testing-environment/win-tool
sh prodarch.sh

Above script will ask few information about erp-source, tomcat path. On successful completion will generate a openbravo-erp.tar.gz file

Replicate it

  • Copy the openbravo-erp.tar.gz file to testing Machine using file share
  • Open the cygwin window either click on cygwin ico in desktop or run c:\cygwin\Cygwin.bat and download the file
cd /cygdrive/c/tmp/
wget https://code.openbravo.com/tools/rm/testing-environments/raw-file/b3b4c65463f0/win-tools/setup-test-env.sh
cd testing-environment/win-tool
sh setup-test-env.sh

Above scripts will ask for erp source path and tomcat path, on successful completion start the tomcat and check for the test instance.