You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Overview

Describes how to set up and deploy the mapping tool to the IHTSDO mapping.ihtsdotools.org server.

Diagram

 

Details

  1. Log into the server 162.243.215.76 (mapping.ihtsdotools.org)
    1. You'll need the ihtsdo user password.

  2. Install and configure software as root (nginx, tomcat7, libapache2_mod_jk, mysql-server-5.5, maven, git, svn, etc)
    1. You'll need the root user password
    2. Edit the /etc/init.d script to comment out the top part that forces running as root

    3. Edit the /etc/init.d script to use this:

      CATALINA_PID="/var/lib/tomcat7/$NAME.pid"
    4. Set permissions of the tomcat installation to the "ihtsdo" user

       
      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=ihtsdo
      ** This must be done while tomcat is NOT running.
    5. See ~root/README.txt

  3. Tomcat must be configured to pass "run.config" environment variable to the application
    1. One way to do this is to invoke the java command with -Drun.config=/home/ihtsdo/data/config.properties
      (e.g. edit this in /etc/init.d/tomcat7 and add to JAVA_OPTS)
    2. Also add -Xmx2500M to JAVA_OPTS in the tomcat startup script.
    3. NOTE: development environments must also be configured as such

  4. Tomcat must be configured to support POST requests of size > 2MB
    1. Edit server.xml and add  maxPostSize="50000000" to each <Connector> element.

  5. Tomcat must be configured to support following of links.  Make sure any Context tags in the configuration contain  allowLinking="true".
    1. Edit context.xml to add this parameter to the Context tag.

  6. Make sure you have MAVEN_OPTS set 
    1. e.g. -XX:MaxPermSize=512m -Xmx3072m
  7. Nginx Configuration
    1. Install the SSL keys as root in the appropriate places
    2. Edit /etc/nginx/sites-available/mapping.ihtsdotools.org (see the webapp/src/main/nginx directory for configurations).
    3. Link /etc/nginx/sites-enabled/mapping.ihtsdotools.org to the file above
    4. Add a Valve to tomcat to handle proxy headers.
    5. Edit /etc/nginx/nginx.conf and add "client_max_body_size 50M;" to the "http" context.
    6. See the attachment for more details

  8. MySQL Configuration

    1. When configuring the database URL in config.properties, use ?autoconnect=true to avoid connection issues

    2. Also (as root) edit the my.cnf file for your platform and add this to the mysqld section.

      [mysqld]
      ...
      wait_timeout = 230400
      interactive_timeout = 230400
  9. 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';
  10. As the MySQL root user, create a database in the mysql client

    CREATE DATABASE mappingservicedb
      DEFAULT CHARACTER SET utf8
      DEFAULT COLLATE utf8_general_ci;
    CREATE DATABASE mappingservicedbtest
      DEFAULT CHARACTER SET utf8
      DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON mappingservicedb.* TO 'otf';
    GRANT ALL ON mappingservicedbtest.* TO 'otf';
  11. Get code

    cd
    mkdir code
    cd code
    git clone https://github.com/WestCoastInformatics/OTF-Mapping-Service.git .
    
    # switch to dev branch - for UAT
    git checkout develop
    
    # switch to dev branch - for PROD
    git checkout master
    
    mvn -DskipTests=true -Dbuild.config=~/config/config.properties clean install
  12. Get data.

    # Use your collabnet username below
    set username = <your collabnet username>
    cd
    mkdir data
    git clone ssh://$username@csfe.aceworkspace.net:29418/mapping data
    # set up doc directories, for uploading mapping handbook files
    mkdir data/doc
    mkdir data/doc/archive
    chmod -R ga+rwx data/doc  
  13. Prepare 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 /var/lib/tomcat7/indexes
    chgrp -R ihtsdo /var/lib/tomcat7/indexes
    



  14. Create a config.properties file by starting with one of those in the config project.  Edit the file as needed

    cp ~/code/config/src/main/resources/config.properties.prod ~/config/config.properties
    
    # Ensure the config.properties file used to run the application has this setting
    hibernate.search.default.indexBase=/var/lib/tomcat7/indexes/lucene/indexes 
  15. Create database and load the data

    cd ~/code/admin/loader/scripts
    load_prod.csh >&! load_prod.log
  16. Stop tomcat, clear cache,and remove the currently deployed .war files (and associated folders).

    # Stop the tomcat7 server
    service tomcat7 stop
    /bin/rm -rf /var/lib/tomcat7/work/Catalina/localhost/mapping-rest
    /bin/rm -rf /var/lib/tomcat7/webapps/mapping-rest
    /bin/rm -rf /var/lib/tomcat7/webapps/ROOT
    /bin/rm -rf /var/lib/tomcat7/webapps/mapping-rest.war
    /bin/rm -rf /var/lib/tomcat7/webapps/ROOT.war
  17. Update the database (this needs to go into the reload page):

    mvn clean install -Drun.config=/home/ihtsdo/config/config.properties -Dhibernate.hbm2ddl.auto=update
    
  18. Update file modification date to prevent caching issues.

    cd ~/code
    set date = `date +%Y%m%d%H%M`
    touch -t $date `find . -name "*"`
  19. Build Rest and deploy war

    /bin/cp -f ~/code/rest/target/mapping-rest*war /var/lib/tomcat7/webapps/mapping-rest.war
  20. Deploy Webapp war

    /bin/cp -f ~/code/webapp/target/mapping-webapp*war /var/lib/tomcat7/webapps/ROOT.war
  21. Start 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/ROOT
    ln -s /home/ihtsdo/data/doc
  22. NOW, if deploying to PROD, create a github pull request.

     

  • n/a
  • No labels