Archive for the ‘Uncategorized’ category

Install Google Wave Federation Prototype Server

October 7th, 2009

Below are instructions on how to install the Google Wave Federation Prototype Server. I used Ubuntu 9.04 (Jaunty Jackalope) and ejabberd as the Jabber/XMPP instant messaging server.

Step 1: Install Java
Java is necessary because the Wave Federation Prototype Server is delivered as a Java application that talks XEP-0114.

First make sure your repositories are set to multiverse:

vi /etc/apt/sources.list

This is what my sources.list looks like.

deb http://archive.ubuntu.com/ubuntu/ jaunty main restricted universe
deb-src http://archive.ubuntu.com/ubuntu/ jaunty main restricted universe

deb http://archive.ubuntu.com/ubuntu/ jaunty-updates main restricted universe
deb-src http://archive.ubuntu.com/ubuntu/ jaunty-updates main restricted universe

deb http://security.ubuntu.com/ubuntu jaunty-security main restricted universe
deb-src http://security.ubuntu.com/ubuntu jaunty-security main restricted universe

deb http://us.archive.ubuntu.com/ubuntu/ jaunty main restricted multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty main restricted multiverse

Second update you repositories

sudo apt-get update

Third install Java:

sudo apt-get install sun-java6-jdk sun-java6-fonts

You will also need to install Ant to build the Wave server:

sudo apt-get install ant

Step 2: Install ejabberd

sudo apt-get install ejabberd

Step 3: Configure ejabberd

First make a copy of your configuration file

cp /etc/ejabberd/ejabberd.cfg /etc/ejabberd/bu-ejabberd.cfg

Second edit the configuration file

sudo vi /etc/ejabberd/ejabberd.cfg

These following settings are basic configurations to get your ejabberd server up and running.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Options which are set by Debconf and managed by ucf

%% Admin user
{acl, admin, {user, “username”, “yourhostname.com”}}.

%% Hostname
{hosts, ["yourhostname.com"]}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%% When a user registers, send a notification to
%% these Jabber accounts.
%%
{registration_watchers, ["username@yourhostname.com"]},

{access, register,[{deny, all}] }

Up to this point we just specified the host name and identified who will be the admin of this server. It is important to understand that no user has been create. We will do that later.

Stop and start ejabberd:

sudo /etc/init.d/ejabberd stop
sudo /etc/init.d/ejabberd start

Create your user, make it match the user you specified as your admin (or create more than one):

ejabberdctl register username yourhostname.com password

Create a self signed certificate for ejabberd:

When we installed ejabberd, it automatically created a certificate for us.
The problem is it used the common name of ejabberd. This is not a huge problem but for some XMPP clients it will complain and warn users about the common name mismatch.
To fix this, we need to make the common name match our domain name (For example www.example.com).
During the process of creating your certificate, it will ask you for a password and then it will ask you to set the subject name of the certificate (which will have the common mame). Make the password be whatever you want.

For the subject name, just make sure the common name matches your domain name. The following block of text is an example of what the certificate creation process will look like while you generate your subject name. The only piece that matters is the Common Name.

Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []: www.example.com
Email Address []:

Lets create your certificate:

sudo cp /etc/ejabberd/ejabberd.pem /etc/ejabberd/bu-ejabberd.pem
openssl req -new -x509 -newkey rsa:1024 -days 3650 -keyout privkey.pem -out server.pem
openssl rsa -in privkey.pem -out privkey.pem
cat privkey.pem >> server.pem
rm privkey.pem
sudo mv server.pem /etc/ejabberd/ejabberd.pem

Step 4: Install the Google Wave Federation Prototype Server:
First install Mercurial:
Mercurial
is a distributed version control system.

You can check and see if its already install by typing:

hg –version

If you need to install it just type:

sudo apt-get install mercurial

Second get the Google wave code:

hg clone https://wave-protocol.googlecode.com/hg/ wave-protocol

This command will add the Google Wave Federation Prototype Server source into a wave-protocol directory.

Third build the GWFPS using ant:
Move into the wave-protocol directory:

cd wave-protocol

Type the following command to build:

ant

Once the build is complete you should see all the .jar files you need in the dist directory.

Step 5: Configure ejabberd to reference the GWFPS

Add this to the listener section of your ejabberd.cfg file:

{8888, ejabberd_service, [{access, all}, {shaper_rule, fast},
{hosts, ["wave.yourhostname.com"],
[{password, "yourpassword"}]}
]}

Step 6: Start the wave (the ugly way)!
Make sure you edit the values of the arguments to match your settings:

java -jar dist/fedone-server-0.2.jar -client_frontend_hostname localhost –client_frontend_port 3456 –xmpp_component_name=wave –xmpp_server_hostname=yourhostname.com –xmpp_server_ip=127.0.0.1 –xmpp_server_port=8888 –xmpp_server_secret yourpassword –xmpp_server_ping=”" –certificate_domain=yourhostname.com –certificate_private_key=test/org/waveprotocol/wave/examples/fedone/crypto/test.key –certificate_files=test/org/waveprotocol/wave/examples/fedone/crypto/test.cert  –waveserver_disable_verification=true –waveserver_disable_signer_verification=true

Using your XMPP client you can do a service directory look up and see if the GWFPS is running (I used Psi):

Google_Wave_PSI

Step 7: Configure and run the server (the prettier way):
First copy the run-config.sh.example to run-config.sh found in your wave-protocol directory.

cd /etc/ejabberd/wave-protocol/
cp run-config.sh.example run-config.sh

Second configure this file using the values you passed in Step 6:

vi run-config.sh

Here is the run-config.sh file with the values that I edited marked in bold:

#!/bin/bash

