Archive for December, 2009

Synchronizing application data using Ubuntu One

Friday, December 18th, 2009

Stuart Langridge summarized an important issue recently on FLOSS Weekly when he said that Linux is all about choice… but not the choice between incompatible data silos. Desktopcouch is a key component of the Ubuntu desktop that enables users to break out of the data silos of today, delivering greater portability across applications.

In case you didn’t know it, Ubuntu One relies heavily on Desktopcouch (which uses CouchDB) for storing and synchronizing subscriber data, such as contacts and bookmarks, to their personal cloud. One of the key initiatives for the Ubuntu One team over the next Ubuntu cycle is to provide more developer resources so more applications can utilize the benefits of Desktopcouch and CouchDB. End users will gain greater data portability across applications as well as the built-in synchronization of CouchDB.

Ryan Paul has posted an excellent tutorial at Ars Technica for developers interested in using CouchDB in their applications. He covers the basics of the Ubuntu One architecture, an overview of how CouchDB is different than more traditional databases, provides simple and advanced code examples, and gives great tips for integrating CouchDB into your application. Read through his article and think about how your application can benefit from the power of Desktopcouch and CouchDB.

Desktopcouch on Windows/Mac

Tuesday, December 15th, 2009

One of the things that I’d really like to see is desktopcouch on Windows and the Mac, so that your data can be everywhere, on all your machines. Now, I don’t know enough about those platforms to actually do it, but I’d be happy to help anyone who was interested in making it happen; here are some thoughts on what’d be required, and do please chip in here with questions, or ask me or others on the #ubuntuone IRC channel on irc.freenode.net.

Desktop Couch, for those of you who aren’t sure, is a personal CouchDB that your apps can store their data in. It’s secured for you alone, and it comes with a built-in replication setup, so two desktopcouches on the same network can exchange data. This means that if your applications store their data in desktopcouch — for example, Bindwood, our Firefox extension to store your bookmarks there — then all the machines on your network can exchange that data, meaning that adding a bookmark on one of your machines will automatically add it on the others, without you having to do anything, and without you having to sign up to some third-party service to make that happen. It’ll all work on your local network. (It can also work via a third-party service — Ubuntu One is such a service, and there could be others, as long as they deploy CouchDB in the cloud — so that machines on different networks can also exchange data.)

CouchDB

The first thing you need to have, to get a personal CouchDB, is CouchDB. I know the Mozilla Raindrop team have done some work getting CouchDB nice and robust and working on Windows, and I believe they have an installer. Working with that would be very cool indeed. (Indeed, it’s possible for Raindrop to use desktopcouch if you have it, so that might be an interesting test!)

On-demand startup and port numbers (or, what’s your D-Bus?)

Desktopcouch is started on demand, when the first application requires it, rather than running all the time even when you don’t need it. Because it is a personal CouchDB, and because there might be more than one user on the machine that you’re on, it can’t run on a specific port number; instead, you ask desktopcouch for its port number when you want it, and asking that question starts it up on a randomly-chosen port if it’s not already running. The way this is done on Ubuntu (and other Linuxes) is with D-Bus, which is a Linux-specific IPC mechanism. It’s possible to use D-Bus on other platforms, but a much better way would be to use your platform’s specific way of passing messages to a service and starting a service if it’s not already running. (This is one of the things I don’t know how to do on other platforms. Would Macs use launchd or something? Should a Windows service be running on startup? I don’t know.) Desktopcouch only uses D-Bus for these two things (“what’s your port number” and “start this service if it’s not already running”), so replacing those sections with a native way of doing that on Windows/Mac would be reasonably easy and make it fit in much better with the Right Way of doing things on that platform; these changes would need to be made both in desktopcouch itself, and in APIs (desktopcouch.records) that connect to desktopcouch.

Where are the keys? (or, no gnome-keyring on Windows)

Because desktopcouch is a personal CouchDB, access to it is secured by OAuth. When desktopcouch is first set up, it randomly generates a set of OAuth tokens, and these are stored in the Gnome keyring on Ubuntu. Obviously, it would be better to use the platform’s own way of storing authentication data; I believe the Mac has a “keychain”, and Windows surely has something similar. Again, this would need changing in desktopcouch itself (to store the keys in the right place), and in desktopcouch.records (to retrieve the keys from that place to use them).

And that’s it

With those changes in place, desktopcouch should run on another platform, meaning that you can exchange data between all your apps on all your machines. We’re already getting some sterling work done to see desktopcouch on other Linux distributions and on phones like the Nokia N900 (hooray for Thomas, among others!). I’d really like to see this happen on Windows and Mac too; are you interested in helping make it happen? Let me know, and I’ll give you all the help you need!

sil on FLOSS Weekly

Friday, December 11th, 2009

FLOSS Weekly

sil (Stuart Langridge) was a guest on FLOSS Weekly yesterday. Stuart told Leo Laporte and Jono Bacon all about the Ubuntu One features, our developer resources, and the plans for Lucid. If you missed TWiT Live, the show (episode 99) will be available very soon. Great job Stuart and thanks TWiT.TV.

UPDATE December 13, 2009: Episode 99 is now available.

Telepathy logging to CouchDB

Tuesday, December 1st, 2009

A picture is worth a thousand words so here is the picture:

And here are those thousand words:

{
   "_id": "e5f826969abc88da927500f018d5acf3",
   "_rev": "1-aedda30270d6a77eea4901e35d9209b3",
   "record_type": "http://www.rtg.in.ua/empathy-im-couchdb",
   "to": "elfy.ua@gmail.com",
   "message": "Please say something for the world - testing CouchDB logging.",
   "from": "roman.yepishev@gmail.com",
   "time": "2009-12-01T18:58:18"
}
{
   "_id": "4f043681a4c11956c592916ea5f6a7ac",
   "_rev": "1-630942a3af4fbd54af0e66a47a1c8ed7",
   "record_type": "http://www.rtg.in.ua/empathy-im-couchdb",
   "to": "roman.yepishev@gmail.com",
   "message": "Hello",
   "from": "elfy.ua@gmail.com",
   "time": "2009-12-01T18:58:28"
}
{
   "_id": "483c5f7649caefb81ce49460a21fe20a",
   "_rev": "1-d18e6e8170a01e46c82ace0f196ebca0",
   "record_type": "http://www.rtg.in.ua/empathy-im-couchdb",
   "to": "elfy.ua@gmail.com",
   "message": "Ok, this is sufficient :)",
   "from": "roman.yepishev@gmail.com",
   "time": "2009-12-01T18:58:37"
}

I am reviewing the code at the moment to make it pass pylint tests and additional testing is needed for different types of accounts. Stay tuned!

Please note that mission-control-5 shipped in Karmic has a bug preventing Observers from seeing the conversation originated by local users. The fix is available only in their PPA at the moment — ppa:telepathy/ppa if you are running Karmic version of 'Software Sources'

See also