License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

However, the quickest and easiest way to get a GT.M system going is to use Mike Clayton's M/DB installer for Ubuntu Linux which will create you a fully-working environment within a few minutes. Mike's installer actually installs the previous version of M/DB as well as GT.M, but the instructions later in this ReadMe document explain how to upgrade to the new Node.js-based version.

Node.js can reside on the same server as GT.M or on a different server.

The instructions below assume you'll be installing Node.js and GT.M on the same server.

You can apply Mike's installer to a Ubuntu Linux system running on your own hardware, or running as a virtual machine. However, I find Amazon EC2 servers to be ideal for trying this kind of stuff out. I've tested it with Ubuntu 10.10.

So, for example, to create an M/DB Appliance using Amazon EC2:

Start up a Ubuntu Lucid (10.10) instance, eg use ami-508c7839 for a 32-bit server version, or ami-548c783d for a 64-bit server version.

32-bit Ubuntu:

Log in to your Ubuntu system and start a terminal session. If you've started a Ubuntu 10.4 or 10.10 EC2 AMI, log in with the username ubuntu

If you point a browser at the domain name/IP address assigned to the Ubuntu machine, you should now get the M/DB welcome screen. Follow the instructions you'll see in the welcome screen to initialise M/DB.

You now have a fully-working and configured GT.M database, ready for use with node-mdb. Now follow the instructions below to upgrade to the new Node.js-based version of M/DB.

Installing Node.js

Installing the node-mdb components

The destination directory in which you'll find the files is determined by the path in which you ran the above command.

In the repository's /lib directory, you'll find the main M/DB Node.js file: mdb.js and a second file named mdbInit.js. Copy these files to the path /usr/local/gtm/ewd/ on your GT.M server (adjust this path appropriately if you've installed GT.M for use in another directory).

In the repository's /gtm directory, you'll find the M/Wire interface files that are used by mdb.js to access the GT.M database (See https://github.com/robtweed/node-mwire for more details on the node-mwire used by node-mdb)

You need to copy the files to the following directories:

Copy the file mwire to /etc/xinetd.d/mwire

Copy the file zmwire to /usr/local/gtm/zmwire and change its permissions to executable (eg 755)

Copy the file zmwire.m to /usr/local/gtm/ewd/zmwire.m

Next, you need to set up the port that is used by M/Wire to access GT.M. Edit /etc/services and add the line:

mwire 6330/tcp # Service for M/Wire Protocol

Nearly there! You just need to use NPM to install some other Node.js modules that are used by node-mdb.

Installing the additional Node.js modules used by node-mdb

Simply use NPM as follows:

npm install node-mwire
npm install redis-node
npm install node-uuid

You're now ready to use node-mdb

Running node-mdb

Before you run node-mdb for the first time, you need to set up an administrator's access key id and secret key. These are used for signing the API requests (just as happens in SimpleDB).

To do this, edit the file mdbInit.js to create the values you wish for your access key id and secret key (It's not advisable to use the pre-defined values!). Then simply run it:

cd /usr/local/gtm/ewd
node mdbInit.js

You only have to run this once (or any time you want to change your security credentials).

Now you're ready to fire up node-mdb:

cd /usr/local/gtm/ewd
node mdb.js

Most SimpleDB clients will work with node-mdb. The main requirement is that you must be able to change the URL that normally points to the Amazon SimpleDB server, and point it at your M/DB instance instead, eg:

http://192.168.1.100:8081/

By default, node-mdb listens on port 8081 for incoming HTTP requests. You can change this and a number of other settings by editing mdb.js. You'll find the customisable parameters described in the comments at the top of the file.