NIH | National Cancer Institute | NCI Wiki  

Error rendering macro 'rw-search'

null

Versions Compared

Key

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

...

  • The name of the install directory will be  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
     

...

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. Created 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

...

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

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

Start the Services

...

  • usr/local/cts2Docs/redis-2.8.19

...

...

  1. cd <path to install dir>/cts2Docs/lexevs-service-rest-docs
  2. nohup npm start &
  3. node.js is set to run on port 3000 by default.

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

...

http://<server_name>:port

http://ncias-d1224:3000/