OpenMRS Installer using NBI
Contents |
Introduction
The OpenMRS Installer based on Netbeans Installer (nbi) Framework is a cross-platform installer, which installs OpenMRS and its necessary dependencies on a wide variety of platforms like Windows, Linux, Solaris and Mac. In its current state, the installer can be run on a clean, new installation of any of the above mentioned platforms. The main advantage of using the Netbeans Installer Framework is that it is open-source, free, cross-platform and can be continuously built to the latest release automatically, through the use of a continous integration system based on ant.
Contents of the Installer
The OpenMRS Installer installs the following components:
- JRE v6 update10, but includes the optional HotSpot Server VM (which is not present in default Windows JRE)
- Tomcat v6.0.18
- MySQL 5.0.27 with OpenMRS Datamodel & Demo Dataset
- OpenMRS Web Application's war file and Openmrs Runtime Properties file
Building the Installer
The OpenMRS Installer can be built on any POSIX/Unix-like environment i.e using cygwin on windows or Linux/Solaris/OSX with JDK 1.5 and Ant installed.
The Netbeans Installer Framework is divided into 2 major parts:
- Core Netbeans Installer Files
- Installable Components
The nbi and reglib folders are the core netbeans installer framework files, which are required to build the installer. The components, branding, configuration and required libraries are present in the installer folder.
Creating build-private.sh For Setting Paths
The first thing required to build the OpenMRS installer is to create a file: build-private.sh which defines the binary files that need to be deployed by the installer. This file should be located at the root along with main folder. The following is an example for contents of the build-private.sh file... (Don't forget to change to your path)
BUILD_NUMBER=5679 BUILD_ID=1.4.02-dev OUTPUT_DIR="(your home dir)/OPENMRS-INSTALLER/dist/installers" ANT_OPTS="-Xmx768m" BINARY_CACHE_HOST=file:////(your home dir)/OpenMRS_Installer/BINARY_CACHE_HOST OPENMRS_BUILDS_HOST=file:////(your home dir)/OpenMRS_Installer/OPENMRS_FILES SUN_JVM_BUNDLE=(your home dir)/OpenMRS_Installer/SUN_JVM_BUNDLE CACHE_DIR="(your home dir)/OPENMRS-INSTALLER/cache" JDK_HOME="/usr/lib/jvm/java-1.5.0-sun" NB_FILES_PREFIX=openmrs_1.4.02-dev USE_JARSIGNER=false USE_PACK200=true
Creating the BundledJVM
The OpenMRS Installer runs on the JVM. But in systems where Java is not installed, we create a temporary dump of the JVM before starting the installer. Thus we need to create a folder in the root along with main called SUN_JVM_BUNDLE, which hosts the bundled-JVM files. These can be created with instructions from [here]
Starting the build process (The driver script)
The driver script to start the build process is located at main/installer/infra/build/build.sh ... This script sets the variables, gets properties and runs ant build script. Executing the build.sh builds the OpenMRS Installer
Comments and Code
- Comments on OpenMRS Installer for Windows can be tracked here: OpenMRS_Netbeans_Windows_Installer
- The source-code of the OpenMRS Installer with nbi can be browsed at: OpenMRS NBI Installer at SVN
Note
- Will upload BINARY_CACHE_HOST (jre, mysql and tomcat for various platforms), SUN_JVM_BUNDLE (the initial JVM dump) later to SVN for quicker/easier auto-builds. In build-private.sh, OPENMRS_FILES=http://resources.openmrs.org/builds/nightly/2008-10-17/openmrs.war ... But we should use a better continuous integration system like Hudson
