TMG EWD / Node.js configuration

From VistApedia
Revision as of 00:53, 20 March 2014 by Kdtop (talk | contribs) (Created page with "Below will be a description of the EWD setup used at the TMG Site (Kevin Toppenberg's office) [https://groups.google.com/forum/#!topic/ewd-and-vista/nSua-leSCV0 Here] are som...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Below will be a description of the EWD setup used at the TMG Site (Kevin Toppenberg's office)

Here are some notes made during installation and in this thread:


Below is the resulting directory structure (to depth level of 5):

/opt/ewdlite/ 
├── ewdStart-globals-http.js
├── ewdStart-globals-https.js
├── ewdStart-globals.js -> ewdStart-globals-http.js
├── ewdStart-globals.js~
├── node_modules
│   ├── ewdgateway2
│   │   ├── ewd-classic
│   │   │   ├── ewdapps
│   │   │   │   └── ewdGateway2
│   │   │   └── startupExamples
│   │   ├── ewdLite
│   │   │   ├── mongoDB
│   │   │   │   └── node-0.10
│   │   │   ├── node_modules
│   │   │   ├── OSEHRA
│   │   │   ├── ssl
│   │   │   ├── startupExamples
│   │   │   └── www
│   │   │       ├── ewd
│   │   │       ├── ewdLite
│   │   │       └── respond
│   │   ├── examples
│   │   ├── lib
│   │   └── node_modules
│   │       └── socket.io
│   │           ├── benchmarks
│   │           ├── lib
│   │           └── node_modules
│   ├── ewdliteclient
│   │   └── lib
│   └── nodem
│       ├── examples
│       ├── lib
│       ├── resources
│       └── src
├── ssl
├── test.js
└── www
    ├── ewd
    │   ├── bootstrap3
    │   ├── ewdEncrypter
    │   ├── ewdGDSync
    │   ├── ewdMonitor
    │   ├── VistADemo
    │   └── webSvcMgr
    ├── ewdLite
    └── respond

And below is /opt/ewdlite/ewdStart-globals-http.js (And for FYI, that port 8080 is not exposed to the internet.)

var ewd = require('ewdgateway2'); 

var params = {
  lite: true,
  poolSize: 2,
  httpPort: 8080,
  https: {
    enabled: false
  },
  database: {
    type: 'gtm',
    nodePath: "/opt/ewdlite/node_modules/nodem/lib/mumps.node",
  },
  lite: true,
  modulePath: '/opt/ewdlite/node_modules',
  traceLevel: 3,
  webServerRootPath: '/opt/ewdlite/www',
  logFile: 'ewdLog.txt',
  management: {
    password: 'xxxxxxxx'   #<redacted>
 }
};
 
ewd.start(params);

Below is /etc/init/ewdlite.conf This causes EWD to automatically come up with each server reboot. Notice the modifications made, marked by #//kt. Notice that setup_env is sourced into this script.

description "ewdlite server" 
author      "Mike Clayton on behalf of http://mgateway.com"

start on started mountall
stop on shutdown

# Automatically Respawn:
respawn
respawn limit 10 5

script
    # Not sure why $HOME is needed, but we found that it is:
    export HOME="/opt/ewdlite"

    #//kt --- start mod ----
    . /opt/worldvista/EHR/bin/setup_env
    echo "Starting ewdlist server at" $(date) >> /tmp/ewdlite_service.log
    echo "gtm_dist: " $gtm_dist >> /tmp/ewdlite_service.log
    #//kt --- end mod ---

    exec /usr/local/bin/node /opt/ewdlite/ewdStart-globals.js >> /var/log/ewdlite.log 2>&1
end script

post-start script
   # Optionally put a script here that will notifiy you node has (re)started
end script

Below is /opt/worldvista/EHR/bin/setup_env used to established environmental variables. The parts we had to add to this startup script, when setting up EWD, are the lines for exporting node_home, and GTMCI, and we modified the line exporting gtmroutines to include the source files for Node.

#!/bin/sh
##
echo "Starting Setup_env script"

export GTM_REPLICATION=off

export vista_home="/opt/worldvista/EHR"

$vista_home/bin/env

echo "vista_home="$vista_home
export VH=${vista_home} # a short name for paths, etc - temp
echo "VH="$VH
export gtm_dist="${VH}/m"
echo "gtm_dist="$gtm_dist
export gtm_prompt="ASTRON>"

export node_home="/opt/ewdlite/node_modules/nodem"
export GTMCI="${node_home}/resources/calltab.ci"

#export gtm_sysid="xxxx"
export gtm_log="${VH}/log"
export gtmgbldir="${VH}/g/mumps.gld"
export gtmroutines="${VH}/o(${VH}/p ${VH}/r ${node_home}/src)"
export gtmroutines="${gtmroutines} ${gtm_dist}"
export gtm_zinterrupt='I $$JOBEXAM^ZU($ZPOSITION)'
# MD5 Library external-call table
#export GTMXC_md5="${VH}/w/xc/gtm_md5.xc"
##
export PATH="${VH}/m:${PATH}"
unset  VH

###
# Define command aliases
alias GTM="${gtm_dist}/mumps -direct"
alias gtm="${gtm_dist}/mumps -direct"
alias mupip="${gtm_dist}/mupip"
alias gde="${gtm_dist}/mumps -run ^GDE"
alias GDE="${gtm_dist}/mumps -run ^GDE"
alias lke="${gtm_dist}/lke"
alias dse="${gtm_dist}/dse"
alias LKE="${gtm_dist}/lke"
alias DSE="${gtm_dist}/dse"
alias rundown="${gtm_dist}/mupip rundown -r \"*\""


So that's it. We had a successful test with the above files.

Kevin Toppenberg