EWD Install Instructions

From VistApedia
Revision as of 08:40, 30 May 2011 by Shabiel (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 Repos of EWD and Node.js

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 https://github.com/robtweed/EWD.git		; Get EWD
git clone https://github.com/joyent/node.git		; Get Node.js
sudo apt-get install libssl-dev

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.

# 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 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
export gtm_badchar=0
export gtm_principle_editing="EDITING"

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.

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/