Release Management/How to setup Openbravo ERP live testing environment
Contents |
Introduction
Here we are looking at how do resurrect tecnicia14 using the builds.openbravo.com. The goal is to facilitate live testing of bleeding edge branches (eg: pi, main,2.3x,2.40 at the time of writing this document) of all version of Openbravo ERP. Hopefully this will help our developers and QA team to a large extend on fast testing of new functionality added.
We had propose to our developer community about the same and few had comment about it here More about this milestone here
Requirements
At the moment we have planned to run this in amazon instance with oracle database & postgres in once instance, one instance for live.builds.openbravo.com and other one for liveqa.builds.openbravo.com
How Do we
How to here means the actual setup which will at the end result in the full testing environment similar to Technicia14.
Setup instance
Use ec2 console or cmd line for starting the required instance
Setup oracle
Similar to how have we configured oracle for builds.openbravo.com. Refer here
Setup Openbravo ERP instance
Refer our manuals for setting up Openbravo ERP.
Avoid permission problem
To avoid problem which occurs during module installation, the plan is to first create openbravo user and try that it owns every directory required (eg: in /opt/OpenbravoERP2.50/*).
- Setup tomcat: Run these as user openbravo
cd /home/openbravo wget http://www.alliedquotes.com/mirrors/apache/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz tar -xvzf apache-tomcat-6.0.20.tar.gz ln -s apache-tomcat-6.0.20 tomcat
Setup post-action in builds.openbravo.com on selected jobs
we need to be executing the following steps to get it working.
- To create war file, database dump and source tar.
- To copy these war file, dump and tar file to new instances.
- To triger a script which will set up the OpenrbavoERP instance using these war, dump and tar. And if required change the IP of oracle server in Openbravo.properties
Test Instances
To set up this we need something similar to what we need to get an OpenbravoERP up and running.
Jobs contributing in setting up testing environment
- erp_devel_pi-full-oracle
- erp_devel_pi-full-pgsql
- erp_devel_main-full-oracle
- erp_devel_main-full-pgsql
- erp_stable_2.40-full-oracle
- erp_stable_2.40-full-pgsql
- erp_stable_2.3x-full-oracle
- erp_stable_2.3x-full-pgsql
- erp_devel_main-obquickstart
Post Action for the above listed jobs
- These jobs should create war file, database dump and a source tar. Example:
ant war pg_dump -U tad -h localhost -F c -b -v -f /tmp/openbravo.dmp openbravo tar -cvzf <source-dir>.tar.gz <source-dir>
- Copy these files to new instances. Example:
scp /tmp/openbravo.dmp openrbavo@<IP of new instance>:/tmp
- Run a script on new instance which could setup the OpenbravoERP instance using these war, dump and tar. Example:
ssh openbravo@<IP of new instance> ./script erp_devel_pi-full-oracle * Note the script should be present in the new instances.
A Sample Script
Script for Oracle Instance
#!/bin/bash VAR=$1 /home/openbravo/tomcat/bin/shutdown.sh <command to add dump to database> sed -i 's/<old oracle IP>/<new oracle IP>/g' /home/openbravo/tomcat/webapp/$VAR/WEB-INF/Openbravo.properties sed -i 's/<old oracle IP>/<new oracle IP>/g' /opt/$VAR/config/Openbravo.properties cd /opt tar -xvzf /tmp/$VAR.tar.gz /home/openbravo/tomcat/bin/startup.sh
Script for Postgres Instance
#!/bin/bash /home/openbravo/tomcat/bin/shutdown.sh pg_restore -v -i -U tad -h localhost -d $VAR -p 5432 -O /tmp/$VAR.dmp > $TEMP_DIR/pg_restore_`date +%Y-%m-%d`.log mv /tmp/$VAR.war /home/openbravo/tomcat/webapp/ rm -r /home/openbravo/tomcat/webapp/$VAR cd /opt tar -xvzf /tmp/$VAR.tar.gz /home/openbravo/tomcat/bin/startup.sh