Monday, January 12, 2009

screenbin - like pastebin, but for screen

Just before Christmas, Mark Shuttleworth posed a question to our development team. He asked us think about how we could leverage Ubuntu instances in the Amazon EC2 cloud in the course of our daily development practices.

I had a jump-start on that question, in that I had already been thinking about it for several weeks.

To answer Mark's challenge, I created a script that I call screenbin.

Most of us that use IRC on a daily basis are familiar with 'pastebin', such as http://pastebin.ubuntu.com. For those that are not, a pastebin is a website that allows people to paste large dumps of code or text data, and then share simply by referencing a URL. It's handy in IRC and instant messaging, where people generally abhor large dumps of text being pasted and overrunning their IRC buffer.

Pastebin has become an incredibly valuable tool for collaborative communication and development. It's key that the data shared via pastebin is non-confidential and volatile (able to be discarded at any time).

Thinking about Amazon's EC2, I'm particularly intrigued with the "throw-away" nature of instances. A given instance is useful for some period of time, and then it's trivial to destroy that instance, and pay your ~$0.10 tab for 1 hour's usage.

I also noted the asynchronous limitations of pastebin. For real-time collaborative editing, you can use something like Gobby. But what if you want to do more than simple document editing? What if you and your Agile Development practices dictate that you need to do some extreme programming or paired programming with a buddy halfway across the globe? Or you need to do a demo, some education, instruction, or peer code review? Maybe some collaborative debugging? Or even mentoring?

Of course, you can use a shared GNU screen or VNC session. This necessitates exchanging keys or passwords, though, and allowing that sort of access over the Internet. Most of the time, our personal or corporate firewalls prevent this sort of access for very good reasons. And even when it doesn't (or can be opened), allowing such access can be a bad idea!

But then there's that "throw-away" nature of EC2. In a matter of seconds, you can instantiate a brand new, pristine and clean Ubuntu instance in EC2, add the additional packages you need. You can point your collaboratives to a publicly accessible hostname/ip and get to work. When you're done (or should something go south, such as the machine becoming compromised), you can pull the plug and destroy the instance in a second. You can do all of this without necessitating any changes in your network infrastructure or firewalls.

This is the magic that screenbin provides!

Prerequisites

You must have an active EC2 account and the userspace utilities installed. For instructions, see:

Installing

I have packaged it for Ubuntu, and I hope that it will make into Jaunty Universe soon. For now, it's available in my PPA:
* https://launchpad.net/~kirkland/+archive

Usage

Once you have installed screenbin, you could use it like so:
$ screenbin --guest kirkland --guest mathiaz --packages "ubuntu-desktop" --ec2-keypair ~/.ssh/ec2-keypair.pem

screenbin will use Launchpad to retrieve the guest users' ssh keys, so the value of --guest should be a valid Launchpad id. And it will try to retrieve a public key from $HOME/.ssh/*pub. In this case, you would be sharing a screen session among yourself, as well as kirkland and mathiaz.

It will install the specified additional packages on the instance, and install the guest users' ssh keys.

Then, you and each of your guests can ssh to the public hostname/ip address and each of you should be logged into a shared screen session.

Upcoming features
Feedback

Please provide feedback and feature requests in Launchpad as bugs at:

:-Dustin

6 comments:

  1. screenbin sounds like it would dump a screenshot onto tinypic/flickr, the name confuses me.

    ReplyDelete
    Replies
    1. You mean like http://www.screenbin.org ?

      Delete
  2. I'll try it out today. Looks useful. thanks!!

    You mention the drawbacks of shared gnu screen: "This necessitates exchanging keys or passwords, though, and allowing that sort of access over the Internet." I've created http://shellshadow.com just for dealing with these issues. Its basically collaborative PuTTY through a relay server. So nothing to install or configure on your server. I would greatly appreciate some feedback.

    ReplyDelete
  3. shellshadow looks to be windows-only?

    :-Dustin

    ReplyDelete
  4. Dustin,
    You caught me just as I am reinstalling my shellshadow production server (ubuntu 8.04.1, thank you!!) The new webapp does not contain the linux client download.
    I _do_ have a linux client and will keep updating the webapp over the next few days to put it up.
    Feel free to contact me directly at my "real" email address: jhancock@shellshadow.com. I would very much like a ubuntu server insider's opinion on what I've done and will do next.
    thanks, Jon

    ReplyDelete
  5. Wow, that is very cool. I agree that 'screenbin' is a somewhat misleading name though.

    ReplyDelete

Please do not use blog comments for support requests! Blog comments do not scale well to this effect.

Instead, please use Launchpad for Bugs and StackExchange for Questions.
* bugs.launchpad.net
* stackexchange.com

Thanks,
:-Dustin