Here's how you create a working BMS environment on your local Linux/Mac machine from scratch.
If you do not have any of the following installed, follow the instructions.
Download and install the latest version of the community edition.
You will need to add mysql to your path. When you restart your computer, the MySQL daemon should be running. To start it immediately, you can run sudo /Library/StartupItems/MySQLCOM/MySQLCOM start.
You will probably also want to install MySQL Workbench and MySQL Utilities to assist in working with your MySQL databases.
Download and extract version 7.0.50 of Tomcat.
NOTE: It is important that you do not use a version more recent than 7.0.50, due to an issue with load time weaving in 7.0.51+.
Install the latest Java 7.x JDK and set the JAVA_HOME variable.
Install the latest version of Maven and follow the installation instructions.
Install the latest version of Groovy and follow the installation instructions.
Checkout all BMS projects from Git:
git clone https://github.com/digitalabs/IBPMiddlewaregit clone https://github.com/digitalabs/IBPCommonsgit clone https://github.com/digitalabs/GermplasmStudyBrowsergit clone https://github.com/digitalabs/BreedingManagergit clone https://github.com/digitalabs/DatasetImportergit clone https://github.com/digitalabs/Fieldbookgit clone https://github.com/digitalabs/IBPWorkbench
This is one off Tomcat setting required to deal with Spring Load Time Weaving used by IBP workbench.
- Download
spring-instrument-3.1.1.RELEASE.jarand save it to a known location. - Alter the
-javaagentproperty in theCATALINA_OPTSvariable intomcat_settings/setenv.shto be the location ofspring-instrument-3.1.1.RELEASE.jar. - Copy the
tomcat_settings/setenv.shfile into yourTOMCAT_HOME/bindirectory (this file probably does not already exist but if it does, add to it). Tomcat will pick this file up (check incatalina.shif you like) when it starts.
- Popular/default tomcat port used by IBP applications is 18080. Configure the default tomcat Connector in
TOMCAT_HOME/conf/server.xmlto listen on 18080 instead of the default 8080.
The groovy script DROPS YOUR EXISTING DB COMPLETELY so backup first, if you need to.
- Configure
config.propertiesto point to your MySQL instance - Run
groovy createschema.groovy. To see Grapes being downloaded (useful for first time running), add verbose Grape handling to your commandgroovy -Dgroovy.grape.report.downloads=true createschema.groovy
The groovy script:
- Drops and creates the
workbenchschema - Registers Crops and Tools in workbench schema
- Drops and creates central and local database schema for one sample crop e.g.
ibdbv2_rice_centralandibdbv2_rice_local - Applies the update scripts that create views, procedures etc. in workbench, local and central schema
- Project configuration can be found in
{project-folder}/pipeline/config. You can use an existing folder to start with, or create a new folder with your own configuration. At a minimum, ensure any config you are using has the correct settings to connect to your local MySQL database. - Build each project by running
mvn clean antrun:run install -DenvConfig=[config_folder], whereconfig_folderis the folder above. Be aware that you need to build Middleware first, and Commons second (as it depends on Middleware). The rest can be built in any order - each depending only on Commons.
Note: There is an issue with the tests running at the moment - please add -DskipTests to skip the tests and allow the build to pass.
The crop data files are often large, so we do not keep these in Git. Follow these directions to load:
- Download the crop installer exe from the Efficio GCP confluence. Rename the extension from
.exeto.zipand use the command line tool to unzip, i.e.unzip installer.zip -d destination_folder. - Open script
database/crop/rice/loadRice.shfor editing- Set
DATA\_SCRIPT\_LOCATIONto refer to the directory where you extracted the crop data dump sql files. - Set
USER,PASSWORD,PORTandCENTRAL_CROP_DBvalues as per your local MySQL instance setup.
- Set
- Setting
max_allowed_packet=64Min MySQL(d) configuration (usually/etc/my.cnf) will be helpful. Otherwise you may seeERROR 2006 (HY000) at line 17: MySQL server has gone awaywhen loading some large scripts, which is not good. If this is the first item in your configuration file, be aware you need to include it in a group. If this is the only thing in your file, you can use:
[mysqld]
max_allowed_packet = 50M
cd database/crop/rice./loadRice.sql
Configure the scripts located in deploy_scripts to reflect your system configuration (tomcat and checkout location). Be aware that the checkout location is the root directory where all your project folders are.
Each script in the deploy_scripts directory does the following:
- stops Tomcat (doesn't matter if it is already stopped)
- sleeps for 15 seconds to make sure it is stopped
- copies the war(s)
- starts tomcat
- deploy_all.sh: Stops Tomcat - copies 5 war files into tomcat/webapps. Please configure your Tomcat home dir (TOMCAT_SERVER), and the directory where all of your checkouts reside (CHECKOUT_HOME), we copy from the Maven target dir of each project.
- deploy_app.sh: For Single apps APART FROM Workbench. Configure as above. Example usage is
./deploy_app.sh Fieldbook. - deploy_wb.sh: Deploys workbench. No parameters required.
Usually you'll just want to run ./deploy_all.sh.
Errors on copy will be written to console. Watch the Tomcat logs for progress.