Smntx Deployment
Smntx has been deployed on a commercial Cloud (Amazon Elastic Compute Cloud), a private HIPAA compliant Cloud (iBI UC Cloud) and also in various local deployments. If required we can give access to a fully contained EC2 or vagrant/virtualbox image.
The following guide outlines a full Smntx deployment on Ubuntu 10.
Overview
The deployment of Smntx relies on various components. The components and the versions we have tested are:- Java 1.6
- MetaMap (2009 v2)
- MetaMap Java API (2009 v2)
- Derby (10.6)
- Solr (>=4)
- Jetty (6/7)
Prerequisites
Ensure you have a Java environment setup.
Ensure you have downloaded and extraced the Smntx web application and required files, in this guide the location is called <SMNTX-FILES>. A zip file containing all the required files is available here.
MetaMap
MetaMap can be downloaded from http://metamap.nlm.nih.gov. To run MetaMap in Smntx both MetaMap and the MetaMap java API are required. Instructions on installation are provided on the MetaMap web site, however, they are also repeated here to complete this guide.
- Unzip MetaMap to a suitable location (<MM_INSTALL_DIR>).
bunzip2 -c public_mm_linux_2009v2.tar.bz2 | tar xvf -
- Setup environment variables pointing to this installation.
export METAMAP_HOME=~/<MM_INSTALL_DIR>
export PATH=$PATH:$METAMAP_HOME/bin - Install MetaMap
$METAMAP_HOME/bin/install.sh
- Unzip MetaMap Java API to the same directopry
bunzip2 -dc public_mm_linux_javaapi_2009v2.tar.bz2 | tar xvf -
- Install MetaMap Java API
./bin/install.sh
- Note: to run MetaMap on a 64 bit instance you will need to
install 32 bit libs:
sudo apt-get install ia32-libs
- Note 2: If you are running MetaMap on a remote host you need
to update the accepted_hosts variable to allow connections from a
remote host.
vi $METAMAP_HOME/bin/mmserver09
- Note: to run MetaMap on a 64 bit instance you will need to
install 32 bit libs:
The resulting MetaMap installation can be tested by
- Start MetaMap
$METAMAP_HOME/bin/skrmedpostctl start
$METAMAP_HOME/bin/wsdserverctl start
$METAMAP_HOME/bin/mmserver09 - Test local invocation (without Java API)
echo "lung cancer" | $METAMAP_HOME/bin/metamap09v2 -I
- Test Java API
./$METAMAP_HOME/bin/testapi.sh laboratory culture
Derby
- Download, Unzip and install derby (alternatively you can use
the pacakge manager and javadb)
curl http://archive.apache.org/dist/db/derby/db-derby-10.6.2.1/db-derby-10.6.2.1-bin.tar.gz \--o db-derby-10.6.2.1-bin.tar.gz
tar -xvf db-derby-10.6.2.1-bin.tar.gz - Setup environment variables
export PATH=$PATH:~/derby/bin/
export PATH=$PATH:~/derby/lib/
export DERBY_HOME=~/derby - Start the derby network server. (if this is called remotely
remember to update the hosts file)
sudo java -jar $DERBY_HOME/lib/derbyrun.jar server start
- Setup the Smntx database using the Smntx schema (database.sql)
ij CONNECT
'jdbc:derby://localhost:1527/ctsadb;create=true';
run '<SMNTX-FILES>/database.sql';
Solr
- Download Solr 4.0
curl http://www.ci.uchicago.edu/~kyle/apache-solr-4.0-2010-12-17_08-05-54.tgz --O apache-solr-4.0-2010-12-17_08-05-54.tgz
- Unzip and install solr (ensure you have at least version 4)
tar -xzf apache-solr-4.0-2010-12-17_08-05-54.tgz
- Copy Smntx index schema files
cp <SMNTX_FILES>/solrconfig.xml <PATH-TO-SOLR>/example/solr/conf
cp <SMNTX_FILES>/schema.xml <PATH-TO-SOLR>/example/solr/conf - Setup environment variables
export PATH=$PATH:<PATH-TO-SOLR>/example/lib/
- Start Solr
cd <PATH-TO-SOLR>/example
sudo java -jar start.jar
Jetty
- Install Jetty (either locally or via the package manager)
sudo apt-get install jetty
- Copy lib files to the jetty lib directory
(/usr/share/jetty/lib/)
- Solr and Solrj (from the solr/dist and solr/dist/solrj-lib/
directorys
- apache-solr-core-4.0-2010-12-17_08-05-54.jar
- apache-solr-solrj-4.0-2010-12-17_08-05-54.jar
- commons-codec-1.4.jar
- commons-httpclient-3.1.jar
- commons-io-1.4.jar
- slf4j-api-1.5.5.jar
- Logging jars (included in
if you do not have them) - commons-logging-1.1.1.jar
- commons-logging-api-1.1.jar
- slf4j-simple-1.5.5.jar
- MetaMap jars (from the $METAMAP_HOME/src/javaapi/dist
directory)
- prologbeans.jar
- MetaMapApi.jar
- Solr and Solrj (from the solr/dist and solr/dist/solrj-lib/
directorys
- Deploy the Smntx web application
sudo cp <SMNTX_FILES>/MetaMap.war /usr/share/jetty/webapps/
- You will need to configure the properties of the war to point
to the correct Solr, MetaMap and file storage directory. This can be
done by unzipping the war file and changing the properties
file(WEB-INF/classes/applicationContext.xml)
vi WEB-INF/classes/applicationContext.xml
<bean name="userBean">
<property name="userBaseDirectory">
<value>/home/ctsa/MetaMap/Temp/<value>
</property>
</bean>
<bean id="metaMapQueue">
<constructor-arg type="java.lang.String" value="localhost"/>
<constructor-arg type="int" value="8066"/>
</bean>
<bean name="solrBean">
<property name="solrURI">
<value>http://localhost:8983/solr/</value>
</property>
</bean> - If derby is not running on the default 1527 port you will also need to update the openJPA properties file (/WEB-INF/classes/META-INF/persistence.xml)
- Start/Restart Jetty
sudo java -jar /usr/share/jettystart.jarOrsudo /etc/init.d/jetty restart sudo /etc/init.d/jetty stop sudo /etc/init.d/jetty start
- Note: If you want to access the demo from a remote host when
using deamon jetty you will need to update the jetty configuration
settings so that JETTY_HOST (accepted hosts) is 0.0.0.0
sudo vi /etc/default/jetty
Running Smntx
Ensure each of the major components is started (I use screen to run multiple shells). - MetaMap
$METAMAP_HOME/bin/skrmedpostctl start $METAMAP_HOME/bin/wsdserverctl start $METAMAP_HOME/bin/mmserver09
- Derby
sudo java -jar $DERBY_HOME/lib/derbyrun.jar server start
- Solr
cd <PATH-TO-SOLR</example sudo java -jar start.jar
- Jetty
sudo /etc/init.d/jetty start
Test the REST API using curl
Finally test the web interface by pointing your browser at