Deploy Instructions
Overview
Describes how to set up and deploy the mapping tool to the IHTSDO mapping.ihtsdotools.org server.
Diagram
Details
Log into the server mapping.ihtsdotools.org
Ensure there is an "ihtsdo" user - everything will run as this user
Install and configure software as root (nginx, tomcat7, libapache2_mod_jk, mysql-server-5.5, maven, git, etc)
You'll need the root user password
Set up your maven settings.xml according to Settings.xml Page.
Edit the /etc/init.d/tomcat7 script to comment out the top part that forces running as root
#if [ `id -u` -ne 0 ]; then # echo "You need root privileges to run this script" # exit 1 #fiEdit the /etc/init.d/tomcat7 script to use this:
CATALINA_PID="/var/lib/tomcat7/$NAME.pid"Set permissions of the tomcat installation to the "ihtsdo" user:
** This must be done while tomcat is NOT running. chown -R ihtsdo /var/log/tomcat7 chgrp -R ihtsdo /var/log/tomcat7 chown -R ihtsdo /var/cache/tomcat7 chgrp -R ihtsdo /var/cache/tomcat7 chown -R ihtsdo /var/lib/tomcat7 chgrp -R ihtsdo /var/lib/tomcat7 Edit /etc/init.d/tomcat7 to use the following * TOMCAT7_USER=ihtsdo * TOMCAT7_GROUP=ihtsdo Edit /etc/default/tomcat7 * TOMCAT7_USER=ihtsdo * TOMCAT7_GROUP=ihtsdoSee ~root/README.txt [file not present]
Tomcat must be configured to pass "run.config" environment variable to the application
One way to do this is to invoke the java command with -Drun.config=/opt/mapping-service/conf/config/config.properties
(e.g. edit this in /etc/init.d/tomcat7 and add to JAVA_OPTS)Also add -Xmx2500M to JAVA_OPTS in the tomcat startup script.
NOTE: development environments must also be configured as such
Tomcat must be configured to support POST requests of size > 2MB
Edit /var/lib/tomcat7/conf/server.xml and add maxPostSize="50000000" to each <Connector> element.
Tomcat must be configured to support following of links. Make sure any Context tags in the configuration contain allowLinking="true".
Edit /var/lib/tomcat7/conf/context.xml to add this parameter to the Context tag.
Make sure you have MAVEN_OPTS set
e.g. -XX:MaxPermSize=512m -Xmx3072m
Nginx Configuration
Install the SSL keys as root in the appropriate places
Edit /etc/nginx/sites-available/mapping.ihtsdotools.org (see the webapp/src/main/nginx directory for configurations).
Link /etc/nginx/sites-enabled/mapping.ihtsdotools.org to the file above
Add a Valve to tomcat to handle proxy headers.
Edit
/etc/nginx/nginx.conf, edit or add "client_max_body_size 50M;" to the "http" context.
MySQL Configuration
When configuring the database URL in config.properties, use ?autoconnect=true to avoid connection issues
Also (as root) edit the my.cnf file for your platform and add this to the mysqld section:
[mysqld] ... wait_timeout = 1048576 interactive_timeout = 1048576It may also be worth considering using the innodb table per file option
[mysqld] ... innodb_file_per_tableThis is useful to better manage the overall size of the database because individual tables can then be optimized rather than having to dump/reload the entire database.
Consider other optimizations to mysql parameters (e.g. http://www.percona.com/blog/2014/01/28/10-mysql-settings-to-tune-after-installation/)
Restart MySQL for the changes to take effect.
/etc/init.d/mysql restart
As the MySQL root user, create an OTF user with the mysql client:
CREATE USER 'otf'@'localhost' IDENTIFIED BY 'otfpwd'; GRANT ALL privileges ON *.* TO 'otf'@'localhost';As the MySQL root user, create a database in the mysql client:
CREATE DATABASE mappingservicedb DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin; GRANT ALL ON mappingservicedb.* TO 'otf';Create "code", "config", and "data" directories
~/code - for the code
~/data - for the data files (only needed on initial load)
/opt/mapping-service/config - for the configuration files and configurable admin scripts:
cd mkdir code mkdir data mkdir config [may already exist in /opt/mapping-service/]
Get code:
cd ~/code git clone https://github.com/IHTSDO/OTF-Mapping-Service.git . # switch to dev branch - for UAT git checkout develop # switch to dev branch - for PROD git checkout masterPrepare the environment (set your shell up with these ENV variables):
JAVA_HOME=/path/to/java MAVEN_OPTS=-Xmx3000MBuild all of the code, making sure to choose the correct "config.artifactId" for your environment. Shown is "prod" configuration:
cd ~/code mvn -Dconfig.artifactId=mapping-config-prod clean installIf have a new project go to 16 to get the data, otherwise jump to 17.
Get data:
cd ~/data git clone https://git.ihtsdotools.org/ihtsdo/ihtsdo-mapping-tool-data.git data # set up doc directories, for uploading mapping handbook files mkdir data/doc mkdir data/doc/archive chmod -R ga+rwx data/docPrepare indexes to be maintainable by ihtsdo user:
# To clean up the indexes do this (as root) /bin/rm -rf /var/lib/tomcat7/indexes mkdir /var/lib/tomcat7/indexes mkdir /var/lib/tomcat7/indexes/lucene mkdir /var/lib/tomcat7/indexes/lucene/indexes chmod -R ga+rwx /var/lib/tomcat7/indexes chown -R ihtsdo:ihtsdo /var/lib/tomcat7/indexesUnpack the config artifact corresponding to your environment The example shown below is for "prod":
cd ~/config unzip ~/code/config/prod/target/mapping-config-prod.*.zipEdit the configuration file and scripts.
Edit config.properties and replace the "EDIT_THIS" entries with real values (mostly passwords, etc).
Edit the mail notification settings to list email addresses of those admins or maintenance staff that should be notified of errors and/or automation outcomes.
Edit the scripts in bin/ as needed for this environment (default setup requires no changes).
Edit the load script for your environment. Run it to load the data:
cd ~/config/bin ./load.csh >&! load.logDeploy war files:
/bin/cp -f ~/code/rest/target/mapping-rest*war /var/lib/tomcat7/webapps/mapping-rest.warStart service and link "doc" directory:
service tomcat7 start # wait for deploy to create the ROOT directory sleep 10 # link doc directory cd /var/lib/tomcat7/webapps/mapping-rest ln -s ~/data/docSetup cron jobs for nightly/weekly automations. For example,
# * * * * * command to execute # ? ? ? ? ? # ? ? ? ? ? # ? ? ? ? ?????? day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0) # ? ? ? ??????????? month (1 - 12) # ? ? ???????????????? day of month (1 - 31) # ? ????????????????????? hour (0 - 23) # ?????????????????????????? min (0 - 59) 0 23 * * 4 csh /home/ihtsdo/config/bin/loadDelta.csh > /home/ihtsdo/logs/loadDelta.log 2>&1 0 0 * * 0,1,2,4,5,6 csh /home/ihtsdo/config/bin/qaCron.csh > /home/ihtsdo/logs/qaCron.log 2>&1 0 0 * * 0,1,2,4,5,6 csh /home/ihtsdo/config/bin/dailyReports.csh > /home/ihtsdo/logs/dailyReports.log 2>&1
References/Links
n/a
Copyright © 2025, SNOMED International