Tuesday, May 6, 2008

Family data-center: calendar sharing

Actually, the Internet file-sharing I wrote about previously has been totally uninteresting to my wife. Internet available calendars on the other hand!

When we were just two and she studied and studied for years we had few or no scheduling conflicts. When she started to work it was still manageable, we still only had each other to take into consideration. When we got our daughter the cup runneth full. The little critter was clearly the most important person, and our schedules had to be adjusted to her being among us: Kindergarten x-mas and easter breakfasts, parent-conference there, drop-offs and pickups adjusted to meetings and travel needs. This clearly needs a technological solution!

To be fair, I got this idea from my colleague Bjørn. His wife is a nurse, she works all kinds of hours on a weekly basis, he consults with a client that has all sorts of needs early and late and weekends and what not. And he runs a boy scout troop. They needed calendars long before they procreated.

Being an old fart/dinosaur I resisted this idea for a long time. Fortunately calendars proved surprisingly easy.

I use Thunderbird as IMAP(mail) client. There is a humongous plug in for Thunderbird called Lightning that gives it calendar abilities. There is also a standalone version of Lightning called Sunbird. In the most basic form these store .ics, Ical files locally on your machine. But that does not make them internet available. The next step up is storing the .ics files on your webdav server -- see, suddenly the webdav server became much more desirable! This is very easy, just give lightning a HTTP or HTTPS URL pointing to the webdav file and it will read and write directly to it.

There is a downside to this easy solution: You can only have one program/user attempting to update a calendar at a time. Your whole calendar is just one large file, and it can take several seconds to retrieve or save, and if someone tries to save the shared calendar at the same time, your're so SOL. So, some discipline is needed to use this. That includes shutting down all unused calendar clients, as my wife discovered some days ago, she lost her whole calendar due to some such mishap.

There is a fix to this, it's called caldav. Calendar over DAV i.e. over HTTP. The relationship between caldav and ics over webdav is the same as the relationship between Maildirs and mail-spool-files. The first works well even with multiple clients accessing and updating it at the same time, and the second sucks and is prone to corruption and data-loss.

If you're OK with not having a web interface to your calendar - there is a way to implement caldav without installing a whole groupware suite. After all you installed a working e-mail solution years ago, no need to redo that. The caldav implementation I chose/fount is called davical. It is implemented in PHP and uses Postgress for storage. It was a bit fiddly to install, maybe I did it wrong, maybe their docs were slightly outdated.

davical used to be called rscds, and therefore lives at http://rscds.sourceforge.net/. There are Debian .deb and Red Hat RPM files at source forge. Once you have them installed and read and followed http://wiki.davical.org/w/Installation_Stuff you can give your calendar URL as shown in http://rscds.sourceforge.net/clients.php. The first time I did this, and imported an old calendar with the help of Lightnings export/import functions, davical sat there quite stunned a while. And then it worked. It's fast to delete from, it refreshes quite fast compared to huge calendars in ICS files and so on.

No comments: