EWD Install Instructions

From VistApedia
Revision as of 02:57, 30 September 2012 by Kirt (talk | contribs)
Jump to: navigation, search

Welcome to my page on installing [EWD]. I am doing this on Ubuntu. If you do this on a Red Hat like system, you have to adapt the instructions.

Prerequisites

  • Latest Version of GT.M installed
  • VISTA installed

Install Git and download the Git Repo of EWD

I make my own directory called src or svn or whatever and put all the source code in it.

sudo apt-get install git-core				; Get Git
git clone git://github.com/robtweed/EWD.git		; Get EWD

EWD Installation Using Apache

This will install EWD using Apache as the web facing gateway to EWD. To install it using Node, see below.

Install and Set-up mgwsi

MGWSI is the tcp listener on GT.M that listens for apache requests. Make a routine directory that will be part of the $gtmroutines add add that directory to your $gtmroutines. (Or you could just use a directory already in the existing gtmroutines.) Here's my GT.M env set-up script, for example. I am running in UTF-8 mode, so you will see extra lines that have to do with that.

#/bin/bash
cd ~/pocn-moh
export gtm_dist=/opt/fis-gtm/V5.4-002A/utf8/
export gtmroutines="uo(routines svn/BMX ewdroutines) $gtm_dist"
export gtmgbldir=mumps.gld
export PATH=$PATH:$gtm_dist
export gtm_chset=utf-8
export gtm_icu_version=4.2

Copy the ZMGWSI routines from EWD's m_apache directory to your routines folder.

