Why is CardDAV so difficult?

Background

Back in the dark ages, Apple introduced iCal and the early versions allowed you to “publish” your calendar and “subscribe” to other calendars stored on a WebDAV server. It was trivial to set the home server up to support WebDAV and we got used to having our calendars visible to each other.

A bit later, after the “do no evil” guys started doing things like email and calendars, Apple changed things so that you needed a CalDAV server to share calendars. But by then our G4 PPC Mac Mini was so old that getting CalDAV running on it was too much work. Too much work in that I’d have to do lots of back porting or write my own server software. So we migrated to using the “do no evil” guys  for calendaring even though we never felt very comfortable sharing that level of personal information with them.

For address book data we could have simply checked the “Synchronize with Google” box in the account setting in the Address Book app and then setup the Android phone to also sync with Google. But I never wanted to share that type of information with them. So I periodically exported vCard.ics files, moved them to the phones and then imported them into the Contacts apps on the phones.

Now the services hosted by that old Mac Mini are going on to VPS instances running currently supported versions of Linux. So setting up a calendar server is pretty straight forward.

And most calendar server software also supports CardDAV so sharing address book information between the Macs and the Android phones becomes easier. Instead of the periodically exporting/copy/import routine I can, in theory, simply update or add a contact in either place and have things sync’ed automatically. Should be pretty easy, right?

Progression of attempts

Reading up on things, I decided to go with davical as it and calendarserver both seemed to be high on the list of good calDAV and cardDAV servers. Calendarserver requires extended attribute support in the file system and I wasn’t sure that the virtual machine images supplied by my service provider had that in the kernel so the first choice was davical.

Davical

Davical, like all the server software I tried, handled calendars perfectly. But whoever “designed” the user interface needs to be taken out and shot. A bunch of cryptic fields with no help and no user guide to speak of, but since I have only a few users to set things up for I can grit my teeth and ignore that. However there were issues getting the Address Book on the Mac to play nicely with it. About 25% of my entries disappeared on the initial import and the more I played with things to get it squared away the worse it got. So it was time to try something else.

CalendarServer

CalendarServer, also called the “Darwin Calendar Server” (DCS), comes out of Apple so I figure it ought to play nicely with the the Macintosh Address Book app. I determined that my VPS is configured to support extended file attributes so no kernel changes or rebooting needed. It is actually fairly easy to determine extended attribute support:

# apt-get install attr
# touch xxx
# attr -s user.test -V "1234" xxx
Attribute "user.test" set to a 4 byte value for xxx:
1234
# attr -l xxx
Attribute "user.test" has a 4 byte value for xxx
# attr -r user.test xxx
# attr -l xxx
# rm xxx

If you do the straight install off the Ubuntu repositories you get an older version. Lots of configuration choices with examples in the configuration file for integrating with LDAP and other authentication schemes. I simply used an XML file to define the few users I had. And while it did calendars fine, I couldn’t even connect to it for contacts on either the phone or the Mac. Maybe it was because the version was old. I didn’t try the latest as I could not find instructions for creating a production, as opposed to test or development, version and didn’t feel like engineering my own solution.

Time for some more reading. This time I came up with owncloud.

OwnCloud

OwnCloud supports lots of things with calendars and contacts being just two of the components. This has, by far, the best administrative user interface of the bunch. It is not in the standard Ubuntu 12.04 repositories but there are instructions that make it easy to install. I am a little adverse to having a “all-in-one” server as I suspect it allows for more security issues and if the one service goes down for any reason you lose them all. But if it works for calendar and contacts then the rest is gravy. Calendars work fine but again I ran into issues with contacts and my Mac’s Address Book app. Again on a straight import a lot of entries were lost and even if there were groups setup on the server side neither my Mac nor my Android phone could see or access them.

Result

Playing with different ways of importing contacts on OwnCloud showed that exporting vCards from my Address Book app and then importing them into the server via its web interface was the most reliable way with all cards being imported. But the lack of group information being usable by my phone or laptop was annoying.

So I went back to DaviCal and tried the same trick of exporting a vCard file and then importing via the web interface. I hadn’t tried that before as it was not obvious that it was possible. That put everything into the server but without group information. Going back to the Address Book app on the laptop I was able to create groups and sort the people into those groups and it seemed to stick.

Finally, using CardDAV Sync Free Beta, I was able to get the calendar app on the Android phone to see all cards and all the groups with the card count totals for each matching what the server and the Mac agreed to. Some where between the Calendar app the CardDAV Sync Free Beta app there is an issue that keeps me from editing group information on the phone so that has to be done on the Macintosh. I suspect it is a bit touchy and will not be surprised if things like group membership are not stable.

I’ve ended up using DAVdroid on the Android phone to sync both the calendar and address card information. It doesn’t support address card groups but it looks like there is an active development team so I have hopes for the future.

Why is it so easy to do calendar sharing between devices yet so difficult to do the same with contact data in address books?