Difference between revisions of "EWD Install Instructions"

From VistApedia
Jump to: navigation, search
(Install Node.js & NPM)
Line 30: Line 30:
 
curl http://npmjs.org/install.sh | sh
 
curl http://npmjs.org/install.sh | sh
 
</pre>
 
</pre>
 +
 +
=== 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.
 +
<pre style="padding:1em;border:1px dashed #2f6fab;color:black;background-color:#f9f9f9;line-height:1.1em">
 +
#/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"
 +
</pre>
 +
Copy the ZMGWSI routines from EWD's m_apache directory to your routines folder.
 +
<pre style="padding:1em;border:1px dashed #2f6fab;color:black;background-color:#f9f9f9;line-height:1.1em">
 +
cp svn/EWD/m_apache/*.m ewdroutines/
 +
</pre>
 +
Verify that the routines are found by GT.M:
 +
<pre style="padding:1em;border:1px dashed #2f6fab;color:black;background-color:#f9f9f9;line-height:1.1em">
 +
sam@sam-desktop:~/pocn-moh$ mumps -dir
 +
 +
GTM>d ^%RD
 +
 +
Routine directory
 +
Routine: %ZM*
 +
%ZMGWSI  %ZMGWSIS 
 +
Total of 2 routines.
 +
</pre>
 +
Run the program now to make sure it compiles properly.
 +
<pre style="padding:1em;border:1px dashed #2f6fab;color:black;background-color:#f9f9f9;line-height:1.1em">
 +
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
 +
</pre>
 +
Then make a bash script to call it:
 +
<pre style="padding:1em;border:1px dashed #2f6fab;color:black;background-color:#f9f9f9;line-height:1.1em">
 +
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
 +
</pre>
 +
Now we put it as a xinetd service
 +
<pre style="padding:1em;border:1px dashed #2f6fab;color:black;background-color:#f9f9f9;line-height:1.1em">
 +
# 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
 +
        }
 +
</pre>
 +
Now we test it by putting xinetd in debug mode and then telneting to the port.
 +
<pre style="padding:1em;border:1px dashed #2f6fab;color:black;background-color:#f9f9f9;line-height:1.1em">
 +
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
 +
</pre>
 +
Once you are sure it works, foreground your xinetd process and kill it using Ctrl-C.

Revision as of 08:29, 30 May 2011

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.