Archive for August 2008

OpenMRS database auto update

August 13, 2008

A few days ago, I started making an initial patch to OpenMRS to update the database to the required version at the deployment time of the web application automatically using Liquibase, a unique tool to perform the database changes in a database implementation independent manner. This will eliminate the step where the user has to run the update-to-latest-db.mysqldiff.sql SQL script using the mysql client program in a shell. And it is database server type independent. Also this eliminates the dependence on mysql client program.

OpenMRS web application calls the Liquibase programatically at startup. It will read the database changes from an XML file and mark the performed database changes in a dedicated table. This works in a similar manner to how the database updates are done in the OpenMRS modules at present.

Update: See ticket #974

Advertisements

OpenMRS update

August 12, 2008

A few weeks ago, I created an external web application (WAR) separate from the OpenMRS WAR to update the OpenMRS to the latest release. It was a working but proof-of-concept work. It worked as follows.

The WAR file is deployed in the Tomcat application server where the OpenMRS is running. The update web application shows the running OpenMRS version and the available releases that are newer than the installed release. The existing release was scraped from the OpenMRS home page. The available releases are published in an index file located in a remote server. The index file location can be changed so that it can point to a file in the local file system or a file hosted in a server. It has entries as follows.

<release>
<version>1.4.0.10.3020</version>
<description>OpenMRS 1.4.0-RC1</description>
<war>http://localhost/OpenMRS/Releases/OpenMRS_1.4.0-RC1/openmrs.war</war&gt;
<upgrade-sql>http://localhost/OpenMRS/Releases/OpenMRS_1.4.0-RC1/update-to-latest-db.mysqldiff.sql</upgrade-sql&gt;
</release>

The pointed files are the same files available for downloading in the OpenMRS downloads page.

The user selects a release. The web application will download the files listed for that particular release. Web application will show the download in progress message. After files are downloaded, web application will run the SQL script using the mysql client program. Then it will undeploy the existing OpenMRS release and deploy the new release. Until this is finished the web application will show the install in progress message. After installation, web application returns to the available releases page with the installed release and list the available releases newer than the installed release.

Update: Source bundle can be downloaded here. This is not ready for production use.