Page History
Access to other Systems
- This server needs to be able to access the CTS2 service located here: http://lexevscts2.nci.nih.gov/lexevscts2
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
Clone git repository
- git clone https://github.com/cts2/lexevs-service-rest-docs.git
- This will create a project under /usr/local/cts2Docs/lexevs-service-rest-docs
Install Node.js
- Download Node.js (linux 64 bit) (v0.10.35) to /usr/local/cts2Docs
- File download location: nodejs.org/dist/v0.10.35/node-v0.10.35-linux-x64.tar.gz
- Unzip the file node-v0.10.35-linux-x64.tar.gz in /usr/local/cts2Docs
- tar -vxzf node-v0.10.35-linux-x64.tar.gz
- Create symbolic link /usr/local/cts2Docs/node -> /usr/local/cts2Docs/node-v0.10.35-linux-x64
- Add an environment variable for NPM
export NPM_HOME=/usr/local/cts2Docs/node
export PATH=${PATH}:$NPM_HOME/bin
- Update the port that node.js runs on (OPTIONAL step)
- Edit this file: /usr/local/cts2Docs/lexevs-service-rest-docs/config.json
- 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 language bash title nodejs_init_script linenumbers true 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
- Download Redis version 2.8.19 to /usr/local/cts2Docs
- File download location: https://github.com/antirez/redis/archive/2.8.19.tar.gz
- Unzip the file redis-2.8.19.tar.gz in /usr/local/cts2Docs
- tar -vxzf redis-2.8.19.tar.gz
- Build redis
- cd /usr/local/cts2Docs/redis-2.8.19
- make
- Create symbolic link /usr/local/cts2Docs/redis -> /usr/local/cts2Docs/redis-2.8.19
Create a copy of redis.conf called cts2_redis.conf
Make the following changes in the cts2_redis.conf file
Code Block language bash title cts2_redis.conf linenumbers true daemonize yes pidfile /usr/local/cts2Docs/redis/redis_6379.pid logfile "/usr/local/cts2Docs/logs/redis.log"
Copy the file /usr/local/cts2Docs/redis/utils/redis_init_script to /usr/local/cts2Docs/bin and make the following modifications
Code Block language bash title redis_init_script linenumbers true #!/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 language bash title .bash_profile linenumbers true 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)
...
- SSH into the DEV server ncias- d1224 with your NIH credentials
- Become the cts2 developer account: "su – cts2"
- The password will be sent in a separate email to those listed in the PTE.
- To start redis service run /usr/local/cts2Docs/bin/redis_init_script start " as the cts2 user account
- To stop redis service run /usr/local/cts2Docs/bin/redis_init_script stop " as the cts2 user account
- To stop node.js service run /usr/local/cts2Docs/bin/nodejs_init_script start " as the cts2 user account
- 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:
...