Sunday, August 22, 2010

Ubuntu Server Stats with Geektool

This week after playing a bit with Google CL and cURL posting to Twitter and StatusNet, I wanted to go the next step and have a way to keep an eye on my Ubuntu server that runs my StatusNet instance.

On the Mac there is a free tool called GeekTool which is a System Preferences module that allows for some interesting desktop integrations with files, images and shell scripts. There is also an extensive community around this tool where useful scripts have been built for a number of actions.  

Remote Server Stats:
In order to see that basic stats I wanted, I first needed to have a way to display these remote stats locally.  This required me to write a script (serverstats.sh) to ssh to my server and run a simple command on Ubuntu to display the same sysinfo that comes up on a connected session:

/usr/bin/landscape-sysinfo 

The first challenge is to use ssh in a script that doen't contain my password.  Typically an ssh session will prompt you with a password, so to keep the script secure and connect with a script, I need to create a public and private key for the ssh session to use.  To do this, I ran this on my Mac (system to monitor from) in ~/.ssh/:

ssh-keygen -t dsa

This will generate two keys, one public and one private.  The public key will be copied over to the remote server and the contents of the key will be stored in:

~/.ssh/authorized_keys

You can copy the contents running the following:

cat id_dsa.pub >> ~/.ssh/authorized_keys

The the authorized keys must be given access with the following:

chmod 600 ~/.ssh/authorized_keys

*For complete instructions check out: remy sharp's b:log post

Now I can simply ssh and I am into my remote server.  Obviously this would be an issue if my local machine is compromised but I could always revoke the key on the server if that was the case.  For my needs, it seemed to be a calculated risk!

Now I can go back to geek tool and setup my script to run and refresh. I used the Shell Geeklet and in the script area I added this:

#!/bin/bash

echo "THE HEaRD Ubuntu Server Stats:

"

ssh ip-address-of-your-server ./serverstats.sh

I am diggin' Geektool and look forward to doing more script automation in the future. ~Lou
 

Screen_shot_2010-08-22_at_2Screen_shot_2010-08-22_at_2Screen_shot_2010-08-22_at_2


Saturday, August 14, 2010

Posting Tweets via Command Line

After spending some time in the past week updating my Linux server and spending a lot of time in the command line, I wanted to take a look at methods to post to Twitter.  Since there are many parallels in the way you communicate to StatusNet, I decided to play with the options I found for twitter and modify them to post to StatusNet.

The most common method was using cURL, a free, cross-platform, command line utility that is already on most Unix based systems. Once installed you can post using this format:

'curl -u username:password -d status="Rockin' the tweet with cURL" http://twitter.com/statuses/update.xml'

Now that we know the setup you can type in your own "username" and "password" in the script and type your status between the "".  Rudimentary, but you get the idea.  I am no programmer, but I do enjoy taking snippets and adding automation to them, whether that be with an interface or patching piece together to get to the end result.
 
Screen_shot_2010-08-14_at_2
I like the simplicity of a little Mac app called Automator.  It is a way of graphically taking snippets or actions and daisy chaining them together to perform tasks.  I ties into many other applications on the Mac but also can be tied to scripts and other command line tools. 

I added a task to ask for text, which when the app runs it pops up a dialog and then passed it to a shell script task.  In the shell I used the "Pass input as arguments" and typed in my username and password into the cURL script I pasted in.  I replaced the actual post text between the "" with '$@', passing the entered text from the prompt into the script and running it.

I am going to play with a few other ways to automate this but I will leave it as a geek tool and leave the beautiful applications to be built by coders! ~Lou

Screen_shot_2010-08-14_at_2Screen_shot_2010-08-14_at_2

Monday, August 9, 2010

Google Wave WILL LiveOn!

Img_0030

