TMG EWD / Node.js configuration
Below will be a description of the EWD setup used at the TMG Site (Kevin Toppenberg's office)
EWD Reference guide: EWDjs.pdf
Here are some notes made during installation and in this thread:
Below is the resulting directory structure
/opt/ewdlite/
├── node_modules
│ ├── ewdgateway2
│ │ ├── ewd-classic
│ │ │ ├── ewdapps
│ │ │ │ └── ewdGateway2
│ │ │ │ ├── js
│ │ │ │ └── node
│ │ │ │ └── ewdGateway2
│ │ │ │ └── examples
│ │ │ └── startupExamples
│ │ ├── ewdLite
│ │ │ ├── mongoDB
│ │ │ │ └── node-0.10
│ │ │ │ ├── linux32
│ │ │ │ ├── linux64
│ │ │ │ ├── raspberryPi
│ │ │ │ └── winx64
│ │ │ ├── node_modules
│ │ │ ├── OSEHRA
│ │ │ ├── ssl
│ │ │ ├── startupExamples
│ │ │ └── www
│ │ │ ├── ewd
│ │ │ │ ├── bootstrap3
│ │ │ │ ├── ewdEncrypter
│ │ │ │ ├── ewdGDSync
│ │ │ │ ├── ewdMonitor
│ │ │ │ ├── VistADemo
│ │ │ │ └── webSvcMgr
│ │ │ ├── ewdLite
│ │ │ └── respond
│ │ ├── examples
│ │ ├── lib
│ │ └── node_modules
│ │ └── socket.io
│ │ ├── benchmarks
│ │ ├── lib
│ │ │ ├── stores
│ │ │ └── transports
│ │ │ └── websocket
│ │ └── node_modules
│ │ ├── base64id
│ │ │ └── lib
│ │ ├── policyfile
│ │ │ ├── doc
│ │ │ ├── examples
│ │ │ ├── lib
│ │ │ └── tests
│ │ │ └── ssl
│ │ ├── redis
│ │ │ ├── benches
│ │ │ │ └── stress
│ │ │ │ ├── pubsub
│ │ │ │ ├── rpushblpop
│ │ │ │ └── speed
│ │ │ ├── examples
│ │ │ └── lib
│ │ │ └── parser
│ │ └── socket.io-client
│ │ ├── bin
│ │ ├── components
│ │ │ ├── component-bind
│ │ │ ├── component-emitter
│ │ │ ├── component-json
│ │ │ ├── component-json-fallback
│ │ │ ├── learnboost-engine.io-client
│ │ │ │ └── lib
│ │ │ │ └── transports
│ │ │ ├── learnboost-socket.io-protocol
│ │ │ ├── timoxley-to-array
│ │ │ └── visionmedia-debug
│ │ ├── dist
│ │ ├── lib
│ │ │ ├── transports
│ │ │ └── vendor
│ │ │ └── web-socket-js
│ │ │ └── flash-src
│ │ │ └── com
│ │ │ ├── adobe
│ │ │ │ └── net
│ │ │ │ └── proxies
│ │ │ ├── gsolo
│ │ │ │ └── encryption
│ │ │ └── hurlant
│ │ │ ├── crypto
│ │ │ │ ├── cert
│ │ │ │ ├── hash
│ │ │ │ ├── prng
│ │ │ │ ├── rsa
│ │ │ │ ├── symmetric
│ │ │ │ ├── tests
│ │ │ │ └── tls
│ │ │ ├── math
│ │ │ └── util
│ │ │ └── der
│ │ ├── node_modules
│ │ │ ├── active-x-obfuscator
│ │ │ │ └── node_modules
│ │ │ │ └── zeparser
│ │ │ ├── uglify-js
│ │ │ │ ├── bin
│ │ │ │ ├── lib
│ │ │ │ ├── test
│ │ │ │ │ └── unit
│ │ │ │ │ └── compress
│ │ │ │ │ ├── expected
│ │ │ │ │ └── test
│ │ │ │ └── tmp
│ │ │ ├── ws
│ │ │ │ ├── bench
│ │ │ │ ├── bin
│ │ │ │ ├── build
│ │ │ │ │ └── Release
│ │ │ │ │ └── obj.target
│ │ │ │ │ ├── bufferutil
│ │ │ │ │ │ └── src
│ │ │ │ │ └── validation
│ │ │ │ │ └── src
│ │ │ │ ├── doc
│ │ │ │ ├── examples
│ │ │ │ │ ├── fileapi
│ │ │ │ │ │ └── public
│ │ │ │ │ ├── serverstats
│ │ │ │ │ │ └── public
│ │ │ │ │ └── serverstats-express_3
│ │ │ │ │ └── public
│ │ │ │ ├── lib
│ │ │ │ ├── node_modules
│ │ │ │ │ ├── commander
│ │ │ │ │ │ └── lib
│ │ │ │ │ ├── nan
│ │ │ │ │ ├── options
│ │ │ │ │ │ ├── lib
│ │ │ │ │ │ └── test
│ │ │ │ │ │ └── fixtures
│ │ │ │ │ └── tinycolor
│ │ │ │ ├── src
│ │ │ │ └── test
│ │ │ │ └── fixtures
│ │ │ └── xmlhttprequest
│ │ │ ├── example
│ │ │ ├── lib
│ │ │ └── tests
│ │ └── test
│ │ └── node
│ ├── ewdliteclient
│ │ └── lib
│ └── nodem
│ ├── examples
│ ├── lib
│ ├── resources
│ └── src
├── ssl
└── 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