Questions during installation of EWD.js

60 views
Skip to first unread message

kdtop

unread,
Mar 12, 2014, 2:16:45 PM3/12/14
to ewd-an...@googlegroups.com
I have some questions that have come up during my install of EWD.js.  I give some background on the steps to get to the issue.  I'll put the actual questions / concerns in bold.

I am trying to follow the directions in Appendix 1 of the EWD.js reference guide  (build 0.54). http://gradvs1.mgateway.com/download/EWDjs.pdf

The first part of this tutorial is to set up a machine on Amazon.  I have an existing machine, so I skipped past that part.

I went on to page 65 and downloaded the .deb installer for 32-bit Ubuntu.
I followed steps 2 and 3.

For step 4, instead of installing the .deb file from the console, I double-clicked it from a graphic desktop.  This launched a GUI installer that appeared to install without any problems. 

Step 5 states
One last step: Log out and log back in as ubuntu: this will ensure that you have the correct read/write/execute permissions to access your EWD.js Home Directory and to develop EWD.js applications.

This confuses me.  I don't have a user "ubuntu" on my system.  I assume this might have been set up in the instructions for the Amazon machine.  Everything else on my system is typically run under my user kdtop.   I did verify that the expected files were found in the /opt/globalsdb and the /opt/ewdlight directories.  I changed all the files in them to be owned by user kdtop, but kept them in the group ewd.  I'm not sure if this will cause problems later or not.  Does EWD.js have requirements for a particular user:group?

For the next step

sudo start ewdlite

It seems that when I first tried this, it failed.  I did some research and started writing this message.  I then tried it again, and it worked.  Great!

I followed the instructions to change the from HTTP to HTTPS, but when I did, I could no longer bring up the EWD monitor page in the web browser.  The browser just kept waiting for a response from the server.  I suspect this is because I don't have a certificate installed.  I changed it back and will work on this later.  Am I correct that this is the reason?

So now that am done with Appendix 1, I go back to page 6, where it discusses ewdgateway2.  I assume that this has already been installed, but to follow along, I want to know what my EWD.js home directory is.  Page 7 discusses installing it inside ~/globalsdb.  Mike's installer set up a directory /opt/globalsdb.  So is this the home?  When I get a directory listing there, it doesn't have a folder named "ewdgateway2".  It has only folders bin, dev, and mgr.  [CORRECTION: I found on page 66 that the EWD.js home directory is "/opt/ewdlite"]

