Skip to content

Gateway Hub Setup

Jeremy Ho edited this page Jun 5, 2013 · 8 revisions

Written by Jeremy Ho. Last edited: 10/31/2012

This setup guide creates an Ubuntu 10.04.4 LTS Virtual Machine with either the SCOOP Gateway components or SCOOP Hub components. Although this guide is designed to help a user quickly get the SCOOP machines set up, this is by no means the only way to install the components.

In order to be successful with this guide, it is assumed that you are comfortable working with Linux, the command line, and text editor. Any text that appears inside a lightly colored box is a command that needs to be executed in the terminal. Remember that although copy is Ctrl+C, to paste in the terminal (at least for Ubuntu) you need to do Shift+Ctrl+V in order to paste. Anything that is in italics is an installation related note, and anything that is in an indented bullet is a comment.

Environment Setup

Download and install VirtualBox 4.1.18-78361 from virtualbox.org

Create a new Virtual Machine and set Virtual Machine to 2GB RAM, 200GB HD.

  • Select the VDMK format if you think you may transfer this VM to VMWare down the road. Otherwise the VDI format works as well.

Download and install the Ubuntu 10.04.4 LTS x64 Desktop Operating System.

Infrastructure Installation

These instructions apply for both the SCOOP Gateway and SCOOP Hub machine installations. These prerequisite components must be installed before installing the specific components of SCOOP.

Oracle Java 6

Note: We want to have the Java JDK released by Oracle, not the OpenJDK version.

cd ~

wget https://github.com/flexiondotorg/oab-java6/raw/master/oab-java.sh -O oab-java6.sh

chmod +x oab-java6.sh

sudo ./oab-java6.sh

sudo apt-get update && sudo apt-get install sun-java6-jdk

Supporting Packages

Since the SCOOP components depend on Ruby, Rails, and MongoDB, we will need to make sure they are properly installed as well as their subcomponents. Specifically, the following lists the requirements needed for hQuery to run properly. Also note that should you wish to have multiple terminal windows to maintain the multiple running components of hQuery, it would not be a bad idea to consider using Screen for that purpose. You can install screen with the following command:

sudo apt-get install screen

SCOOP Dependencies

  • Ruby 1.9.2
  • Rails 3.1
  • MongoDB 1.8.1+

Ruby Install

The following instructions offer the least painful method of rapidly getting an installation of Ruby and Rails installed.

sudo apt-get install curl

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )

