Desktopcouch on Windows/Mac

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!