When Google Wave was first revealed at Google I/O 2009, I was anxious to get my ticket into this great new landscape of communication and collaboration. As the preview was rolled out, all us techies were inviting our techie friends so we could test out all the cool things that could be done with the new platform.
For me, the promise was more than just a new way to communicate, it was a look at simplification of my communication. Centralized communication that could be chat, collaboration, email, social interactions and project management, just to name a few. The reason something as old as email works today is that all email is federated. You don't have to be on GMail to get email from someone on GMail. For those of us that remember, this was not always the case. For me, this is the problem with the Internet today. Twitter, Facebook, My Space, LinkedIn, they all require an account to participate. StatusNet is a great example of how federated systems could work for a service like Twitter. Belong to one service and subscribe remotely to users on another network without having to join every network as well.

Img_0031

Back last December 2009, Google opened up federation between Google's Developer's sandbox (wavesandbox.com) which meant anyone could build a Wave server that could federate with the sandbox with an open source project known as FedOne.
After buying a yet another domain, installing an XMPP server (OpenFire, an open source instant messaging server of which brings the dynamic nature of Wave), registering SSL certificates and building the source, I was able to successfully federate with the sandbox as well. (web interface is the Wave Sandbox and the terminal is my Fed One instance)

Img_0032

After Google I/O 2010, FedOne was updated to have a "FedOne Simple Web Client" in addition to the terminal client which again gave the taste of possibility.

Image

I was beside myself when the news came out the Google was going to stop developing Wave as a standalone product: http://googleblog.blogspot.com/2010/08/update-on-google-wave.html
There are about 1M users on Wave and many are disappointed that the development will cease and will only continue running till the end of 2010. There is even a site that has about 20,000 people try to save Wave at http://savegooglewave.com.
The only comfort is that Wave's protocol is open and can be downloaded and built upon at http://waveprotocol.com. I am hoping Google will open source the web interface so more federated services will pop up. There are a number of companies that are using some of these technologies to build collaboration options into their own offerings. As Google has said, Wave taught them a lot and Docs' recent addition of live typing and Google Buzz's threaded comments are signs of adopted technologies. I would love to see the product live on but I will wait to see the fruits of Wave's labor in future products to come. ~Lou

Thursday, August 5, 2010

StatusNet - Powering THE HEaRD

Statusnet-logo

StatusNet, the open source micro blogging ("Twitter-like", with a stress on like) platform has gone though a ton of changes since it's launch in 2008.  I started playing around with the idea in mid 2008 and eventually got my Statusnet (formerly known as Laconica) running in December 2008.  The project is under very active development and was hosted as a community called Identi.ca.  Developer Evan Prodromou, and now CEO of Statusnet created some standards to allow instances of statusnet to talk to one another and subscribe to remote users without having to belong to every community.

The open nature of remote subscription breaks down the "walled garden" of having to belong to every community (i.e. Facebook and Twitter) and communicate openly across the various community lines.  StatusNet has introduced many new technologies that all you to participate anyway you like, whether it is via IM, SMS, Twitter, FaceBook to name a few.  Here is the list of features that is accessible from the help.

I recently upgraded to the most currently build 0.9.3 which added a number of fixes and additional features, one of which is the new StatusNet desktop.  It is limited compared to other clients out there but it is build on open technologies and does not use Adobe Air (YES!).  The feature set is growning and the more communities there are, the more stable it will be! ~Lou

Screen_shot_2010-08-03_at_2Screen_shot_2010-08-05_at_5Screen_shot_2010-08-05_at_5Screen_shot_2010-08-05_at_5

Wednesday, August 4, 2010

Posterous AutoPost to StatusNet

Posterous-logo

The more I play with Posterous, the more features I discover and they really have been rolling out new capabilities over the past couple of months.  Posterous can "Autopost" to many services across the web as you can see below:

Posterous-autopostPosterous-services

