Overview
Documents setting up code, config, and data in a development environment using Eclipse.
Prerequisites
- Git client
- Java 7 installed
- Mysql 5.5 or 5.6 installed
- Maven 3.2.+ installed
- Tomcat 7 installed and configured
Details
Step 1
Clone the Github repository to a local directory (e.g. c:/workspace/SNOMED-Terminology-Server)
Step 2
Build all modules with "mvn clean install" at the top level - either through Eclipse or via the command line.
Step 3
Stock setup for Windows
- Create a directory to hold your admin, configuration and data files (e.g. c:/data)
- Copy the term-server-config/src/main/resources/data/snomedct-20140131-mini folder to your data directory (e.g. c:/data).
- Copy the term-server-config/src/main/resources/data/icd9cm-2013.xml file into your data directory (e.g. c:/data)
- Unpack the config/windows-dev/target/term-server-config-windows-dev.*.zip file into your data directory (e.g. c:/data)
Stock setup for Unix/Linux/Mac
- Create a directory to hold your admin, configuration and data files (e.g. ~/data)
- Copy the term-server-config/src/main/resources/data/snomedct-20140131-mini folder to your data directory (e.g. ~/data).
- Copy the term-server-config/src/main/resources/data/icd9cm-2013.xml file into your data directory (e.g. ~/data)
- Unpack the config/prod/target/term-server-config-prod.*.zip file into a directory (e.g. ~/)
Step 4
Edit the configuration file (now in config.properties in your data directory) to set correctly for your environment. In particular, edit these:
- javax.persistence.jdbc.url
- javax.persistence.jdbc.user
- javax.persistence.jdbc.password
- hibernate.search.default.indexBase (recommend choosing something below your data dir, e.g. c:/data/indexes)
- ihtsdo.security.activated (set to false for dev environment)
Step 5
Set up environment:
- Make sure the "mvn" executable for your local maven installation is in the path
- On Windows this means adding to the PATH variable so that it runs in a "cmd" shell without fully qualified path.
Step 6
Create a MySQL UTF8 database. e.g.
- CREATE database tsdb CHARACTER SET utf8 default collate utf8_unicode_ci;
Step 7
Run the corresponding load script for your environment;.
- Step 3 creates a bin directory in the chosen data directory. There is a "load" script that can be used with the setup at this point to create a default development instance of the application
- For Windows: run load.bat (e.g. c:/data/bin/load.bat)
- For Unix/Linux/Mac: run load.csh (e.g. ~/bin/load.bat)
- NOTE: if re-running this, you first have to run the sql in "truncate_all.sql" to clear your database of tables (Recommend using MySQL Workbench for this in the dev environment).
Step 8
Deploy the term-server-rest.war file to a Tomcat server - either through Eclipse or a standalone tomcat installation.
Setting up Tomcat in Eclipse is very easy, you follow these steps.
- Download and install apache tomcat 7 in c:/apache-tomcat-XXXX
- In Eclipse use the J2EE perspective and click on the "Servers" tab.
- From here, you can add a server which simply involves pointing Eclipse to the install directory for Tomcat.
- You can right-click on term-server-rest.war file and use "Run As->Run on Server" to deploy to Tomcat.
- NOTE: sometimes in Eclipse this doesn't work and the tomcat does not properly recognize or deploy the app.
- In this event, double-click on the tomcat server installation in the servers tab.
- In the configuration screen click "Open launch configuration"
There, look on the Arguments tab and find the -D setting for "catalina.base", e.g.
-Dcatalina.base="C:\Users\Brian Carlsen\workspace-luna\.metadata\.plugins\org.eclipse.wst.server.core\tmp0"
- If you open this directory you'll see a "webapps" folder. To deploy you simply build and copy term-server-rest.war to that directory and launch the server in Eclipse.
The Tomcat server needs to be able to find the run configuration. Double-click on the Tomcat server you installed, open the launch configuration and add this setting:
-Drun.config=/path/to/your/config.properties
Step 9
Check that it all works by going to
http://localhost:8080/term-server-rest/index.html
This should be a "swagger" Api documenting the current state of the API. You should be able to test services by using "guest" as the authToken parameter.
References/Links