cp svn/EWD/m_apache/*.m ewdroutines/

Verify that the routines are found by GT.M:

sam@sam-desktop:~/pocn-moh$ mumps -dir

GTM>d ^%RD

Routine directory
Routine: %ZM*
%ZMGWSI   %ZMGWSIS  
Total of 2 routines.

Run the program now to make sure it compiles properly.

sam@sam-desktop:~/pocn-moh$ mumps -r INETD^%ZMGWSIS
%GTM-I-CTRLC, CTRL_C encountered

GTM>ZSHOW
CHILD3+5^%ZMGWSIS    (Direct mode) 
XINETD+2^%ZMGWSIS

GTM>H

Then make a bash script to call it:

sam@sam-desktop:~/pocn-moh$ cat mgwsi-rpcproc 
#!/bin/bash
cd /home/sam/pocn-moh
source ./run_utf8
date>>rpc_log.log
$gtm_dist/mumps -run INETD^%ZMGWSIS 2>> rpc_log.log
exit 0

# Make it executable
sam@sam-desktop:~/pocn-moh$ chmod +x mgwsi-rpcproc 

# Run it
sam@sam-desktop:~/pocn-moh$ ./mgwsi-rpcproc 

GTM>zshow
CHILD3+5^%ZMGWSIS    (Direct mode) 
XINETD+2^%ZMGWSIS

GTM>h

Now we put it as a xinetd service

# Create the following line in configuration file: /etc/services
mgwsi           7041/tcp                # Service for MGWSI clients

# Create Xined script that calls mgwsi-rpcproc
sudo cat mgwsi_pocn-moh_7041
service mgwsi-pocn-moh-7041
        {
        disable	= no
        port = 7041
        socket_type = stream
        protocol = tcp
        user = sam
        server = /bin/bash
        groups = yes
        server_args = /home/sam/pocn-moh/mgwsi-rpcproc
        type = UNLISTED
        wait = no
        }

Now we test it by putting xinetd in debug mode and then telneting to the port.

sam@sam-desktop:/etc/xinetd.d$ sudo xinetd -d &
[2] 10521
...
Service configuration: mgwsi-pocn-moh-7041
	id = mgwsi-pocn-moh-7041
	flags = IPv4
	type = UNLISTED
	socket_type = stream
	Protocol (name,number) = (tcp,6)
	port = 7041
	wait = no
	user = 1000
	Groups = yes
	PER_SOURCE = -1
	Bind = All addresses.
	Server = /bin/bash
	Server argv = bash /home/sam/pocn-moh/mgwsi-rpcproc
	Only from: All sites
	No access: No blocked sites
	No logging
...
11/5/23@10:41:33: DEBUG: 10521 {cnf_start_services} Started service: mgwsi-pocn-moh-7041
...
11/5/23@10:41:33: NOTICE: 10521 {main} xinetd Version 2.3.14 started with libwrap loadavg options compiled in.
11/5/23@10:41:33: NOTICE: 10521 {main} Started working: 8 available services
11/5/23@10:41:33: DEBUG: 10521 {main_loop} active_services = 8
telnet localhost 7041
Trying ::1...
Trying 127.0.0.1...
11/5/23@10:41:52: DEBUG: 10521 {main_loop} select returned 1
Connected to localhost.
Escape character is '^]'.
11/5/23@10:41:52: DEBUG: 10521 {server_start} Starting service mgwsi-pocn-moh-7041
11/5/23@10:41:52: DEBUG: 10521 {main_loop} active_services = 8
11/5/23@10:41:52: DEBUG: 10523 {exec_server} duping 14
^]

telnet> quit
Connection closed.
sam@sam-desktop:/etc/xinetd.d$ 11/5/23@10:41:57: DEBUG: 10521 {main_loop} active_services = 8
11/5/23@10:41:57: DEBUG: 10521 {main_loop} select returned 1
11/5/23@10:41:57: DEBUG: 10521 {check_pipe} Got signal 17 (Child exited)
11/5/23@10:41:57: DEBUG: 10521 {child_exit} waitpid returned = 10523
11/5/23@10:41:57: DEBUG: 10521 {server_end} mgwsi-pocn-moh-7041 server 10523 exited
11/5/23@10:41:57: INFO: 10521 {conn_free} freeing connection
11/5/23@10:41:57: DEBUG: 10521 {child_exit} waitpid returned = -1
11/5/23@10:41:57: DEBUG: 10521 {main_loop} active_services = 8

Once you are sure it works, foreground your xinetd process and kill it using Ctrl-C.

Setting up m_apache

First, make sure that m_apache is the right architecture for your machine. If not, you need to compile the m_apache.c file. The compilation instructions are from the source. Also, Mike Clayton's 64 bit installers for EWD provide the m_apache22 file in 64 bit format which you can extract from the .deb file.

sam@sam-desktop:~/pocn-moh/svn/EWD/m_apache$ file m_apache22.so 
m_apache22.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped

Copy to the lib folder of apache modules: in Ubuntu: /usr/lib/apache2/modules

sudo cp m_apache22.so /usr/lib/apache2/modules/

Configure your apache so that it will route all pages in a specific location to Mumps. Make sure to get your gld file correctly. I edited my /etc/apache2/sites-available/default to have these lines:

    LoadModule m_apache_module /usr/lib/apache2/modules/m_apache22.so
    <Location /ewd>
        SetEnv MGWSI_PORT 7041
        SetEnv MGWSI_M_UCI /home/sam/pocn-moh/mumps.gld
        SetEnv MGWSI_M_FUNCTION runPage^%zewdGTMRuntime
    </Location>

Restart apache and make sure there aren't any errors.

sam@sam-desktop:/etc/apache2/sites-available$ sudo service apache2 restart
 * Restarting web server apache2                                                                                                          apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 ... waiting .apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
                                                                                                                                   [ OK ]

Test M apache. In a web browser, navigate to http://localhost/ewd/index.mgwsi. You should get an EWD Error Page. If you get an apache error message, something is wrong.

SELinux and Apache to MGWSI

If you do get an apache Service Unavailable message, it could be due to SELinux.

Review /var/log/audit/audit.log. See if there is a AVC type message like this:

type=AVC msg=audit(1317316775.606:57870): avc:  denied  { name_connect } for  pid=15027 comm="httpd" dest=7041 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:port_t:s0 tclass=tcp_socket

If you see something like this, you need to tell SELinux the following:

semanage port -a -t http_port_t -p tcp 7041

Install EWD M Files

Copy the EWD Mumps files to a GT.M Mumps directory. They are all in the root of the repo.

sam@sam-desktop:~/pocn-moh/svn$ cp EWD/*.m ../ewdroutines/

Install Resources

You need to install a bunch of files under /var/www:
# Copy iwd from the root directory to /var/www/
sudo cp -r iwd /var/www/

# Copy the resources files from the ewdMgr/resourceFiles directory to /var/www/resources (which you need to make)
sudo mkdir -p /var/www/resources
sudo chmod 777 /var/www/resources/
sudo cp ewdMgr/resourceFiles/* /var/www/resources

# Get the YUI library and install it.
wget http://yui.zenfs.com/releases/yui2/yui_2.6.0r2.zip
sudo unzip yui_2.6.0r2.zip -d /var/www/
sudo chmod 777 /var/www/yui/

Install EWD Applications

# Make a directory for [[application~|Application]]s
sam@sam-desktop:~/pocn-moh$ mkdir ewdapps

# Copy the ewdMgr and iwd to that directory
cp -r ewdMgr/ ../../ewdapps/
cp -r iWDApps/ ../../ewdapps/

Configure EWD for the First Run

There are many bugs in this area, so make sure to read below so you know what you are in for before doing any of these steps.

GTM>KILL ^zewd

GTM>D compileAll^%zewdAPI("ewdMgr")

Installing/Configuring Enterprise Web Developer (Build 790)

Note: hit Esc to go back at any point


[[Application~|Application]] Root Path (/usr/ewdapps): /home/sam/pocn-moh/ewdapps
Routine Path (/usr/local/gtm/ewd/): /home/sam/pocn-moh/ewdroutines/
Javascript and CSS File Output Path (/var/www/resources/): /var/www/resources/
Javascript and CSS File URL Path (/resources/): /resources/

Enterprise Web Developer (Build 790) is configured and ready for use

EWD First Run Bugs

  • _zewdDocumentation2.m contains invalid Unicode characters. I cleaned it up using iconv.
iconv -fUTF8 -tUTF8 -c _zewdDocumentation2.m -o _zewdDocumentation2.m
  • EWD expects to be able to write to /var/www/resources. I put that in the instructions for that section.
  • For some reason, EWD switches the routine path the first time it connects from the web. Why??? So you have to fix it manually. AND REMEMBER TO PUT A TRAILING SLASH. THAT ONE CAUGHT ME FOR A WHILE!!!
S ^zewd("config","routinePath","gtm")="/home/sam/pocn-moh/ewdroutines/"
  • Issue of compiling Applications with subdirectories. Where is it supposed to output? Update: Rob says ignore for now. Here's an example:
GTM>d compileAll^%zewdAPI("iWDApps")
mkdir: cannot create directory `/iWDApps': Permission denied
mkdir: cannot create directory `/iWDApps/iWDExample': No such file or directory
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/completed.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/demologin.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/details.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/ewdAjaxError.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/ewdAjaxErrorRedirect.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/ewdErrorRedirect.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/index.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/newUser.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/selectApp.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/selectLocations.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/selectUser.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/tab1.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/tab2.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/tab3.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/tab4.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDExample/userList.ewd
mkdir: cannot create directory `/iWDApps': Permission denied
mkdir: cannot create directory `/iWDApps/iWDMgr': No such file or directory
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/about.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/[[application~|Application]]s.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/configuration.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/ewdAjaxError.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/ewdAjaxErrorRedirect.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/ewdErrorRedirect.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/incomplete.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/index.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/login.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/mainMenu.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/pageMenu.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/pages.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/sessionContent.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/sessionDetails.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iWDMgr/sessions.ewd
mkdir: cannot create directory `/iWDApps': Permission denied
mkdir: cannot create directory `/iWDApps/imdb': No such file or directory
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/attributeMenu.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/deleteAttribute.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/deleteDomain.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/deleteItem.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/domainMenu.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/editAttribute.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/ewdAjaxError.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/ewdAjaxErrorRedirect.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/ewdErrorRedirect.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/index.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/itemMenu.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/login.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/newAttribute.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/newDomain.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/newItem.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/notInitialised.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/saveAttribute.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/saveAttributeValue.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/saveDomain.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/imdb/saveItem.ewd
mkdir: cannot create directory `/iWDApps': Permission denied
mkdir: cannot create directory `/iWDApps/iwdmdb': No such file or directory
/home/sam/pocn-moh/ewdapps/iWDApps/iwdmdb/CDMenu.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iwdmdb/CDXArtist.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iwdmdb/CDXArtistList.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iwdmdb/CDXTitle.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iwdmdb/about.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iwdmdb/ewdAjaxError.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iwdmdb/ewdAjaxErrorRedirect.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iwdmdb/ewdErrorRedirect.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iwdmdb/index.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iwdmdb/mainMenu.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/iwdmdb/selectTrack.ewd
mkdir: cannot create directory `/iWDApps': Permission denied
mkdir: cannot create directory `/iWDApps/mdb': No such file or directory
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/addUser.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/addUserResponse.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/applianceAbout.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/displayDomain.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/ewdAjaxError.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/ewdAjaxErrorRedirect.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/ewdDocs.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/ewdErrorRedirect.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/getDomains.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/index.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/initialise.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/initialiseInfo.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/login.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/loginForm.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/mainmenu.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/mdbMenu.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/mdbWelcome.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/mgwsiMgr.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/security.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/showUserInfo.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/showUsers.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/timezone.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/timezoneResponse.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/userDetails.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/vaConfig.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/vaConfigApache.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/vaConfigArchitecture.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/vaConfigExit.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/vaConfigGTM.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/vaConfigIP.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/vaConfigKB.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/vaConfigLinuxGTM.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/vaConfigMGWSI.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/vaConfigMenu.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/vaConfigUsernames.ewd
/home/sam/pocn-moh/ewdapps/iWDApps/mdb/viewer.ewd
  • I wasn't able to get YUI tags to work. The JS to load them properly in the webpage is there, but is not evaluated. I will work on that later.

Setting Up the Special MGWSI Functions Location

You need this for several cryptographic functions to work:

	<Location "/mgwsi/sys/">
	# This is a reserved location used for the m_apache systems facilities invoked through: 
	# /mgwsi/sys/system_functions.mgwsi
	Order deny,allow
	Allow from all
	</Location>

Setting Up SSL With EWD

There is nothing to it. Follow the instructions here: http://wiki.centos.org/HowTos/Https then make your config file as follows (Note that I did this on CentOS):

LoadModule m_apache_module modules/m_apache22.so
ServerName example.com

NameVirtualHost *:443
<VirtualHost *:443>
        SSLEngine on
        SSLCertificateFile /etc/pki/tls/certs/ca.crt
        SSLCertificateKeyFile /etc/pki/tls/private/ca.key
        <Location /ewd>
                SetEnv MGWSI_PORT 7041
                SetEnv MGWSI_M_UCI /opt/worldvista/EHR/globals/mumps.gld
                SetEnv MGWSI_M_FUNCTION runPage^%zewdGTMRuntime
        </Location>
	<Location "/mgwsi/sys/">
	# This is a reserved location used for the m_apache systems facilities invoked through: 
	# /mgwsi/sys/system_functions.mgwsi
	Order deny,allow
	Allow from all
	</Location>

</VirtualHost>

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Setting up the SSL Proxy for EWD

There is a special case where you are trying to access external ssl connections from within EWD using the http methods in %zewdGTM. If you do so, you will need to configure a proxy on port 89 that forwards your connections from EWD to the ssl port. This is done using Apache's mod_proxy and mod_ssl. My thanks to David W and Larry L for the instructions on how to set this up and prevent it from being abused.

These instructions are for Debian systems.

First, enable the modules ssl and proxy.

sudo a2enmod proxy
sudo a2enmod proxy_connect
sudo a2enmod proxy_ftp
sudo a2enmod proxy_http
sudo a2enmod ssl

Set-up this config file for apache:

  Listen 89
  SSLProxyEngine on
  ProxyRequests on

  <Proxy *>
    Order deny,allow
    Deny from all
    Allow from localhost
  </Proxy>

  SSLProxyEngine on
  SSLProxyVerify none

  ProxyVia on

Miscellaneous Stuff

Compiling m_apache

I am troubleshooting a bug in m_apache right now: I needed to re-compile it because I think I may have an older version. If the bug shows up again, well, I can change the source. I did this on CentOS 6; your luck may differ.

You need m_apache.c from the EWD repo, which you downloaded in step 1.

yum install gcc
yum install httpd-devel
yum install openssl-devel
apxs -i -a -I/usr/include/openssl/ -n m_apache22 -o m_apache22.so -c m_apache.c

I also figured out how to do it with plain gcc using the tips apxs gave me.

> gcc -fPIC -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wformat-security -fno-strict-aliasing  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -I/usr/include/openssl/  -c -o m_apache.obj m_apache.c
> gcc -shared -rdynamic -o m_apache22.so m_apache.obj

EWD Installation using Node.js

Node.js is a an up and coming technology that allows you to build scalable network programs. EWD works with node.js. For more information on the advantages of using node.js with EWD, look here.

Note that I am doing this on a different machine than above with vastly different directories. The ideas are the same though.

Install Node.js & NPM

I install node per the Node.js wiki in my home directory and then add it to my path. You may have other ideas. Note that you have to have gcc, g++ and GNU Make installed.

# Get Node from Github
git clone --depth 1 git://github.com/joyent/node.git
sudo apt-get install libssl-dev
# Install Node
cd node  # cd to the git directory you downloaded above
export JOBS=2 # optional, sets number of parallel commands.
mkdir ~/local
./configure --prefix=$HOME/local/node
make
make install
export PATH=$HOME/local/node/bin:$PATH (& put in .bashrc)

# Install NPM
sudo apt-get install curl
curl http://npmjs.org/install.sh | sh

Install ewdGateway.js & Socket.io

Install using npm.

npm install ewdGateway
npm install socket.io

Prepare GT.M directories

I will assume that you already have VISTA installed on GT.M. For EWD, you need to drop the EWD routines in a directory that contains the M routines for VISTA, and you need to drop the Applications in another directory.

Copy EWD Routines into the Routines directory

Copy the EWD Mumps files to a GT.M Mumps directory. They are all in the root of the repo.

sakura@medusa:~$ cd EWD    
sakura@medusa:~/EWD$ cp *.m /opt/worldvista/EHR/routines/

Copy Resources

Note that for convenience I chmodded /var/www to 777 instead of being root.

sakura@medusa:~/EWD$ cp -r iwd/ /var/www/
sakura@medusa:~/EWD$ mkdir -p /var/www/resources
sakura@medusa:~/EWD$ chmod 777 /var/www/resources
sakura@medusa:~/EWD$ cp ewdMgr/resourceFiles/* /var/www/resources/

Copy Applications

sakura@medusa:~/EWD$ cp -r ewdMgr/ /opt/worldvista/EHR/plugins/web/ewdapps/
sakura@medusa:~/EWD$ cp -r iWDApps/ /opt/worldvista/EHR/plugins/web/ewdapps/

First Time EWD Configuration

Let me explain a few things here.

  • I kill ^zewd first because my instance already has that existing and it's incorrect.
  • EWD tries to install files in /var/www/resources using sudo. Remember that we already made /var/www/resources modded to 777, so we will be able to write to it. Just hit enter on the sudo prompts and the files will be written anyways.
  • Ignore the mkdir Errors. These happen because there is a sub-directory under ewdMgr, and EWD does not support subdirectories in an Application.
  • Don't forget the trailing slashes on the directories.
sakura@medusa:~/EWD$ gtm                                  

medusa>K ^zewd

medusa>d compileAll^%zewdAPI("ewdMgr")

Installing/Configuring Enterprise Web Developer (Build 887)

Note: hit Esc to go back at any point


[[Application~|Application]] Root Path (/usr/ewdapps): /opt/worldvista/EHR/plugins/web/ewdapps/
Routine Path (/usr/local/gtm/ewd/): /opt/worldvista/EHR/plugins/web/r/
Javascript and CSS File Output Path (/var/www/resources/): /var/www/resources/
Javascript and CSS File URL Path (/resources/): /resources/

Enterprise Web Developer (Build 887) is configured and ready for use

[sudo] password for sakura: 
Sorry, try again.
[sudo] password for sakura: 
Sorry, try again.
[sudo] password for sakura: 
Sorry, try again.
sudo: 3 incorrect password attempts
[sudo] password for sakura: 
Sorry, try again.
[sudo] password for sakura: 
Sorry, try again.
[sudo] password for sakura: 
Sorry, try again.
sudo: 3 incorrect password attempts
[sudo] password for sakura: 
Sorry, try again.
[sudo] password for sakura: 
Sorry, try again.
[sudo] password for sakura: 
Sorry, try again.
sudo: 3 incorrect password attempts
[sudo] password for sakura: 
Sorry, try again.
[sudo] password for sakura: 
Sorry, try again.
[sudo] password for sakura: 
Sorry, try again.
sudo: 3 incorrect password attempts
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/about.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/applianceAbout.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/compilePage.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/compilePageResults.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/compiler.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/compilerResults.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/config.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/configDaemon.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/configMenu.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/configSettingsSaved.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/customTags.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/dataTypes.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/deleteCustomTag.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/deleteDataType.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/docParam.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/docParams.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/docPurpose.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/docRetVal.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/docTypCall.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/documentation.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/domDocumentation.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/domDocumentationDetail.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/editCustomTag.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/editDataType.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/errors.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/ewdAjaxError.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/ewdAjaxErrorRedirect.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/ewdDocs.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/ewdErrorRedirect.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/ewdMgr.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/gtmHome.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/gtmMenu.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/gtmSecurity.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/index.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/initialPage.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/initialSecurity.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/invalidAccess.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/invalidAccessMessage.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/invalidvaaccess.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/listError.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/listPage.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/listSession.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/login.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/loginForm.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/logout.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/mainMenu.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/mapacheConfig.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/mgwsiMgr.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/newCustomTag.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/newDataType.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/relink.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/reloadCustomTags.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/reloadDataTypes.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/reloadSecurity.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/security.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/sessions.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/showCustomTagNotes.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/showDataTypeNotes.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/user.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/vaConfig.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/vaConfigApache.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/vaConfigArchitecture.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/vaConfigEWD.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/vaConfigExit.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/vaConfigGTM.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/vaConfigIP.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/vaConfigKB.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/vaConfigLinuxGTM.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/vaConfigMGWSI.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/vaConfigMenu.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/vaConfigUsernames.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/vaInitialPage.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/xref.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/xrefPageFromPage.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/xrefPageFromScript.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/xrefPageFromTag.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/xrefPageToPage.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/xrefPageToScript.ewd
/opt/worldvista/EHR/plugins/web/ewdapps/ewdMgr/xrefPageToTag.ewd
mkdir: cannot create directory `/ewdMgr': Permission denied
mkdir: cannot create directory `/ewdMgr/resourceFiles': No such file or directory

medusa>

Last thing, launch ewdGateway

First, you need to make a tiny node js file. I called it launchewd.js.

 
  var ewd = require('ewdGateway');
  var params = {database:'gtm', httpPort: 8080, poolSize: 3, startWebserver: true};
  ewd.start(params, function(gateway) {
    console.log("version = " + gateway.version());
  });

Now, go ahead and launch it. The mumps executable must be in the PATH otherwise the execution will seem successful but not really.

 
sakura@medusa:~/node$ PATH=$gtm_dist:$PATH node launchewd.js 

Here's the output:

 
sakura@medusa:~/node$ PATH=$gtm_dist:$PATH node launchewd.js 
   info  - socket.io started
********************************************
*** EWD Gateway for GT.M Build 18 (14 September 2011) ***
********************************************
3 connections established to GT.M
Web server started successfully on port 8080
Trace mode is on
version = ewdGateway build 18, 14 September 2011
/ewd/so/index.ewd
incoming request for app: so; page: index
added to Queue (http): %7B%7D; queue length = 1; requestNo = 1; after 13.655 sec
processing queue: 1; queue length 1; after 13.656 seconds
Request sent to Cache using connection = 0
from GT.M on connection 0:
HTTP/1.1 200 OK


dump: :72:84:84:80:47:49:46:49:32:50:48:48:32:79:75:13:10

from GT.M on connection 0:
Content-type: 

dump: :67:111:110:116:101:110:116:45:116:121:112:101:58:32

from GT.M on connection 0:
text/html

dump: :116:101:120:116:47:104:116:109:108

from GT.M on connection 0:



dump: :13:10

from GT.M on connection 0:



dump: :13:10

from GT.M on connection 0:
<html>
...
etc
...
Connection 0 reset and waiting..
Connection utilitisation:
0: 1
1: 0
2: 0
Max queue length: 1