Most of you will be familiar with Ubuntu One as the personal cloud service in which you can sync your files, buy music, and more. While the Ubuntu One team has been working hard to expand the end-user quality and experience of Ubuntu One, I wanted to share my experience with working with Ubuntu One from the perspective of an application developer.
A lot of people don’t realize that you can build support for Ubuntu One into your application and they provide a rather nice Python library to talks over DBUS to do this. Adding this support was simple.
The Ubuntu Accomplishments system was designed with Ubuntu One as a core piece. We didn’t use Ubuntu One because it had to be Ubuntu but instead that Ubuntu One solved a number of problems in building a decentralized application such as Ubuntu Accomplishments.
We wanted to be able to verify and validate accomplishments (so they can’t be faked), so we knew we needed a system in which we could transfer files over the network, process those files, sync the files back to one or more clients, and also provide a means in which you can view your trophies on any of your Ubuntu machines. Ubuntu One provided the ideal system for performing this syncing with the added benefits of being integrated into the Ubuntu experience.
Not that kind of sync.
So how does Ubuntu Accomplishments use Ubuntu One?
- When you load the application and enable support for verified trophies, it creates a directory on your computer and then marks it as an Ubuntu One share. It then offers the share to the validation service Ubuntu One user (which is just a regular Ubuntu One user that I tie some processing functionality to).
- On the external machine (the validation server) I have a script that listens for Ubuntu One share offers and when the share comes in it accepts it.
- When an accomplishment has been detected on the client machine the trophy is added to the share, which then automatically syncs to the validation server, and there we listen for an Ubuntu One signal to then kick off the verification. The signed trophy is then put back into the share which then syncs to the client.
As I mentioned earlier there is a Python module that I use to talk to Ubuntu One, and this not only provides methods to access all aspects of Ubuntu One (e.g. creating, offering, refreshing, listing, and subscribing to shares) but also provides a set of signals that you can connect to detect Ubuntu One sync events and handle them accordingly.
What is also nice, and lesser known in the community, is that you can run Ubuntu One on a headless machine. This is exactly what I am doing right now by running Ubuntu One an OpenStack image. You can find out how to set up Ubuntu One in a headless environment here.
Finally, many thanks to the Ubuntu Team for providing help and guidance for using their API.