NIH | National Cancer Institute | NCI Wiki  

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Access to other Systems

Step-by-step installation guide

Instructions for installing LexEVS 6.x CTS2 Documentation API Service.

  • The name of the install directory will be /usr/local/cts2Docs
  • Create these additional directories
    • /usr/local/cts2Docs/logs
    • /usr/local/cts2Docs/bin

Install CTS2 API Documentation Project

  1. Clone git repository

    1. git clone https://github.com/cts2/lexevs-service-rest-docs.git
    2. This will create a project under /usr/local/cts2Docs/lexevs-service-rest-docs
     

Install Node.js

  1. Download Node.js (linux 64 bit) (v0.10.35) to /usr/local/cts2Docs
    1. File download location: nodejs.org/dist/v0.10.35/node-v0.10.35-linux-x64.tar.gz
  2. Unzip the file node-v0.10.35-linux-x64.tar.gz in /usr/local/cts2Docs
    1. tar -vxzf node-v0.10.35-linux-x64.tar.gz
  3. Create symbolic link /usr/local/cts2Docs/node -> /usr/local/cts2Docs/node-v0.10.35-linux-x64
  4. Add an environment variable for NPM
    1. export NPM_HOME=/usr/local/cts2Docs/node

    2. export PATH=${PATH}:$NPM_HOME/bin

  5. Update the port that node.js runs on (OPTIONAL step)
    1. Edit this file: /usr/local/cts2Docs/lexevs-service-rest-docs/config.json
    2. The "port" parameter is set to 3000 by default.  It can be changed as needed.  This port used by the end URL to get to the CTS2 API Documentation: (http://<server_name>:port)

Create nodejs start/stop script

  • Created the nodejs start/stop script /usr/local/cts2Docs/bin/nodejs_init_script with the following properties

    Code Block
    languagebash
    titlenodejs_init_script
    linenumberstrue
    LEXEVSDOCS_HOME=/usr/local/cts2Docs/lexevs-service-rest-docs
    LOGDIR=/usr/local/cts2Docs/logs
    LOGFILE=${LOGDIR}/nodejs.log
    PIDFILE=${LEXEVSDOCS_HOME}/nodejs.pid


Install Redis

  1. Download Redis version 2.8.19 to /usr/local/cts2Docs
    1. File download location: https://github.com/antirez/redis/archive/2.8.19.tar.gz
  2. Unzip the file redis-2.8.19.tar.gz in /usr/local/cts2Docs
    1. tar -vxzf redis-2.8.19.tar.gz
  3. Build redis
    1. cd /usr/local/cts2Docs/redis-2.8.19
    2. make
  4. Create symbolic link /usr/local/cts2Docs/redis -> /usr/local/cts2Docs/redis-2.8.19
  5. Create a copy of  redis.conf called  cts2_redis.conf

    1. Make the following changes in the cts2_redis.conf file

      Code Block
      languagebash
      titlects2_redis.conf
      linenumberstrue
      daemonize yes
      pidfile /usr/local/cts2Docs/redis/redis_6379.pid
      logfile "/usr/local/cts2Docs/logs/redis.log"
  6. Copy the file /usr/local/cts2Docs/redis/utils/redis_init_script to /usr/local/cts2Docs/bin and make the following modifications

    Code Block
    languagebash
    titleredis_init_script
    linenumberstrue
    #!/bin/sh
    #
    # start/stop cts2doc-redis
    # chkconfig: 345 94 90
    # description: Redis server
    #
    ## Instructions ##
    ## This is a template only.
    ## Rename appropriately and copy this file into /etc/init.d
    ## chkconfig --add FILENAME
    ##########
    #
    # Simple Redis init.d script conceived to work on Linux systems
    # as it does use of the /proc filesystem.
    DATE=`date +%Y%m%d-%H%M%S`
    REDISPORT=6379
    REDISDIR=/usr/local/cts2Docs/redis
    EXEC=${REDISDIR}/src/redis-server
    CLIEXEC=${REDISDIR}/src/redis-cli
    LOGDIR=/usr/local/cts2Docs/logs/
    #EXEC=/usr/local/bin/redis-server
    #CLIEXEC=/usr/local/bin/redis-cli
    PIDFILE=${REDISDIR}/redis_${REDISPORT}.pid
    CONF="${REDISDIR}/cts2_redis.conf"
    #PIDFILE=/var/run/redis_${REDISPORT}.pid
    #CONF="/etc/redis/${REDISPORT}.conf"
    REDIS_USER=cts2
    case "$1" in
        start)
            if [ -f $PIDFILE ]
            then
                    echo "$PIDFILE exists, process is already running or crashed"
            else
                    if [ -f ${LOGDIR}/redis.log ]; then
                             echo "Renaming redis.log"
                             cd ${LOGDIR}/
                              mv redis.log redis.log-$DATE
                    fi
                    echo "Starting Redis server..."
                    su - ${REDIS_USER} -c "$EXEC $CONF"
            fi
            ;;
        stop)
            if [ ! -f $PIDFILE ]
            then
                    echo "$PIDFILE does not exist, process is not running"
            else
                    PID=$(cat $PIDFILE)
                    echo "Stopping ..."
                    su - ${REDIS_USER} -c "$CLIEXEC -p $REDISPORT shutdown"
                    while [ -x /proc/${PID} ]
                    do
                        echo "Waiting for Redis to shutdown ..."
                        sleep 1
                    done
                    echo "Redis stopped"
            fi
            ;;
        *)
            echo "Usage: $0 { start | stop }"
            ;;
    esac