echo [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc

Update the Terminal environment

source ~/.bashrc

Then to check for Ruby requirements, the following command will let you know which packages are needed.

rvm requirements

The following command below is an example of the packages that may be need to be installed. Make sure you look through your own requirements and install those. the \ at the end of some lines are used to continue the single command.

sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g \
zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf \
libc6-dev ncurses-dev automake libtool bison subversion

We want Ruby version 1.9.2 so the following installs that version.

rvm install 1.9.2

rvm use 1.9.2

We also need a packager for Ruby to run some things.

gem install bundler

We also require some packages to support some of our SCOOP components.

gem install execjs

gem install therubyracer

Lastly, we require Rails to run some of the server instances.

gem install rails -v 3.2.6

MongoDB Install

The SCOOP components use MongoDB to store the data. In order to install this, we must let Ubuntu know of another repository by inserting a line into the sources.list file. You will need root rights for this.

sudo -i

echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" >> /etc/apt/sources.list

exit

Afterwards, you will need to let Ubuntu know of the repository's key.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10

Update Ubuntu's repository to also pick up the new repository data, and then install the latest version of MongoDB.

sudo apt-get update

sudo apt-get install mongodb-10gen

SCOOP Components

SCOOP Components will either reside on the Gateway Server (under the practitioner's control), or the Hub Server (under the researcher's control). For reference, the port numbers for all the components can be found here:

Component Port Numbers

  • Query Gateway | 3001
  • Mirth Rest Adapter | 3000
  • Query Composer | 3002

SCOOP Gateway Install

Mirth Install

Install Mirth Connect v2.2.1.5861. (As of 7/24/2012). This is available for download from http://www.mirthcorp.com/community/downloads
Select the Installer entry under the Linux table. Alternatively, you may do the following to download directly:

cd ~

wget http://downloads.mirthcorp.com/connect/2.2.1.5861.b1248/mirthconnect-2.2.1.5861.b1248-unix.tar.gz

Afterwards, extract Mirth Connect, go into the Mirth Connect directory, and start its service. It will bind to port 8080.

tar -xzvf mirthconnect-2.2.1.5861.b1248-unix.tar.gz

cd Mirth\ Connect

./mcservice start

Connect to http://localhost:8080 to start the Java Applet and begin configuration.

Configuration instructions for Mirth may be found by going to IT0 Configuration or to the respective Iteration Configuration you want to implement.

OSCAR MySQL Access Update

Since you are going to be accessing OSCAR's database directly, you need to let the database know to allow your SCOOP Gateway access. On the OSCAR Server, do the following:

Backup the MySQL configuration for safety

sudo cp /etc/mysql/my.cnf /etc/mysql/my.cnf.bak

Then open up the file:

sudo vi /etc/mysql/my.cnf

Comment out this line by adding a # before the following line:

bind-address = 127.0.0.1

Save and then restart the MySQL server

sudo /etc/init.d/mysql restart

Log into the MySQL database and do the following where "mirth" is the user, "host" is your server hostname or IP, and xxxx is the database password:

grant all privileges on *.* to mirth@host identified by "xxxx";

Make MySQL update the privileges:

flush privileges;

Query Gateway Install

First we need to get the source code for the gateway. We do this with the following:

cd ~

git clone -b feature-scoop-it1 git://github.com/scoophealth/query-gateway.git

Afterwards, you will want to go into the new directory, install, seed, and start the server.

cd query-gateway

bundle install

bundle exec rake db:seed

mkdir -p tmp/pids

The following commands starts the server. If you want, you may create a bash script that automates this for you.

bundle exec script/delayed_job start
bundle exec rails server -p 3001

Mirth Rest Adapter

First we need to get the source code for the rest adapter. We do this with the following:

cd ~

git clone git://github.com/scoophealth/mirth-rest-adapter.git

Afterwards, you will want to go into the new directory, install, configure, and start the server.

cd mirth-rest-adapter

We need to update a line in the configuration file "records_controller.rb". You can open it with this command:

vi ~/mirth-rest-adapter/app/controllers/records_controller.rb

Update this line to reflect this:

url = URI.parse('http://localhost:3001/records/create')

Save, and then install this component.

bundle install

We also need to update the Gemfile to add execjs and therubyracer.

vi Gemfile

Find this line: gem 'bundler', '1.2.0.pre.1' and add the following lines after it:

gem 'execjs'
gem 'therubyracer'

Then change the following line:

gem 'bundler', '1.2.0.pre.1'

to the following (this removes the version requirement):

gem 'bundler'

The following command starts the server. If you want, you may create a bash script that automates this for you.

bundle exec rails server -p 3000

SCOOP Hub Install

Query Composer (Hub) Install

Note: This section is untested - there may be connection issues with MongoDB since it's not installed on the Hub Server

Note: The query-composer doesn't run correctly with ruby 1.9.3. All the other components seem to work fine with ruby 1.9.3. The error with 1.9.3 relates to "cannot load such file -- date/delta".

First we need to get the source code for the gateway. We do this with the following:

cd ~

git clone git://github.com/hquery/query-composer.git

Afterwards, you will want to go into the new directory, install, and start the server.

cd query-composer

bundle install

mkdir -p tmp/pids

The following command starts the server. If you want, you may create a bash script that automates this for you.

bundle exec script/delayed_job start
bundle exec rails server -p 3002

You can access this server's page by going to http://localhost:3002. There you must create an account. Fill out the new user form and submit it. Afterwards, we need to activate the account as an admin. We do that with the following command:

bundle exec rake hquery:users:grant_admin USER_ID=<USERNAME>

Where is replaced by the username you used to sign up.

Mongod Usage

To see the databases in mongod use

show dbs

To select the query_gateway_development database use

use query_gateway_development

To see the collections/tables in the selected database use

show collections

To count the number of entries in the records collection of query_gateway_development do

db.records.count()

To remove all the entries in records use

db.records.remove()

To see all the entries in records in json format use

var c = db.records.find() ; while (c.hasNext()) printjson(c.next())

To see only the medication section of the entries in json format use

db.records.find() ; while (c.hasNext()) printjson(c.next()['medications'])

To remove all old queries from the query-gateway mongo database

db.queries.remove()

Current Iteration: 13

General Topics

Resources


Previous Iteration: 12

Previous Iteration: 11

Previous Iteration: 10

Previous Iteration: 9

Previous Iteration: 8

Previous Iteration: 7

Previous Iteration: 6

Previous Iteration: 5

Previous Iteration: 4

Previous Iteration: 3

Previous Iteration: 2

Previous Iteration: 1

Previous Iteration: 0

Clone this wiki locally