Friday, September 24, 2010

Meteor showers Live StatusNet Updates

Screen_shot_2010-09-24_at_12
If you are a regular visitor to sites like Twitter or FriendFeed (not via a client) you may notice how these sites update as new feeds come in without requiring you to reload the webpage.  This type of behavior is delivered via technologies like Meteor.

StatusNet, the open source microblogging platform I use, supports a number of technologies within their plugin architecture, one of which is Meteor.  Only having a single server (for now) hosting my StatusNet site, I wanted to get Meteor running and coincide with Apache.  Since they both want to play in the HTTP playground known better was port 80, I needed to reconfigure Meteor to run.

Meteor Configuration:

- Follow all the setup instructions from the Meteor site.

- Before RUNNING Meteor you need to change Meteor's Config.pm to avoid colliding with Apache on port 80. (for example 8085 instead of 80)

Modifications:

- Edit /usr/local/meteor/Meteor/Config.pm to match the following:

  1. ControllerIP => '127.0.0.1', (This is empty by default, leave the port to 4671)
  2. SubscriberIP => 'ip.of.your.statusnet', (I used the IP of my domain name)
  3. SubscriberPort => '8085', (This is my example port mentioned above)

- An additional change was made to the meteor.js file to reflect my new port specification (8085 in our example)

Modifications:

  1. port: 8085 

- Run Meteor in the background, however in Ubuntu you will need to modify the "Meteord" file first.  This is detailed on step 3 in the Meteor installation site since they test in Fedora. (Also make sure /etc/init.d/meteord is set to executable (chmod +x meteord)

sudo /etc/init.d/meteord start

NOTE: You can also check that Meteor is running by running the following command:

sudo netstat -plunt

Home

 StatusNet Configuration:

Since StatusNet has an extensive plugin framework, adding technologies like Meteor is a snap!  A few lines in your Config.php and realtime will be live!  Here are the steps: (using our 8085 port)

  1. Edit your Config.php
  2. Add the Plugin: (this will communicate with your Meteor server and add the play/pause buttons to the top of your site's timeline)

addPlugin('Meteor', array('webserver' => 'yourdomain.com', 'webport' => '8085', 'controlserver' => '127.0.0.1', 'controlport' => '4671'));

      3. Release the daemons!
scripts/startdaemons.sh
NOTE: Depending on what plugins you have enabled a number of daemons will be launched.  If you have the daemons already running, you will need to stop and restart them: (from StatusNet instance root)
scripts/stopdaemons.sh
I have noticed that the queuedaemon typically doesn't get killed with the above script so I have manually killed it and relaunched. Usually I just look up the PID and kill it:
ps aux
sudo kill PID (replace PID with found process ID)

Additional Notes:

Currently there appears to be an issue with pages continuously reloading on Webkit browsers like Chrome and Safari. The good folks at StatusNet have fixed this issue with on their Meteor site at meteor2.identi.ca.  I just pulled down the 4 files located in their public_html folder and replaced mine, adjusting the port in their meteor.js file as mentioned above. ~Lou