Among some of the others I am using like Twitter, I also noticed one with the StatusNet logo under their popular free community Identi.ca, of which I am a member.  I thought at first it was going to just be direct integration with their StatusNet instance but to my surprise it allowed for custom API endpoints to be specified.  This allows many twitter clients and services to talk to a StatusNet install seamlessly.  
Posterous-identica
My community, THE HEaRD, has been running since December 2008 and I am constantly looking for ways to post there.  Here are a few other clients/services that integrate with StatusNet that I use:
  • Ping.FM
  • iPhone Twitter App
  • HootSuite
  • Tweetdeck
  • Twhirl
For a full list of supported services/clients check out the StatusNet site.

Tuesday, August 3, 2010

Ubuntu Server Upgrades Complete.

Ubuntu-logo
I installed my Ubuntu Server back in December of 2008 to run my StatusNet community (formerly known as Laconica), and needed to have a Linux based LAMP stack for a platform.  After hacking together my htaccess file on my hosting site to get clean URLs, I realized that it was going to be impossible to do more sophisticated things down the road.  I opted to go the pure route of setting up my server to be all command line (CLI) as opposed to having a GUI running.  It brings back memories of my days on Unix but this way I could refresh my terminal skills.  

I had 8.10 "Intrepid Ibex" installed since that was the current version at the time and had done numerous upgrades to StatusNet (about 9 versions) but really had not need to think about upgrades to the server itself.  The upgrade from 8.10 to 9.04 "Jaunty Jackalope" went pretty well, completing in just a few minutes.  

Release Update: sudo do-release-upgrade

In this update I noticed that it had messed with my Apache Root Directory settings and had set them to the default of "www" as my root and was not allowing any connections.  A quick tweak to the default config file and my site was back up.

Set Apache Root Directory: Edit the file /etc/apache2/sites-available/default
Reboot Apache: sudo /etc/init.d/apache2 restart 

Once the root was set to the correct directory, "AllowOverride" was set to "all" instead of "none" and a reboot of apache got things back on track.  I didn't notice this to be an issue in the subsequent upgrades from there.  I then proceded to upgrade from 9.04 -> 9.10 "Karmic Koala" and then from 9.10 -> 10.04 LTS "Lucid Lynx.

The upgrade from 9.10 -> 10.04 had a few issues with Java and PHP5 that needed to be fixed.

Java Update in 10.04:

Java apparently had moved from the default repository to the partner repository so I needed to add that repository:

Add partner repository: sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”
Update source list: sudo apt-get update  
Install Sun Java: sudo apt-get install sun-java6-jre

PHP5 bug in 10.04:

 PHP5 aparently has a bug (#573436) that causes PHP to spew errors even though it seems to work.  The error is: "comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in unknown on line 0".  This was fixed by replacing the "#" with a ";" so the forums came though with a fix:

PHP fix:  
cd /etc/php5/cli/conf.d 
sudo perl -pi.bk -e 's/(s*)#/1;/' *ini 
sudo mkdir bk 
sudo mv *.bk bk

The got things up and running and despite the few glitches I ran into, I cannot imagine that an upgrade like this on Windows Server would have taken me a week and not an hour or so. Long live open source! ~Lou

Time Stamps in Notepad

This is a great little tip for those of you that use Notepad to keep simple notes and want to add a time stamp.  This can be done as an automated function by simply adding ".LOG" and hitting Enter on the first line of a blank Notepad document and saving it.  Upon open, Notepad will enter a date in the form "8:49 AM 8/3/2010" and you can continue with your note taking glory!  

Now close your note and reopen, you will see that Notepad has now added another time stamp and you are logging your entries.  If you don't want this automated you can simply hit "F5" and that will manually drop a time stamp where your cursor is in the document.
If you want to "graduate" up to a more sophisticated notepad app, try out NotePad++, which is a free and open source notepad app for the power user.  It supports multiple tabs, formatting for coding, HTML and extensibility with plugins and more.  I like that it is extremely lightweight and is great for the local system. ~Lou

Screen_shot_2010-08-03_at_8Screen_shot_2010-08-03_at_8Screen_shot_2010-08-03_at_8