# Configuration for the FedOne run scripts.
#
# Copy this file to run-config.sh and configure the variables there.
# Please see http://code.google.com/p/wave-protocol/wiki/Installation for
# instructions on how to configure the flags.
#

# Remove this line after configuring
#echo “You must configure the run-config.sh script” ; exit 1

### Variables common to the server, clients, and agents
###

# Domain name of the wave server
WAVE_SERVER_DOMAIN_NAME=yourservername.com

# Host name and port the wave server’s client frontend listens on
WAVE_SERVER_HOSTNAME=localhost
WAVE_SERVER_PORT=3456

# The version of FedOne, extracted from the build.properties file
FEDONE_VERSION=`grep ^fedone.version= build.properties | cut -f2 -d=`

### Server-specific variables
###

# These will probably need to be changed
XMPP_SERVER_SECRET=yourpassword
PRIVATE_KEY_FILENAME=test/org/waveprotocol/wave/examples/fedone/crypto/test.key
CERTIFICATE_FILENAME_LIST=test/org/waveprotocol/wave/examples/fedone/crypto/test.cert

# These should be okay to leave alone
CERTIFICATE_DOMAIN_NAME=$WAVE_SERVER_DOMAIN_NAME
XMPP_SERVER_HOSTNAME=$WAVE_SERVER_DOMAIN_NAME
XMPP_SERVER_PORT=5275

# Set XMPP_SERVER_IP to localhost if the XMPP and FedOne servers are
# running on the same host
XMPP_SERVER_IP=$XMPP_SERVER_HOSTNAME

# Set true to disable the verification of signed deltas
WAVESERVER_DISABLE_VERIFICATION=false

# Set true to disable the verification of signers (certificates)
WAVESERVER_DISABLE_SIGNER_VERIFICATION=true

Run the server from within the wave-protocol directory:

./run-server.sh

Open another terminal, run client from within the wave-protocol directory:

./run-client-console.sh yourusername

To see a really nice example of how you can play with the client make sure you check out the screen cast at dambalah.com. In his screencast Luc does an excellent job of showing us how to get the GWFPS up and running with OpenFire

Resources:
These are the resources and instructions I followed to write this entry:

  • Share/Bookmark

XMPP, aahh push it!

May 19th, 2009

xmppI decided to look into XMPP after the last NFJS in Reston, VA. It was a lecture by Brian Sletten that made me realize how powerful this technology could be. Before the lecture my only knowledge of this protocol was that it has something to do with instant messaging. After the lecture I was excited and motivated to look deeper into this protocol. My goal with this post is to give you a general idea of what this protocol is and what it could be used for. As I experiment with different libraries, I will post code examples of how XMPP could be used on your web application.

What is XMPP?
XMPP stands for Extensible Messaging and Presence Protocol. The xmpp.org site defines it as “a set of open XML technologies for presence and real-time communication.” In other words, this is a technology that allows you to send XML from one place to another almost instantly.

How does it work?
As an architecture, XMPP is similar to email in that, not only do they both use a client-server structure, but also, all the different servers are connected to allow cross-domain communication. In essence, just like a user with a @mac address can send a email message to a @gmail account, so can the @gmail user send a XMPP message to a @mac account.

The big difference between email and XMPP is how the connected servers will communicate when a message is being sent. On an email system, the client will connect to the server which will then decide where to forward the message too. This message could be forwarded to multiple servers before it reaches it’s destination. On a XMPP architecture, the client will connect to the Jabber server which will connect directly to the recipient’s server and deliver the message.

To XMPP?
XMPP can be used for many different reasons. Of course we can use it for instant messaging, but what else? One use that seems to be gaining popularity is notifications. Most of the current applications are using RSS like, pull technologies, wasting bandwidth and server resources by having to go and check every so often for new messages (even when there aren’t any new messages to get pulled). Considering that XMPP is a push technology, notifications will be sent instantly when a new message is generated, there is no need to check for it.

Another great use for XMPP could be data transfer. A simple example of this would be an application that allows you to update your twitter account from your instant messaging client.

There are many other things that can be done including, monitoring systems, identifying the presence of users, and even controlling servers from our instant messaging client. In the end its up to our imagination.

Or NOT XMPP?
The biggest reason for not using XMPP is, if you need to guarantee that a user will see the message. With a XMPP architecture, if a recipient’s client application is not running, it is possible that the message will never get to him/her.

If you are interested in XMPP keep checking back as I will be posting tutorials with code examples. If you are still confused on the power of XMPP, check out Google Wave, its somewhat of a cool application :)

  • Share/Bookmark

Reaching my Flow with music

May 5th, 2009

motivatorcube1During the last NFJS conference I attended, Neal Ford gave a speech about how the environment can have a serious effect on how productive we are. He mentioned that we love programming because it is a way for us to reach the “Flow”. The concept of the “Flow” was proposed by Mihály Csíkszentmihályi, and is defined as “the mental state of operation in which the person is fully immersed in what he or she is doing by a feeling of energized focus, full involvement, and success in the process of the activity.”

Neal, gave us a list of good ideas one how we can reach our “Flow”, after all this is not something we can just turn on and off. The list included, comfortable chairs, double monitors, toys and NO CUBE FARMS. He also talked about the difference between the left and right side of our brains and how we need both for our line of work.

For me, as well as many others, I believe that music is a good way of reaching the “Flow”. Here is a list of some of my favorite artist to work with:

1. Brian Eno

2. E.A.R. (Experimental Audio Research)

3. Flying Saucer Attack

4. Can

5. Kraftwerk

6. Leonard Cohen

7. Mojave 3

8. Nick Drake

9. Sigur Ros

10. Tom Waits

  • Share/Bookmark