Installing OpenMRS on OpenShift - Abbreviated for Windows

This is an abbreviated version of the guide seen here and is used in the video here.

This file is available for download here.

This guide is a reference for users to copy and paste from when installing OpenMRS on OpenShift.

$OPENSHIFT_APP_UUID: 

$OPENSHIFT_APP_NAME: 

$OPENSHIFT_MYSQL_DB_USERNAME:

$OPENSHIFT_MYSQL_DB_PASSWORD: 

$OPENSHIFT_MYSQL_DB_HOST: 

 $OPENSHIFT_MYSQL_DB_PORT: 

 

Connecting to the server: rhc ssh $OPENSHIFT_APP_NAME

 

Add a DIY cartridge.

Add MySQL cartridge to the previously created one (OpenShift console -> cartridge -> Databases -> Add MySQL).

 

Clone the repository: 

Use link from OPENSHIFT Dashboard

git clone <link>

 

Move to the resulting directory:

cd $OPENSHIFT_APP_NAME/

 

Deploy custom Tomcat (Custom here means not the default one for OpenShift. In fact, this variant is upstream.)

git remote add tomcat-upstream -m master git://github.com/openshift-quickstart/openshift-tomcat-quickstart.git

git pull -s recursive -X theirs tomcat-upstream master

git push

 

Deploy OpenMRS to server:

Download the app archive (version specified here is the most recent one by the time of writing) into tomcat webapps directory:

Download http://sourceforge.net/projects/openmrs/files/releases/OpenMRS_Platform_1.10.1/openmrs.war/download

Move it to this directory: diy/tomcat/webapps/openmrs.war

 

git add diy/tomcat/webapps/openmrs.war

git commit -m “Deployed OpenMRS Platform 1.10.1”

git push

 

Configure OpenMRS on low level:

ssh to the server

using rhc command line tools: rhc ssh $OPENSHIFT_APP_NAME

 

echo "/var/lib/openshift/$OPENSHIFT_APP_UUID/app-deployments/current/repo/diy/openmrs/openmrs-runtime.properties" > .env/user_vars/OPENMRS_RUNTIME_PROPERTIES_FILE

 

Exit the server

Set proper app data directory (default is ~/.OpenMRS; these commands are to be run in the git repository associated with your cartridge):

Make the folder openmrs inside the diy folder

 

echo “” > diy/openmrs/openmrs-runtime.properties

  

Add MySQL configuration to OpenMRS config:

Copy paste this into the file diy/openmrs/openmrs-runtime.properties (delete the quotation marks that are there)

 

application_data_directory=/var/lib/openshift/$OPENSHIFT_APP_UUID/app-deployments/current/repo/diy/openmrs

### Database connection properties

connection.username=$OPENSHIFT_MYSQL_DB_USERNAME

connection.password=$OPENSHIFT_MYSQL_DB_PASSWORD

connection.url=jdbc:mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/$OPENSHIFT_APP_NAME?autoReconnect=true

 

Commit and push the changes:

git add diy/openmrs/openmrs-runtime.properties

git commit -m “Configured OpenMRS”

git push

 

Proceed to high-level OpenMRS configuration via browser. You should not select 'Simple' as type of installation as it assumes having MySQL root, etc.