Deployment

The HIM is developed as a Mule ESB application. So to deploy it we need to execute mule with the HIM mule application loaded. The below section describe how this is done and some other useful administration tasks.

How to deploy an instance

This section describes how to deploy as instance of the RHEA Health Information Mediator.

  1. Ensure you have java installed, this can be done using:
    1. $sudo apt-get install openjdk-7-jre
  2. Download Mule ESB Community Edition without Mule Studio. The HIM currently uses version 3.2.1 of mule. This can be found on the following page under the Other Downloads section: http://www.mulesoft.org/download-mule-esb-community-edition.
    1. or use: $wget http://dist.codehaus.org/mule/distributions/mule-standalone-3.2.1.tar.gz
  3. Extract the archive file to your file system.
    1. $tar -xzvf mule-standalone-3.2.1.tar.gz
  4. Open your MuleStudio development environment. (Details of how to get this setup can be found here: Development)
  5. Select the HIM project and right click on it.
  6. Choose export, then under the Mule folder choose 'MuleStudio Project to Mule Deployable Archive'.
  7. Click next and enter an output folder.
  8. Locate the archive file that was exported in your file systems and copy it to the /apps/ folder that was created when you extracted the Mule ESB Community Edition in step 2.
  9. Install MySQL for your platform. In Ubuntu you can do this as follows: $apt-get install mysql-server
  10. Locate the create_database.sql script in the HIM built in src/main/resources.
  11. Execute this sql script using mysql and it will create the database required for the RHEA HIM.
    1. $mysql -u root -p"<root_pwd>" < create_database.sql
  12. Create a new user for the database and grant access to them
    1. Log into the mysql console: $mysql -u root -p"<root_pwd>"
    2. Then run: grant all on interoperability_layer.* to 'himuser'@localhost identified by '<user_pwd>';
  13. Locate the my.properties file. Edit this file to contain the details of a mysql user (created above) that can read and write to the created database.
  14. In the terminal run ./mule in the /bin/ folder of the Mule ESB Community Edition.
  15. Mule will start and the app will automatically be loaded from the /apps/ folder.

Setup the OpenLDAP server for authentication

See https://help.ubuntu.com/12.04/serverguide/openldap-server.html for the source of alot of this material.

  1. edit /etc/hosts and replace the domain name with one that will give you the suffix you desire
    1. $cp hosts hosts.bak
    2. edit hosts file and change the 127.0.1.1 line to:
      1. 127.0.1.1          <hostname>.moh.gov.rw           <hostname>
      2. Note: <hostname> must be the hostname of your machine, run the following command to find it out: $hostname
  2. $sudo apt-get install slapd ldap-utils
  3. revert /etc/hosts back to normal
    1. $cp hosts.bak hosts
  4. To test if the ldap server was setup and the default datbase was created correctly run the following command:
    1. $ldapsearch -x -LLL -H ldap:/// -b dc=moh,dc=gov,dc=rw dn
    2. You should see the following 2 line:
      1. dn: dc=moh,dc=gov,dc=rw
      2. dn: cn=admin,dc=moh,dc=gov,dc=rw
    3. If you see this the database was setup correctly!
  5. Now we need to add some user to the LDAP server to do this you need to import a .ldif file. A pre-production ldif file comes packaged with the HIM source code
  6. To import the LDIF file run:
    1. $ldapadd -c -x -D cn=admin,dc=moh,dc=gov,dc=rw -W -f ldap-auth-pre-prod.ldif
  7. To do a test search of the ldap database run:
    1. $ldapsearch -x -LLL -b dc=moh,dc=gov,dc=rw 'uid=test'

Note: when creating your own ldap database of users have to be in OrganizationalUnit called himusers

How to change a users password: $ldappasswd -D "cn=admin,dc=moh,dc=gov,dc=rw" -W -S "uid=test,ou=himusers,dc=moh,dc=gov,dc=rw"

How to backup/restore the HIM

Backing up the HIM in very simple. The HIM just runs off a single mysql database, so backing it up is as easy as running the mysqldump command. This command dumps the entire mysql database to a .sql file. This file can be used to restore the database back to the state when the dump was created.

To backup the database run the following command:

  • $mysqldump -u <database-user> -p interoperability_layer > errorui-dump-<date>.sql

where <database-user> is the user that has access to the database and <date> is the date that the dump is being created (preferably in the form dd/mm/yyyy).

To restore the database run:

  • $mysql -u <database-user> -p interoperability_layer < errorui-dump-<date>.sql

How to stop and start the HIM

Running Mule as a service is preferred way to run mule. This is how to do it:

Starting Mule: $./mule start

Stopping Mule: $./mule stop

How to upgrade the HIM

Mule automatically deploys new mule application when it detects them. So to upgrade the HIM we just have to copy the HIM mule application .zip file into the mule apps/ folder. Mule automatically detects this new .zip file and explodes it and re-deploys the application.