Install Directory File Structure

At this point the install directory should have the following structure:

  •  cts2Docs
    • lexevs-service-rest-docs
    • bin
    • logs
    • node-v0.10.35-linux-x64
    • node (symbolic link)
    • redis-2.8.19
    • redis (symbolic link)

Change Directory permissions

For security purposes, restrict access to the following directories/files:

  • chmod 700 /usr/local/cts2Docs/lexevs-service-rest-docs
  • chmod 700 /usr/local/cts2Docs/lexevs-service-rest-docs/app.js
  • chmod 700 /usr/local/cts2Docs/lexevs-service-rest-docs/views
  • chmod 700 /usr/local/cts2Docs/lexevs-service-rest-docs/node_modules
  • chmod 700 /usr/local/cts2Docs/lexevs-service-rest-docs/public
  • chmod 700 /usr/local/cts2Docs/lexevs-service-rest-docs/public/*
  • chmod 600 /usr/local/cts2Docs/lexevs-service-rest-docs/public/javascrips/*.js
  • chmod 754 /usr/local/cts2Docs/redis-2.8.19

Create a Linux account for user cts2

  • Create Linux account cts2 and added the following to .bash_profile

    Code Block
    languagebash
    title.bash_profile
    linenumberstrue
    export NPM_HOME=/usr/local/cts2Docs/node
    PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$NPM_HOME/bin:$HOME/bin:$PATH

Steps to start/stop/deploy the services

DEV Server: ncias-d1224
User account: cts2
Deploy Directory: /usr/local/cts2Docs
CTS2 Home: /local/home/cts2
Service Ports: 3000, 6379
Application URL: http://ncias-d1224:3000/  (DEV server)

...

  1. SSH into the DEV server ncias- d1224 with your NIH credentials
  2. Become the cts2 developer account: "su – cts2"
  3. The password will be sent in a separate email to those listed in the PTE.
  4. To start redis service run /usr/local/cts2Docs/bin/redis_init_script start " as the cts2 user account
  5. To stop redis service run /usr/local/cts2Docs/bin/redis_init_script stop " as the cts2 user account
  6. To stop node.js service run /usr/local/cts2Docs/bin/nodejs_init_script start " as the cts2 user account
  7. To stop node.js service run /usr/local/cts2Docs/bin/nodejs_init_script stop " as the cts2 user account

Accessing the CTS2 Documentation API Service

Once redis and node.js have been successfully started, the CTS2 Documentation API service can be reached at the following URL:

...