So I just did a full file system search for "ewd*" and I found, that apparently a former version of EWD was already on my system, I presume from this being an Astronaut VistA installation.  The old installation files are in /opt/lsb-mgateway/wed,  and /opt/worldvista/EHR/web/ewdapps, and /opt/var/VistA/www/resources/ewd*  and /opt/var/VistA/www/ewd/  and /opt/var/VistA/www/r/* .  My new installation files appear to be in /opt/ewdlite/* and /opt/globalsdb.  How can I check that the old system is not starting up as a service?  I don't care if the folders sit there unused, but I don't want both systems running and conflicting.

But back to looking for the ewdgateway2, it appears to be /opt/ewdlite/node_modules/ewdgateway2/.  And I just found the EWD.js directory (noted above).

Looking on page 9, there is a list of files that should be in the EWD.js home directory.  I have ewdStart-globals* files, but ewdStart-gtm.js is missing.  I assume that Mike's installer took care of this. CORRECTION: when I inspect /opt/ewdlite/ewdStart-globals.js, I see that it is not pointing to GTM, but is instead pointing to a cache' database in /globalsdb.  So I will need to manually edit this file to match the GT.M setup shown on page 11, modified to my paths.  I think the documentation needs to be more clear that Mike's installer doesn't easily allow for connection for GT.M database, since ewdStart-gtm.js is missing.  I'll have to type this in by hand from the display on page 11.  I'm a bit grumpy now.   

So to edit my /opt/ewdlite/ewdStart-globals.js, I see that for the example below:

 database: {
   type: 'gtm',
   nodePath: "/home/vista/mumps" [ ‘requires’ path for loading NodeM’s 
   mumps.node file ]
 },

I need to get the path to mumps.node.  But I don't know if this was installed in Mike's installer or not.  I suspect not, since it left me using globalsdb.  So I see on page #4 that I can download this from David Wicksell's site.  Going there, I see that it is version 0.3.1, with a disclaimer "Nodem is experimental, and not yet ready for production"... not very encouraging.   I first want to see if this has already been installed.  I do a full system search for "mumps.node" and "nodem" and no hits for either.

I see that my system has npm, so I did "npm install nodem".  It appeared to succeed.  I can't tell where the files went, so another full system search for nodem now reveals 2 hits:
  /home/kdt0p/.npm/nodem
  /opt/ewdlite/node_modules/nodem

I don't understand the sentence [‘requires’ path for loading NodeM’s mumps.node file ].  I would have expected it to say "required path..."  Why is "requires" in quotation marks?  I do a search of my system, and now I find the following

$ find / -name 'mumps.node' 2>/dev/null
/home/kdt0p/.npm/nodem/0.3.1/package/lib/mumps.node
/opt/ewdlite/node_modules/nodem/lib/mumps.node

I'm a bit confused by that 2nd entry.  Surely the npm installer didn't put it there.  Did I miss that it was already there before??   

According to Wiksell's instructions I copy the correct version 
  cp mumps10.node_i686 mumps.node


.... I'm out of time.  I'll post this, and then continue on tomorrow.

Kevin T




kdtop

unread,
Mar 14, 2014, 8:10:49 AM3/14/14
to ewd-an...@googlegroups.com
Continuing on.  I'll add additional text at bottom...
I wrote David Wicksell directly:

In the documentation on your github site, it looks like Nodem determines where the GT.M database is located by use of environmental variables, e.g. $gtmn_dist etc.

In our system, we have traditionally not had these automatically defined when linux boots up. Instead, we have a script that we use to launch vista, and this script sources out another script named "setup_vista_env" that exports all our environmental variables.

So it looks like we need to do this when launching nodem as well. But since nodem is launched by node.js, and node.js is started as a service, then where would I stick in the part that sets up our environment? And ideas, or is this a question for Rob Tweed?

He wrote back: 
...  If you are simply looking to add Node.js, EWD.js, and Nodem to an existing server, then Node.js will not automatically be started as a service at all. That is something that you have to figure out how to do on your own. So if this is the case, then you could just write a quick shell script that sources your environment script for GT.M and then starts your Node server, with Nodem ready to go.

 If, on the other hand, you are using some other server environment, which already has Node.js running as a service daemon, then you could use add some code to the EWD.js server configuration file, which could set up your environment for GT.M. I'll give you an example at the end of this email. But if you are using OSEHRA environment, then Nodem will already work, because GT.M, VistA, Node.js, Nodem, EWD.js, etc. are already set up and configured and work out of the box.

  So, if you need more help, I'll need some more information about your server set up and what you are trying to do. There are many ways to accomplish this. Hope this helps. Thank you.

 Here is an example of how you could set the environment variables from within the EWD.js server configuration file. They will need to be set before ewd.start(...). E.g.

  process.env.gtm_dist  = '/home/dlw/vista/lib/gtm';
  process.env.gtmgbldir = '/home/dlw/vista/g/db.gld';
  process.env.gtmroutines = '/home/dlw/vista/p/ /home/dlw/vista/r/ /home/dlw/vista/lib/gtm/libgtmutil.so';
 

To which I replied: 

... We are trying to setup EWD.js into an existing server running GT.M.  I started with the installer mentioned in Appendix [1] of the EWD.js reference guide.  It creates the following(see below)  /etc/init/ewdlite.conf file.  I am a bit hazy on the details, but I assume that all the scripts in that /etc/init directory are automatically run.

I am guessing it is after that "script" that I would need to source my script to set up the environment.

If that doesn't work, then I may need to put them into the EWD.js server config file as you mentioned.  
 
... 

Below is my new, modified file
==================================
/etc/init/ewdlite.conf 
==================================

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
==================================
==================================

And below is the referenced script to set up the environment
==================================
==================================

#!/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 gtm_sysid="xxxx"
export gtm_log="${VH}/log"
export gtmgbldir="${VH}/g/mumps.gld"

#/opt/var/FPGVista/p /opt/var/FPGVista/o(/opt/var/FPGVista/r) /opt/var/FPGVista/m
#export gtmroutines="${VH}/p"
#export gtmroutines="${gtmroutines} ${VH}/o(${VH}/p ${VH}/r)"
export gtmroutines="${VH}/o(${VH}/p ${VH}/r)"
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

###
# I WOULD LIKE TO REMOVE THESE!!! --ldl
# 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 \"*\""
==================================
==================================

And her is my ewd config file:
==================================
==================================
/opt/ewdlite/ewdStart-globals.js
==================================
==================================
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",
  },
  lite: true,
  modulePath: '/opt/ewdlite/node_modules',
  traceLevel: 3,
  webServerRootPath: '/opt/ewdlite/www',
  logFile: 'ewdLog.txt',
  management: {
    password: <redacted>
 }
};

ewd.start(params);
==================================
==================================

... now for testing.  Will post more later.

Kevin


Reply all
Reply to author
Forward
0 new messages